parthchandra commented on code in PR #1883: URL: https://github.com/apache/datafusion-comet/pull/1883#discussion_r2146079262
########## spark/src/test/scala/org/apache/comet/parquet/ParquetReadSuite.scala: ########## @@ -1745,6 +1746,77 @@ abstract class ParquetReadSuite extends CometTestBase { } } } + + private def withId(id: Int) = + new MetadataBuilder().putLong(ParquetUtils.FIELD_ID_METADATA_KEY, id).build() + + // Based on Spark ParquetIOSuite.test("vectorized reader: array of nested struct") + test("array of nested struct with and without field id") { + val nestedSchema = StructType( + Seq(StructField( + "_1", + StructType(Seq( + StructField("_1", StringType, nullable = true, withId(1)), // Field ID 1 + StructField( + "_2", + ArrayType(StructType(Seq( + StructField("_1", StringType, nullable = true, withId(2)), // Field ID 2 + StructField("_2", StringType, nullable = true, withId(3)) // Field ID 3 + ))), + nullable = true))), + nullable = true))) + val nestedSchemaNoId = StructType( + Seq(StructField( + "_1", + StructType(Seq( + StructField("_1", StringType, nullable = true), + StructField( + "_2", + ArrayType(StructType(Seq( + StructField("_1", StringType, nullable = true), + StructField("_2", StringType, nullable = true)))), + nullable = true))), + nullable = true))) + // data matching the schema + val data = Seq( + Row(Row("a", null)), + Row(Row("b", Seq(Row("c", "d")))), + Row(null), + Row(Row("e", Seq(Row("f", null), Row(null, "g")))), + Row(Row(null, null)), + Row(Row(null, Seq(null))), + Row(Row(null, Seq(Row(null, null), Row("h", null), null))), + Row(Row("i", Seq())), + Row(null)) + val answer = + Row(Row("a", null)) :: + Row(Row("b", Seq(Row("c", "d")))) :: + Row(null) :: + Row(Row("e", Seq(Row("f", null), Row(null, "g")))) :: + Row(Row(null, null)) :: + Row(Row(null, Seq(null))) :: + Row(Row(null, Seq(Row(null, null), Row("h", null), null))) :: + Row(Row("i", Seq())) :: + Row(null) :: + Nil + + withSQLConf("spark.sql.parquet.fieldId.read.enabled" -> "true") { Review Comment: Of course. Done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org