JingsongLi commented on code in PR #8081:
URL: https://github.com/apache/paimon/pull/8081#discussion_r3348786040


##########
paimon-spark/paimon-spark-ut/src/test/java/org/apache/paimon/spark/SparkDataEvolutionITCase.java:
##########
@@ -0,0 +1,275 @@
+/*
+ * 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.paimon.spark;
+
+import org.apache.paimon.fs.Path;
+import org.apache.paimon.hive.TestHiveMetastore;
+
+import org.apache.spark.sql.Row;
+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 java.io.IOException;
+import java.util.stream.Collectors;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/** Tests for data evolution on Spark. */
+public class SparkDataEvolutionITCase {
+
+    private static TestHiveMetastore testHiveMetastore;
+    private static final int PORT = 9092;
+
+    @BeforeAll
+    public static void startMetastore() {
+        testHiveMetastore = new TestHiveMetastore();
+        testHiveMetastore.start(PORT);
+    }
+
+    @AfterAll
+    public static void closeMetastore() throws Exception {
+        testHiveMetastore.stop();
+    }
+
+    private SparkSession.Builder createSparkSessionBuilder(Path warehousePath) 
{
+        return SparkSession.builder()
+                .config("spark.sql.warehouse.dir", warehousePath.toString())
+                // with hive metastore
+                .config("spark.sql.catalogImplementation", "hive")
+                .config("hive.metastore.uris", "thrift://localhost:" + PORT)
+                .config("spark.sql.catalog.spark_catalog", 
SparkCatalog.class.getName())
+                .config("spark.sql.catalog.spark_catalog.metastore", "hive")
+                .config(
+                        "spark.sql.catalog.spark_catalog.hive.metastore.uris",
+                        "thrift://localhost:" + PORT)
+                
.config("spark.sql.catalog.spark_catalog.format-table.enabled", "true")
+                .config("spark.sql.catalog.spark_catalog.warehouse", 
warehousePath.toString())
+                .config(
+                        "spark.sql.extensions",
+                        
"org.apache.paimon.spark.extensions.PaimonSparkSessionExtensions")
+                .master("local[2]");
+    }
+
+    @Test
+    public void testDataEvolution(@TempDir java.nio.file.Path tempDir) throws 
IOException {
+        Path warehousePath = new Path("file:" + tempDir.toString());
+        SparkSession.Builder builder =
+                SparkSession.builder()
+                        .config("spark.sql.warehouse.dir", 
warehousePath.toString())
+                        // with hive metastore
+                        .config("spark.sql.catalogImplementation", "hive")
+                        .config("hive.metastore.uris", "thrift://localhost:" + 
PORT)
+                        .config("spark.sql.catalog.spark_catalog", 
SparkCatalog.class.getName())
+                        .config("spark.sql.catalog.spark_catalog.metastore", 
"hive")
+                        .config(
+                                
"spark.sql.catalog.spark_catalog.hive.metastore.uris",
+                                "thrift://localhost:" + PORT)
+                        
.config("spark.sql.catalog.spark_catalog.format-table.enabled", "true")
+                        .config(
+                                "spark.sql.catalog.spark_catalog.warehouse",
+                                warehousePath.toString())
+                        .config(
+                                "spark.sql.extensions",
+                                
"org.apache.paimon.spark.extensions.PaimonSparkSessionExtensions")
+                        .master("local[2]");
+        SparkSession spark = builder.getOrCreate();
+        spark.sql("CREATE DATABASE IF NOT EXISTS my_db1");
+        spark.sql("USE spark_catalog.my_db1");
+
+        /** Create table */
+        spark.sql(
+                "CREATE TABLE IF NOT EXISTS \n"
+                        + "  `my_db1`.`data_evolution_test` (\n"
+                        + "    `id` BIGINT COMMENT 'id',\n"
+                        + "    `g_1_1` BIGINT COMMENT 'g_1_1',\n"
+                        + "    `g_1_2` BIGINT COMMENT 'g_1_2',\n"
+                        + "    `g_2_1` BIGINT COMMENT 'g_2_1',\n"
+                        + "    `g_2_2` BIGINT COMMENT 'g_2_2'\n"
+                        + "  ) PARTITIONED BY (`dt` STRING COMMENT 'dt') ROW 
FORMAT SERDE 'org.apache.paimon.hive.PaimonSerDe'\n"
+                        + "WITH\n"
+                        + "  SERDEPROPERTIES ('serialization.format' = '1') 
STORED AS INPUTFORMAT 'org.apache.paimon.hive.mapred.PaimonInputFormat' 
OUTPUTFORMAT 'org.apache.paimon.hive.mapred.PaimonOutputFormat' TBLPROPERTIES 
(\n"
+                        + "    'file.compression' = 'snappy',\n"
+                        + "    'manifest.compression' = 'snappy',\n"
+                        + "    'row-tracking.enabled' = 'true',\n"
+                        + "    'data-evolution.enabled' = 'true',\n"
+                        + "    'data-evolution.data.source.persist.enabled' = 
'true',\n"

Review Comment:
   This still uses the old option name. The PR adds 
`data-evolution.merge-into.source-persist`, so this table keeps the new option 
at its default `false` and the test never exercises the persist path. Please 
switch this to the new key.



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