-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-36803][SQL] Fix ArrayType conversion when reading Parquet files written in legacy mode #34044
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
[SPARK-36803][SQL] Fix ArrayType conversion when reading Parquet files written in legacy mode #34044
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -602,8 +602,10 @@ private[parquet] class ParquetRowConverter( | |
| // matches the Catalyst array element type. If it doesn't match, then it's case 1; otherwise, | ||
| // it's case 2. | ||
| val guessedElementType = schemaConverter.convertField(repeatedType) | ||
| // We also need to check if the list element follows the backward compatible pattern. | ||
| val isLegacy = schemaConverter.isElementType(repeatedType, parquetSchema.getName()) | ||
|
||
|
|
||
| if (DataType.equalsIgnoreCompatibleNullability(guessedElementType, elementType)) { | ||
| if (DataType.equalsIgnoreCompatibleNullability(guessedElementType, elementType) || isLegacy) { | ||
| // If the repeated field corresponds to the element type, creates a new converter using the | ||
| // type of the repeated field. | ||
| newConverter(repeatedType, elementType, new ParentContainerUpdater { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,7 @@ import org.apache.spark.sql.Row | |||||
| import org.apache.spark.sql.catalyst.util.DateTimeUtils | ||||||
| import org.apache.spark.sql.internal.SQLConf | ||||||
| import org.apache.spark.sql.test.SharedSparkSession | ||||||
| import org.apache.spark.sql.types.{ArrayType, IntegerType, StructField, StructType} | ||||||
|
|
||||||
| class ParquetInteroperabilitySuite extends ParquetCompatibilityTest with SharedSparkSession { | ||||||
| test("parquet files with different physical schemas but share the same logical schema") { | ||||||
|
|
@@ -96,6 +97,58 @@ class ParquetInteroperabilitySuite extends ParquetCompatibilityTest with SharedS | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| test("parquet files with legacy mode and schema evolution") { | ||||||
|
||||||
| test("parquet files with legacy mode and schema evolution") { | |
| test("SPARK-36803: parquet files with legacy mode and schema evolution") { |
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.
shall we also update the long code comment above?
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.
Yes, we can. I will update, thanks.