rdsr commented on a change in pull request #909: Parquet: Support constant map for partition values URL: https://github.com/apache/incubator-iceberg/pull/909#discussion_r407016734
########## File path: spark/src/test/java/org/apache/iceberg/spark/source/TestPartitionValues.java ########## @@ -307,4 +308,72 @@ public void testPartitionValueTypes() throws Exception { TestTables.clearTables(); } } + + @Test + public void testNestedPartitionValues() throws Exception { + Assume.assumeTrue("ORC can't project nested partition values", !format.equalsIgnoreCase("orc")); + + String[] columnNames = new String[] { + "b", "i", "l", "f", "d", "date", "ts", "s", "bytes", "dec_9_0", "dec_11_2", "dec_38_10" + }; + + HadoopTables tables = new HadoopTables(spark.sessionState().newHadoopConf()); + Schema nestedSchema = new Schema(optional(1, "nested", SUPPORTED_PRIMITIVES.asStruct())); + + // create a table around the source data + String sourceLocation = temp.newFolder("source_table").toString(); + Table source = tables.create(nestedSchema, sourceLocation); + + // write out an Avro data file with all of the data types for source data + List<GenericData.Record> expected = RandomData.generateList(source.schema(), 2, 128735L); + File avroData = temp.newFile("data.avro"); + Assert.assertTrue(avroData.delete()); + try (FileAppender<GenericData.Record> appender = Avro.write(Files.localOutput(avroData)) + .schema(source.schema()) + .build()) { + appender.addAll(expected); + } + + // add the Avro data file to the source table Review comment: Why not write the data for the parameterized format for which the test is running? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org