the-other-tim-brown commented on code in PR #1018:
URL: https://github.com/apache/incubator-xtable/pull/1018#discussion_r4636974701


##########
xtable-core/src/test/java/org/apache/xtable/kernel/ITDeltaKernelConversionTarget.java:
##########
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+package org.apache.xtable.kernel;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.nio.file.Path;
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.sql.SparkSession;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+
+import org.apache.hudi.client.HoodieReadClient;
+import org.apache.hudi.common.config.TypedProperties;
+import org.apache.hudi.common.model.HoodieTableType;
+
+import org.apache.xtable.TestJavaHudiTable;
+import org.apache.xtable.conversion.ConversionConfig;
+import org.apache.xtable.conversion.ConversionController;
+import org.apache.xtable.conversion.SourceTable;
+import org.apache.xtable.conversion.TargetTable;
+import org.apache.xtable.delta.DeltaConversionTargetConfig;
+import org.apache.xtable.hudi.HudiConversionSourceProvider;
+import org.apache.xtable.hudi.HudiTestUtil;
+import org.apache.xtable.model.storage.TableFormat;
+import org.apache.xtable.model.sync.SyncMode;
+import org.apache.xtable.model.sync.SyncResult;
+import org.apache.xtable.model.sync.SyncStatusCode;
+
+/**
+ * Writes Delta tables with {@link DeltaKernelConversionTarget} through the 
normal {@link
+ * ConversionController} path, then reads them with Spark Delta and compares 
the result with the
+ * source and with the Delta Standalone target.
+ */
+public class ITDeltaKernelConversionTarget {
+  @TempDir public static Path tempDir;
+
+  private static SparkSession sparkSession;
+  private static JavaSparkContext jsc;
+
+  @BeforeAll
+  public static void setupOnce() {
+    sparkSession =
+        SparkSession.builder()
+            
.config(HoodieReadClient.addHoodieSupport(HudiTestUtil.getSparkConf(tempDir)))
+            .getOrCreate();
+    jsc = JavaSparkContext.fromSparkContext(sparkSession.sparkContext());
+  }
+
+  @AfterAll
+  public static void teardown() {
+    if (jsc != null) {
+      jsc.close();
+    }
+    if (sparkSession != null) {
+      sparkSession.close();
+    }
+  }
+
+  /**
+   * A Hudi timestamp-millis column has its stats in millis. Delta readers 
skip files using the
+   * min/max stats in the Delta log, so stats written in the wrong unit drop 
rows from filtered
+   * reads.
+   */
+  @Test
+  public void 
testFilterOnMillisTimestampColumnMatchesSourceAndStandaloneTarget() {
+    String tableName = "test_table_" + UUID.randomUUID();
+    String filter =
+        String.format(
+            "timestamp_millis_nullable_field >= timestamp_millis(%d)",
+            Instant.now().truncatedTo(ChronoUnit.DAYS).minus(2, 
ChronoUnit.DAYS).toEpochMilli());
+    try (TestJavaHudiTable table =

Review Comment:
   If we're going to be converting between formats, I'd prefer we place it in 
`ITConversionController` so the individual formats can be tested without 
relying on the other formats being on the classpath. This will be important in 
some future work where we would like to break out the modules to allow people 
to import less on their classpaths. 



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

Reply via email to