gustavoatt commented on a change in pull request #1184:
URL: https://github.com/apache/iceberg/pull/1184#discussion_r454597256



##########
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:
       Yes, I would much rather avoid creating a `SparkSession` here if 
possible. However, looking into 
[`ParquetFileFormat`](https://sourcegraph.com/github.com/apache/spark@d6a68e0b67ff7de58073c176dd097070e88ac831/-/blob/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFileFormat.scala#L74:1)
 it seems like we would still need to pass a `SparkSession` to create the 
writer.
   
   I can look at 
[`ParquetOutputWriter`](https://sourcegraph.com/github.com/apache/spark@d6a68e0b67ff7de58073c176dd097070e88ac831/-/blob/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetOutputWriter.scala#L32)
 but I might need to match the configuration there with what Spark uses to 
write int96.




----------------------------------------------------------------
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]

Reply via email to