-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Spark: Fix RewriteManifestsSparkAction sortBy() for dotted partition field names #17428
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -314,10 +314,13 @@ private Column sortColumn() { | |
| partitionFieldClustering); | ||
|
|
||
| // Map the top level partition column names to the column name referenced within the manifest | ||
| // entry dataframe | ||
| // entry dataframe. Backtick-quote the partition field name because it may itself contain a | ||
| // literal '.' (e.g. when partitioning on a nested source column) - the partition struct is | ||
| // always flat, so unquoted, col() would misparse that dot as a further level of nesting | ||
| // instead of treating the whole name as one field. | ||
| Column[] partitionColumns = | ||
| partitionFieldClustering.stream() | ||
| .map(p -> col(DATA_FILE_PARTITION_COLUMN_NAME + "." + p)) | ||
| .map(p -> col(DATA_FILE_PARTITION_COLUMN_NAME + ".`" + p + "`")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The backtick quoting is written as without escaping an embedded backtick in p. A partition field name containing a backtick, e.g. produces a malformed col() expression and an AnalysisException at runtime. The correct idiom would be e.g. used by SparkSchemaUtil.indexQuotedNameById.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated, PTAL @uros-b thanks! |
||
| .toArray(Column[]::new); | ||
|
|
||
| // Form a new temporary column to cluster manifests on, based on the custom clustering columns | ||
|
|
||
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.
How about spark/v4.0 and spark/v3.5? Shall we fix there too?
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.
done.