-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-24576][BUILD] Upgrade Apache ORC to 1.5.2 #21582
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
Changes from all 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 |
|---|---|---|
|
|
@@ -59,6 +59,19 @@ private[sql] object OrcFileFormat { | |
| def checkFieldNames(names: Seq[String]): Unit = { | ||
| names.foreach(checkFieldName) | ||
| } | ||
|
|
||
| def getQuotedSchemaString(dataType: DataType): String = dataType match { | ||
| case _: AtomicType => dataType.catalogString | ||
| case StructType(fields) => | ||
| fields.map(f => s"`${f.name}`:${getQuotedSchemaString(f.dataType)}") | ||
| .mkString("struct<", ",", ">") | ||
| case ArrayType(elementType, _) => | ||
| s"array<${getQuotedSchemaString(elementType)}>" | ||
| case MapType(keyType, valueType, _) => | ||
| s"map<${getQuotedSchemaString(keyType)},${getQuotedSchemaString(valueType)}>" | ||
| case _ => // UDT and others | ||
|
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. nit: Seems the first |
||
| dataType.catalogString | ||
|
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. We don't need to recursively quote
Member
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. Thank you for review, @maropu . Yes, that is not handled here because the goal is to support user's column names like |
||
| } | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -95,7 +108,7 @@ class OrcFileFormat | |
|
|
||
| val conf = job.getConfiguration | ||
|
|
||
| conf.set(MAPRED_OUTPUT_SCHEMA.getAttribute, dataSchema.catalogString) | ||
| conf.set(MAPRED_OUTPUT_SCHEMA.getAttribute, OrcFileFormat.getQuotedSchemaString(dataSchema)) | ||
|
|
||
| conf.set(COMPRESS.getAttribute, orcOptions.compressionCodec) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -223,6 +223,6 @@ class OrcSerializer(dataSchema: StructType) { | |
| * Return a Orc value object for the given Spark schema. | ||
| */ | ||
| private def createOrcValue(dataType: DataType) = { | ||
| OrcStruct.createValue(TypeDescription.fromString(dataType.catalogString)) | ||
| OrcStruct.createValue(TypeDescription.fromString(OrcFileFormat.getQuotedSchemaString(dataType))) | ||
|
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. Why this change?
Member
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. Thank you for review, @viirya . ORC 1.5 checks the field name syntax more strictly. For example, a field name having
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. @dongjoon-hyun Thanks for explaining it. |
||
| } | ||
| } | ||
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.
I added the above eight lines to be consistent for both
mvnandsbt.