Skip to content

Clean up unused headers in parser/ and subfolders#18422

Merged
lnkuiper merged 24 commits intoduckdb:mainfrom
Schwarf:cleanup/parser_headers
Nov 13, 2025
Merged

Clean up unused headers in parser/ and subfolders#18422
lnkuiper merged 24 commits intoduckdb:mainfrom
Schwarf:cleanup/parser_headers

Conversation

@Schwarf
Copy link
Copy Markdown
Contributor

@Schwarf Schwarf commented Jul 27, 2025

Hi all,
I'm new to contributing to DuckDB and am currently exploring the codebase to better understand its system architecture. As a first contribution, this PR focuses on removing unused #include directives, primarily within the parser/ directory and its subfolders.

Summary of Changes

  • Removed unused headers to improve clarity and maintainability (and potentially reduce build times)
  • In some cases, this led to adding missing headers in files outside of the parser/ folder to ensure the code compiles cleanly.
  • No production logic or test code has been altered—this PR is strictly limited to #include statements.
  • I ran all tests locally in a RELEASE build, all tests pass.
  • I ran all tests locally in a DEBUG build. The same 26 tests fail on both main and this branch, indicating that this PR does not introduce any new test failures. I'm not sure whether these test failures are expected in DEBUG builds — would appreciate clarification.

Notes

As I'm still getting familiar with the architecture and conventions of DuckDB, I'm very open to any feedback or suggestions for improvement. I’d also appreciate any guidance on how to structure such changes in the future, or if this type of cleanup is desirable.

Thanks for your time.

@Schwarf Schwarf force-pushed the cleanup/parser_headers branch from d760506 to a5cbc0f Compare July 30, 2025 11:23
Comment thread extension/core_functions/scalar/generic/current_setting.cpp Outdated
@hannes
Copy link
Copy Markdown
Member

hannes commented Aug 11, 2025

Thanks for the PR, could you try to resolve the conflict?

@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Aug 11, 2025

Hi @hannes,
I’ve resolved the conflicts and ran all unit tests locally — all tests passed.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft August 11, 2025 15:17
@Schwarf Schwarf marked this pull request as ready for review August 11, 2025 15:18
@hannes
Copy link
Copy Markdown
Member

hannes commented Aug 11, 2025

Could you run the formatter, too please? make format-fix

@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Aug 11, 2025

Could you run the formatter, too please? make format-fix

Oh sorry. My bad.

@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Aug 11, 2025

Hi @hannes,
I ran make format-fix inside a virtual environment (with black>=24 installed and clang-format 11.0.1), but it didn’t change any files.

@hannes
Copy link
Copy Markdown
Member

hannes commented Aug 12, 2025

I think you may be missing cmake-format

@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Aug 12, 2025

Hi @hannes,
I missed building the extensions earlier — fixed that now. Rebuilt with all extensions and ran the full unit test suite; all tests passed. Verified my formatting environment (screenshot attached).
image

@duckdb-draftbot duckdb-draftbot marked this pull request as draft August 13, 2025 07:02
@hannes hannes marked this pull request as ready for review August 13, 2025 07:29
@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Aug 13, 2025

Hi @hannes,
I realized that my last local build didn’t include the benchmarks, so I missed this compile error. I’ve now rebuilt with -DBUILD_BENCHMARKS=1 and all relevant extensions, fixed the missing include in the benchmark build, and confirmed that all unit tests and benchmarks compile and run successfully.

Thanks for your patience — still learning my way around the DuckDB build configuration.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft August 15, 2025 06:52
@hannes hannes marked this pull request as ready for review August 15, 2025 06:52
@duckdb-draftbot duckdb-draftbot marked this pull request as draft August 25, 2025 08:04
@hannes hannes marked this pull request as ready for review August 31, 2025 05:11
@duckdb-draftbot duckdb-draftbot marked this pull request as draft September 3, 2025 09:15
@hannes hannes marked this pull request as ready for review September 3, 2025 09:15
@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Oct 5, 2025

Hi @hannes @Tmonster,
CI reports a large extension size regression on this PR (https://github.com/duckdb/duckdb/actions/runs/17428851784/job/51108588620).
I only touched includes. Before I spend more time on the Windows fixes: should I proceed with this PR, or would you prefer I close it due to the size check?
Happy to adjust if there’s a recommended path.

Thanks!

@Schwarf Schwarf force-pushed the cleanup/parser_headers branch from cb77b0c to ef5b931 Compare October 5, 2025 08:37
@Schwarf Schwarf force-pushed the cleanup/parser_headers branch from ef5b931 to 8f44db8 Compare October 5, 2025 08:49
@lnkuiper lnkuiper self-requested a review November 7, 2025 12:50
@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Nov 10, 2025

Hi @lnkuiper,
thank you for picking this up—much appreciated.

@duckdb-draftbot duckdb-draftbot marked this pull request as draft November 11, 2025 13:18
@lnkuiper lnkuiper marked this pull request as ready for review November 11, 2025 13:18
@duckdb-draftbot duckdb-draftbot marked this pull request as draft November 12, 2025 09:35
@lnkuiper lnkuiper marked this pull request as ready for review November 12, 2025 10:26
@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Nov 12, 2025

Hi @lnkuiper — quick question: do we know what caused the extension size regression here? I only touched includes and I’m curious for future PRs. Thanks!

@lnkuiper lnkuiper merged commit f1c4ceb into duckdb:main Nov 13, 2025
103 of 104 checks passed
@lnkuiper
Copy link
Copy Markdown
Collaborator

@Schwarf I don't see any regressions in CI: https://github.com/duckdb/duckdb/actions/runs/19294234522/job/55172234213?pr=18422#step:7:1

Run python scripts/regression_test_extension_size.py --old 'duckdb/build/release/extension' --new build/release/extension --expect json,parquet,tpch,tpcds
 - checking 'parquet': old size=15648134, new_size=15648134
 - checking 'json': old size=34387558, new_size=34387558
 - checking 'tpcds': old size=20085502, new_size=20085502
 - checking 'core_functions': old size=21544070, new_size=21544070
 - checking 'tpch': old size=18794078, new_size=18794078

All extensions passed the check!

@Schwarf
Copy link
Copy Markdown
Contributor Author

Schwarf commented Nov 13, 2025

Hi @lnkuiper,
Thanks. I was just curios, because in the beginning of Oct regressions made the build fail see comment.

Now that this PR is merged: would it be useful if I open more small cleanup PRs that only remove unused headers, or would you prefer a different approach?

@lnkuiper
Copy link
Copy Markdown
Collaborator

Now that this PR is merged: would it be useful if I open more small cleanup PRs that only remove unused headers, or would you prefer a different approach?

Removing unused headers, and using forward declarations where possible, would be nice. This can help speed up compilation time. I'm not opposed to more PRs that do this. Please wait with sending a PR until CI is green on your fork, then the CI in this repository doesn't have to work as hard :)

github-actions bot pushed a commit to duckdb/duckdb-r that referenced this pull request Dec 1, 2025
Clean up unused headers in `parser/` and subfolders (duckdb/duckdb#18422)
Fix initialization when all values are `NULL` in `SMALLER_BINARY` aggregation  (duckdb/duckdb#19755)
Bump ducklake main (duckdb/duckdb#19756)
github-actions bot added a commit to duckdb/duckdb-r that referenced this pull request Dec 1, 2025
Clean up unused headers in `parser/` and subfolders (duckdb/duckdb#18422)
Fix initialization when all values are `NULL` in `SMALLER_BINARY` aggregation  (duckdb/duckdb#19755)
Bump ducklake main (duckdb/duckdb#19756)

Co-authored-by: krlmlr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants