Repository navigation
test: cover a native Iceberg read of a data file that omits an optional nested field - #7359
Conversation
sunchao
left a comment
There was a problem hiding this comment.
The new regression passed on Spark 4.1.3 with Iceberg 1.11. I inspected the Parquet footers produced by the same fixture and confirmed that the narrow files omit both nested leaves. One assertion would preserve that coverage as the writer changes.
| SELECT 3, CAST(NULL AS STRUCT<a: INT>), CAST(NULL AS ARRAY<STRUCT<x: INT>>) | ||
| """) | ||
| .writeTo(table) | ||
| .append() |
There was a problem hiding this comment.
Could the test check that at least one appended Parquet file lacks both s.b and the list element’s y leaf? If a writer upgrade materializes them as all-null columns, both Spark comparisons and the native-plan assertion will still pass, and the test will stop exercising #7033. This suite already reads file_path from the Iceberg files table and opens its footer with ParquetFileReader.
There was a problem hiding this comment.
thanks! added a footer check.
sunchao
left a comment
There was a problem hiding this comment.
Reviewed 801755b with five independent scopes. The new assertions first verify the nested leaf paths against a full-schema file and then require a physical file omitting both leaves, so they preserve the intended coverage as the writer changes. I compiled the exact updated suite and ran this regression on Spark 4.1.3 / Iceberg 1.11; it passed with the native scan assertions. The production sources are unchanged from the previously tested revision. No remaining actionable issue found.
|
@yunchipang Please remove these lines from the doc. datafusion-comet/docs/source/user-guide/latest/iceberg.md Lines 832 to 835 in 0f7f8e4 |
|
@yunchipang Meanwhile, could you please enable Github Actions on your fork repository such that CI can run there? |
f0dea03 to
df8300b
Compare
comphead
left a comment
There was a problem hiding this comment.
Thanks @yunchipang, the footer check makes this a solid regression test for #7033.
| val reader = org.apache.parquet.hadoop.ParquetFileReader.open( | ||
| org.apache.parquet.hadoop.util.HadoopInputFile.fromPath( | ||
| new org.apache.hadoop.fs.Path(row.getString(0)), | ||
| spark.sessionState.newHadoopConf())) | ||
| try { | ||
| reader.getFooter.getFileMetaData.getSchema.getColumns.asScala | ||
| .map(_.getPath.mkString(".")) | ||
| .toSet | ||
| } finally { | ||
| reader.close() | ||
| } |
There was a problem hiding this comment.
This is the third copy in this suite of opening a footer with ParquetFileReader.open(HadoopInputFile.fromPath(new Path(...), spark.sessionState.newHadoopConf())) and closing it in a finally, after the page-index test around line 1024 and the INT96 test around line 4653. Each uses the reader differently, so a small private withParquetReader[T](path: String)(f: ParquetFileReader => T): T would cover all three and keep the fully qualified names in one place. Would you add it here?
There was a problem hiding this comment.
thanks for the review! added the share reader at line 169
andygrove
left a comment
There was a problem hiding this comment.
Thanks @yunchipang. The footer assertions are what make this a useful regression test for #7033: they check the leaf paths against the full-schema file first, then require a file that has neither leaf, so a writer change that fills in the missing fields would fail the test instead of quietly passing. The withParquetReader helper also cleans up the other two footer reads nicely.
Which issue does this PR close?
Closes #7033.
Rationale for this change
The native Iceberg scan failed with
Incorrect number of arrays for StructArray fields, expected 2 got 1when a data file omitted an optional nested field without a schema change. The iceberg-rust bump in #7028 fixed this, since iceberg-rust now matches nested fields by field id and fills in missing ones with NULLs. Nothing tested this case.What changes are included in this PR?
A test in
CometIcebergNativeSuitethat writes a data file withouts.bandl.element.y, usingwrite.spark.accept-any-schema. It then checks that the native scan matches Spark, with nested schema pruning on and off.How are these changes tested?
The new test passes on main. On the parent of #7028, it fails with the error from the issue.