-
Notifications
You must be signed in to change notification settings - Fork 28.5k
[SPARK-51680][SQL] Set the logical type for TIME in the parquet writer #50476
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
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
withNestedDataFrame(data).foreach { case (newDF, colName, _) => | ||
withTempPath { dir => | ||
newDF.write.parquet(dir.getCanonicalPath) | ||
Seq(false, true).foreach { vectorizedReaderEnabled => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for improving this test coverage.
dongjoon-hyun
approved these changes
Apr 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM. Thank you, @MaxGekk .
Merging to master. Thank you, @dongjoon-hyun for review. |
senthh
pushed a commit
to senthh/spark-1
that referenced
this pull request
Apr 2, 2025
### What changes were proposed in this pull request? In the PR, I propose to modify the parquet schema converter for the TIME data type, and convert Catalyst's `TimeType(n)` to parquet physical type `INT64` annotated by the logical type: ``` TimeType(isAdjustedToUTC = false, unit = MICROS) ``` in the parquet writer. ### Why are the changes needed? To fix a failure of non-vectorized reader. The code below portraits the issue: ```scala scala> spark.conf.set("spark.sql.parquet.enableVectorizedReader", false) scala> spark.read.parquet("/Users/maxim.gekk/tmp/time_parquet3").show() org.apache.spark.SparkRuntimeException: [PARQUET_CONVERSION_FAILURE.UNSUPPORTED] Unable to create a Parquet converter for the data type "TIME(6)" whose Parquet type is optional int64 col. Please modify the conversion making sure it is supported. SQLSTATE: 42846 at org.apache.spark.sql.errors.QueryExecutionErrors$.cannotCreateParquetConverterForDataTypeError(QueryExecutionErrors.scala:2000) ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? By running the modified test: ``` $ build/sbt "test:testOnly *ParquetFileFormatV1Suite" $ build/sbt "test:testOnly *ParquetFileFormatV2Suite" ``` ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#50476 from MaxGekk/parquet-time-nested. Authored-by: Max Gekk <[email protected]> Signed-off-by: Max Gekk <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
In the PR, I propose to modify the parquet schema converter for the TIME data type, and convert Catalyst's
TimeType(n)
to parquet physical typeINT64
annotated by the logical type:in the parquet writer.
Why are the changes needed?
To fix a failure of non-vectorized reader. The code below portraits the issue:
Does this PR introduce any user-facing change?
No.
How was this patch tested?
By running the modified test:
Was this patch authored or co-authored using generative AI tooling?
No.