-
Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-58814][SQL] Cover CHAR/VARCHAR round-trips and stop ORC truncating scans #58317
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: master
Are you sure you want to change the base?
Changes from 2 commits
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 |
|---|---|---|
|
|
@@ -437,6 +437,11 @@ object OrcUtils extends Logging { | |
| s"array<${getOrcSchemaString(a.elementType)}>" | ||
| case m: MapType => | ||
| s"map<${getOrcSchemaString(m.keyType)},${getOrcSchemaString(m.valueType)}>" | ||
| // Under standard semantics, keep Spark responsible for CHAR/VARCHAR assignment and scan | ||
| // checks. Native ORC would truncate or pad before Spark can validate the original value. | ||
| // Preserve-only mode retains the native constrained schema and its legacy enforcement. | ||
| case _: CharType | _: VarcharType if SQLConf.get.charVarcharStandardSemantics => | ||
|
Contributor
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. Blocking (P1): This reads the task-side caller configuration, but
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. Addressed in 7a02fee. Analysis now binds the effective standard-semantics mode to the cleaned scan relation instead of letting ORC consult the later caller SQLConf. The binding reaches both V1 HadoopFsRelation schemas and V2 ORC scan construction, while preserve-only scans retain native CHAR/VARCHAR enforcement. Added a permanent-view regression that creates the view with standard semantics, disables that setting in the caller, and verifies EXCEED_LIMIT_LENGTH across V1/V2 and vectorized/row readers. |
||
| StringType.catalogString | ||
| case _: DayTimeIntervalType | _: TimestampNTZType => LongType.catalogString | ||
| case _: YearMonthIntervalType => IntegerType.catalogString | ||
| // Framework types (TimeType, nanosecond timestamps) supply their own ORC schema string. | ||
|
|
||
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.
Non-blocking (P2): This case creates the array and map, but the projection only materializes
c,v, ands.c. Column pruning can skip decoding both collection fields, so a regression in array/map conversion or CHAR-key padding would still pass. Please selectaandmas well and assertSeq("q")andMap("k " -> "v").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.
Addressed in 7a02fee. The Avro round-trip projection now materializes and asserts both collection fields: Seq("q") for the array and Map("k " -> "v") for the CHAR-keyed map. The targeted Avro V1 and V2 tests pass.