Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script to modify Thrift include guard variables #7

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jwyles-ahana
Copy link

Add script to modify include guard variables in parquet-amalgamation.hpp. The script finds all the include guard variables in the file, then substitutes them with _DUCKDB prefixed to them. This is to avoid interfering with the include guards from Thrift files used by the new parquet reader.

Then modify the include guard variables in parquet-amalgamation.hpp by prefixing them with
DUCKDB using the script velox/external/duckdb/modify_include_guards.sh as follows:

while in the velox/external/duckdb directory

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cd <path/to/velox>/velox/external/duckdb/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,10 @@
echo $1
TAGS=$(sed -n 's/^#ifndef \(_[A-Z][A-Z_]*_\)/\1/p' ${1})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only want to substitute the Thrift headers, so should we match _THRIFT_ too?

@@ -16,6 +16,12 @@ Then copy the generated files to velox/external/duckdb:
rsync -vrh src/amalgamation/duckdb.* <path/to/velox>/velox/external/duckdb/
rsync -vrh src/amalgamation/parquet* <path/to/velox>/velox/external/duckdb/

Then modify the include guard variables in parquet-amalgamation.hpp by prefixing them with
DUCKDB using the script velox/external/duckdb/modify_include_guards.sh as follows:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we explain briefly why we need to do this?

@@ -0,0 +1,10 @@
echo $1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the first line add #!/bin/bash
Then follows the copyright header


while in the velox/external/duckdb directory
./modify_include_guards.sh parquet-amalgamation.hpp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also one _THRIFT_TOSTRING_H_ in parquet-amalgamation.cpp

@yingsu00
Copy link

@jwyles-ahana Thank you for submitting the PR so quickly! Would you make the commit title and PR title shorter? Ideally we want them to be within 50 characters.

Copy link

@yingsu00 yingsu00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git clone https://github.com/cwida/duckdb.git
==>
git clone https://github.com/duckdb/duckdb.git

https://github.com/cwida/duckdb.git is not being actively maintained. We should change it to duckdb's repo.

@yingsu00
Copy link

Moreover, bitwise_cast() in the hpp was not behind any include guard, and will have duplicate definition if we include the standalone Thrift library. Will you be able to see which header file it belongs to, and put it back behind its original include guard?

@yingsu00
Copy link

@jwyles-ahana The commit message needs to follow this guideline: https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53

@jwyles-ahana jwyles-ahana changed the title Add script to modify include guard variables in parquet-amalgamation.hpp Add script to modify Thrift include guard variables May 31, 2022
…ions

DuckDB includes headers from Thrift. The new parquet reader also needs to include the same Thrift headers. To avoid collisions during compilation we need to alias the include guard variables used in the header so that they don't conflict. The script finds all include guard variables that begin with '_THRIFT' and prepends a '_DUCKDB' to them.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants