gustavoatt commented on a change in pull request #1184:
URL: https://github.com/apache/iceberg/pull/1184#discussion_r459110702
##########
File path:
spark/src/test/java/org/apache/iceberg/spark/data/TestSparkParquetReader.java
##########
@@ -67,4 +78,49 @@ protected void writeAndValidate(Schema schema) throws
IOException {
Assert.assertFalse("Should not have extra rows", rows.hasNext());
}
}
+
+ protected List<InternalRow> rowsFromFile(InputFile inputFile, Schema schema)
throws IOException {
+ try (CloseableIterable<InternalRow> reader =
+ Parquet.read(inputFile)
+ .project(schema)
+ .createReaderFunc(type -> SparkParquetReaders.buildReader(schema,
type))
+ .build()) {
+ return Lists.newArrayList(reader);
+ }
+ }
+
+ @Test
+ public void testInt96TimestampProducedBySparkIsReadCorrectly() throws
IOException {
+ final SparkSession spark =
+ SparkSession.builder()
+ .master("local[2]")
+ .config("spark.sql.parquet.int96AsTimestamp", "false")
+ .getOrCreate();
Review comment:
Another approach would be to check-in a parquet file written by a spark
and have the test just read it?
A drawback with that approach is that updating this file would be brittle,
but I can check in the code that writes the file in an ignored test, but that
should avoid us from creating a spark session during unit tests. What do you
think @rdblue?
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]