rdblue commented on code in PR #5860:
URL: https://github.com/apache/iceberg/pull/5860#discussion_r997275022


##########
spark/v3.3/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestRewriteManifestsProcedure.java:
##########
@@ -75,6 +96,79 @@ public void testRewriteLargeManifests() {
         "Must have 4 manifests", 4, 
table.currentSnapshot().allManifests(table.io()).size());
   }
 
+  @Test
+  public void testRewriteLargeManifestsWithDateOrTimestampPartitionedTables() {
+    String[] scenarios = new String[] {"true", "false"};
+    String[] partitionColTypes = new String[] {"DATE", "TIMESTAMP"};
+    for (String scenario : scenarios) {
+      for (String partitionColType : partitionColTypes) {
+        withSQLConf(
+            ImmutableMap.of("spark.sql.datetime.java8API.enabled", scenario),
+            () -> {
+              String createIceberg =
+                  "CREATE TABLE %s (id INTEGER, name STRING, dept STRING, ts 
%s) USING iceberg PARTITIONED BY (ts)";
+              sql(createIceberg, tableName, partitionColType);
+              try {
+                spark
+                    .createDataFrame(
+                        ImmutableList.of(
+                            RowFactory.create(
+                                1,
+                                "John Doe",
+                                "hr",
+                                partitionColumn(partitionColType, 
"2021-01-01")),
+                            RowFactory.create(
+                                2,
+                                "Jane Doe",
+                                "hr",
+                                partitionColumn(partitionColType, 
"2021-01-02")),
+                            RowFactory.create(
+                                3,
+                                "Matt Doe",
+                                "hr",
+                                partitionColumn(partitionColType, 
"2021-01-03")),
+                            RowFactory.create(
+                                4,
+                                "Will Doe",
+                                "facilities",
+                                partitionColumn(partitionColType, 
"2021-01-04"))),
+                        new StructType(
+                            ("DATE".equals(partitionColType) ? dateStruct : 
timeStampStruct)))

Review Comment:
   Can this load the table type from the table rather than creating a static 
one? Something like this:
   
   ```java
   sparkSchema = spark.table(tableName).schema()
   ```



-- 
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: [email protected]

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