GH-3708: Inline parquet.thrift - #3709
Conversation
12d885d to
dc2c7b9
Compare
dc2c7b9 to
0c69110
Compare
0c69110 to
d4a42a7
Compare
…r limit Co-authored-by: Isaac <no-reply@databricks.com>
|
@rdblue Thanks for the review! You raised a few big points, I'll recap them all here rather than replying to individual comments:
|
|
Thanks @divjotarora for working on this. I'm wondering if it wouldn't be easier to pull the structures from the snapshots repository: https://repository.apache.org/content/groups/snapshots/org/apache/parquet/parquet-format-structures/. It looks like it is missing some versions, but I think it would make sense to just take the snapshot from there and avoid a shell script. |
@Fokko thanks for taking a look. The suggestion to pull in parquet-format via Maven solves the issue for local development and unblocks building reference implementations against a local copy of FWIW the motivation for this change was that the Rust and C++ Parquet implementations both vendor this file (Rust technically has hand-rolled Thrift structs and a custom parser, so they don't vendor parquet.thrift but they do make custom changes to those structs for reference implementations and it's conceptually the same thing), so there is precedent for this. Based on my investigation, vendoring the file is the most flexible option. |
|
Using snapshot builds is an interesting idea, but I think it's simpler to just vendor the file. I like having the file here so that we can see when it was updated, what version it came from, and whether there have been local changes. With a copy from a snapshot build, I think we'd end up not really knowing exactly what is being used (at least not easily). It would also be harder to test out changes before committing them. I was also surprised by the size of this PR, though. I think that the reason is we are adding requirements that we didn't in the other implementations, like an easy way to check the version or update it automatically. I think it's nice to have those, but the main goal is just to vendor the file and point to the local one. I wouldn't want to split this PR, but if the scope of the util scripts is too much we could to focus on not being tied to a parquet-format release and, separately, the management scripts in a follow up. |
|
@rdblue Pretty much all of the management script code has been removed, there is just one script now to pull in a provided ref of parquet-format. This could be removed in favor of copy/pasting in the file, but its < 150 LoC and quite straightforward. The bulk of the PR size comes from the |
| THRIFT_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet.thrift" | ||
| SIDECAR_FILE="${REPO_ROOT}/parquet-format-structures/src/main/thrift/parquet-format.version" | ||
|
|
||
| PARQUET_FORMAT_REPO="https://github.com/apache/parquet-format" |
There was a problem hiding this comment.
We can do this separately, but I think it would also make sense to run this against a fork.
There was a problem hiding this comment.
Done, the script honors PARQUET_FORMAT_REPO if set and defaults to apache/parquet-format if not. Tested via
> PARQUET_FORMAT_REPO="https://github.com/divjotarora/parquet-format" ./dev/update-parquet-thrift.sh f4288e602a41deba78c58e8bd116b36076a03588
|
I'd rather avoid having two copies of The only thing I'm missing here is adding some docs on how to use the script. |
@Fokko Can you give me a pointer on where to add such docs? There is no README in the |
d4a42a7 to
052098a
Compare
Rationale for this change
It is currently not possible to build working POCs for unreleased parquet-format changes in parquet-java because the parquet-format dependency must be updated using a released version. This blocks reference implementations from merging and will become a bigger issue if the current versioning proposal goes through and we start having more "preview" features where writes are expected to support unreleased spec changes behind feature flags.
What changes are included in this PR?
This PR removes the dependency on github.com/apache/parquet-format and instead adds an inlined copy of
parquet.thrift(parquet-format-structures/src/main/thrift/parquet.thrift) as well as a "sidecar" metadata file (parquet-format-structures/src/main/thrift/parquet-format.version) to indicate the parquet-format commit that's being inlined. There is a newdev/update-parquet-thrift.sh [$REF]script that takes in a parquet-format ref (commit SHA or tag) and updates the inlinedparquet.thriftfile to match that version. The script downloads from github.com/apache/parquet-format by default but can be pointed at a fork by setting thePARQUET_FORMAT_REPOenvironment variable (e.g. for POC implementations of unmerged format changes).Are these changes tested?
Edit inlined parquet.thrift with a meaningless change and then validate it gets overwritten:
Are there any user-facing changes?
No
Closes #3708