You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by lz...@apache.org on 2023/01/04 01:44:56 UTC

[flink-table-store] branch release-0.3 updated (85ae4896 -> eeb09ca1)

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a change to branch release-0.3
in repository https://gitbox.apache.org/repos/asf/flink-table-store.git


    from 85ae4896 [hotfix] Remove incorrect check in FullChangelogStoreSinkWrite
     new 61484f9e [FLINK-30545] Add check of 'NOT NULL' for 'ADD COLUMN' schema change
     new 32de0c4d [FLINK-30545] Merge isNullable into logicalType in SchemaChange.addColumn
     new eeb09ca1 [FLINK-30522] Fix 'SHOW TBLPROPERTIES' can't read properties of table in Spark3

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/flink/table/store/CoreOptions.java  |  4 ++
 .../table/store/file/schema/SchemaChange.java      | 21 +++-----
 .../table/store/file/schema/SchemaManager.java     |  3 ++
 .../table/store/file/schema/SchemaManagerTest.java | 20 ++++---
 .../table/store/table/SchemaEvolutionTest.java     | 10 ++++
 .../flink/table/store/spark/SparkCatalog.java      |  3 +-
 .../apache/flink/table/store/spark/SparkTable.java | 12 +++++
 .../flink/table/store/spark/SparkReadITCase.java   | 18 +++++++
 .../store/spark/SparkSchemaEvolutionITCase.java    | 63 +++++++++++++++++++++-
 9 files changed, 128 insertions(+), 26 deletions(-)


[flink-table-store] 01/03: [FLINK-30545] Add check of 'NOT NULL' for 'ADD COLUMN' schema change

Posted by lz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-0.3
in repository https://gitbox.apache.org/repos/asf/flink-table-store.git

commit 61484f9ec335c97ab92ba624926897bbdc58a8d7
Author: yuzelin <33...@users.noreply.github.com>
AuthorDate: Tue Jan 3 16:19:08 2023 +0800

    [FLINK-30545] Add check of 'NOT NULL' for 'ADD COLUMN' schema change
    
    This closes #449
---
 .../table/store/file/schema/SchemaManager.java     |  2 ++
 .../table/store/table/SchemaEvolutionTest.java     | 10 +++++++++
 .../store/spark/SparkSchemaEvolutionITCase.java    | 25 ++++++++++++++++++++++
 3 files changed, 37 insertions(+)

diff --git a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
index 4e6708fa..5c48dfcf 100644
--- a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
+++ b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
@@ -211,6 +211,8 @@ public class SchemaManager implements Serializable {
                                         "The column [%s] exists in the table[%s].",
                                         addColumn.fieldName(), tableRoot));
                     }
+                    Preconditions.checkArgument(
+                            addColumn.isNullable(), "ADD COLUMN cannot specify NOT NULL.");
                     int id = highestFieldId.incrementAndGet();
                     DataType dataType =
                             TableSchema.toDataType(addColumn.logicalType(), highestFieldId);
diff --git a/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java b/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
index 373c1a88..73666f63 100644
--- a/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
+++ b/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
@@ -126,6 +126,16 @@ public class SchemaEvolutionTest {
         // read where f3 = 3 (filter on new field)
         rows = readRecords(table, builder.equal(2, 3L));
         assertThat(rows).containsExactlyInAnyOrder(Row.of(3, 3L, 3L), Row.of(4, 4L, 4L));
+
+        // test add not null field
+        assertThatThrownBy(
+                        () ->
+                                schemaManager.commitChanges(
+                                        Collections.singletonList(
+                                                SchemaChange.addColumn(
+                                                        "f4", new IntType(), false, null))))
+                .isInstanceOf(IllegalArgumentException.class)
+                .hasMessage("ADD COLUMN cannot specify NOT NULL.");
     }
 
     @Test
diff --git a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
index c23facfe..fb88cc88 100644
--- a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
+++ b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
@@ -79,6 +79,31 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
         assertThat(results.toString()).isEqualTo("[[8]]");
     }
 
+    @Test
+    public void testAddNotNullColumn() throws Exception {
+        Path tablePath = new Path(warehousePath, "default.db/testAddNotNullColumn");
+        createTestHelper(tablePath);
+
+        List<Row> beforeAdd =
+                spark.sql("SHOW CREATE TABLE tablestore.default.testAddNotNullColumn")
+                        .collectAsList();
+        assertThat(beforeAdd.toString())
+                .isEqualTo(
+                        "[[CREATE TABLE testAddNotNullColumn (\n"
+                                + "  `a` INT NOT NULL,\n"
+                                + "  `b` BIGINT,\n"
+                                + "  `c` STRING)\n"
+                                + "]]");
+
+        assertThatThrownBy(
+                        () ->
+                                spark.sql(
+                                        "ALTER TABLE tablestore.default.testAddNotNullColumn ADD COLUMNS (d INT NOT NULL)"))
+                .isInstanceOf(RuntimeException.class)
+                .hasMessage(
+                        "java.lang.IllegalArgumentException: ADD COLUMN cannot specify NOT NULL.");
+    }
+
     @Test
     public void testRenameColumn() throws Exception {
         Path tablePath = new Path(warehousePath, "default.db/testRenameColumn");


[flink-table-store] 02/03: [FLINK-30545] Merge isNullable into logicalType in SchemaChange.addColumn

Posted by lz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-0.3
in repository https://gitbox.apache.org/repos/asf/flink-table-store.git

commit 32de0c4d2b3db5ff916000dd0ba55e0570710b5a
Author: JingsongLi <lz...@aliyun.com>
AuthorDate: Tue Jan 3 16:23:24 2023 +0800

    [FLINK-30545] Merge isNullable into logicalType in SchemaChange.addColumn
---
 .../flink/table/store/file/schema/SchemaChange.java | 21 ++++++---------------
 .../table/store/file/schema/SchemaManager.java      |  3 ++-
 .../table/store/table/SchemaEvolutionTest.java      |  2 +-
 .../flink/table/store/spark/SparkCatalog.java       |  3 +--
 4 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaChange.java b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaChange.java
index ebbb87fd..a5256c5b 100644
--- a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaChange.java
+++ b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaChange.java
@@ -37,12 +37,11 @@ public interface SchemaChange {
     }
 
     static SchemaChange addColumn(String fieldName, LogicalType logicalType) {
-        return addColumn(fieldName, logicalType, true, null);
+        return addColumn(fieldName, logicalType, null);
     }
 
-    static SchemaChange addColumn(
-            String fieldName, LogicalType logicalType, boolean isNullable, String comment) {
-        return new AddColumn(fieldName, logicalType, isNullable, comment);
+    static SchemaChange addColumn(String fieldName, LogicalType logicalType, String comment) {
+        return new AddColumn(fieldName, logicalType, comment);
     }
 
     static SchemaChange renameColumn(String fieldName, String newName) {
@@ -135,14 +134,11 @@ public interface SchemaChange {
     final class AddColumn implements SchemaChange {
         private final String fieldName;
         private final LogicalType logicalType;
-        private final boolean isNullable;
         private final String description;
 
-        private AddColumn(
-                String fieldName, LogicalType logicalType, boolean isNullable, String description) {
+        private AddColumn(String fieldName, LogicalType logicalType, String description) {
             this.fieldName = fieldName;
             this.logicalType = logicalType;
-            this.isNullable = isNullable;
             this.description = description;
         }
 
@@ -154,10 +150,6 @@ public interface SchemaChange {
             return logicalType;
         }
 
-        public boolean isNullable() {
-            return isNullable;
-        }
-
         @Nullable
         public String description() {
             return description;
@@ -172,15 +164,14 @@ public interface SchemaChange {
                 return false;
             }
             AddColumn addColumn = (AddColumn) o;
-            return isNullable == addColumn.isNullable
-                    && Objects.equals(fieldName, addColumn.fieldName)
+            return Objects.equals(fieldName, addColumn.fieldName)
                     && logicalType.equals(addColumn.logicalType)
                     && Objects.equals(description, addColumn.description);
         }
 
         @Override
         public int hashCode() {
-            int result = Objects.hash(logicalType, isNullable, description);
+            int result = Objects.hash(logicalType, description);
             result = 31 * result + Objects.hashCode(fieldName);
             return result;
         }
diff --git a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
index 5c48dfcf..9946e703 100644
--- a/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
+++ b/flink-table-store-core/src/main/java/org/apache/flink/table/store/file/schema/SchemaManager.java
@@ -212,7 +212,8 @@ public class SchemaManager implements Serializable {
                                         addColumn.fieldName(), tableRoot));
                     }
                     Preconditions.checkArgument(
-                            addColumn.isNullable(), "ADD COLUMN cannot specify NOT NULL.");
+                            addColumn.logicalType().isNullable(),
+                            "ADD COLUMN cannot specify NOT NULL.");
                     int id = highestFieldId.incrementAndGet();
                     DataType dataType =
                             TableSchema.toDataType(addColumn.logicalType(), highestFieldId);
diff --git a/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java b/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
index 73666f63..bb174df9 100644
--- a/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
+++ b/flink-table-store-core/src/test/java/org/apache/flink/table/store/table/SchemaEvolutionTest.java
@@ -133,7 +133,7 @@ public class SchemaEvolutionTest {
                                 schemaManager.commitChanges(
                                         Collections.singletonList(
                                                 SchemaChange.addColumn(
-                                                        "f4", new IntType(), false, null))))
+                                                        "f4", new IntType().copy(false), null))))
                 .isInstanceOf(IllegalArgumentException.class)
                 .hasMessage("ADD COLUMN cannot specify NOT NULL.");
     }
diff --git a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkCatalog.java b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkCatalog.java
index c6b59b42..8c925f4f 100644
--- a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkCatalog.java
+++ b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkCatalog.java
@@ -268,8 +268,7 @@ public class SparkCatalog implements TableCatalog, SupportsNamespaces {
             validateAlterNestedField(add.fieldNames());
             return SchemaChange.addColumn(
                     add.fieldNames()[0],
-                    toFlinkType(add.dataType()),
-                    add.isNullable(),
+                    toFlinkType(add.dataType()).copy(add.isNullable()),
                     add.comment());
         } else if (change instanceof RenameColumn) {
             RenameColumn rename = (RenameColumn) change;


[flink-table-store] 03/03: [FLINK-30522] Fix 'SHOW TBLPROPERTIES' can't read properties of table in Spark3

Posted by lz...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch release-0.3
in repository https://gitbox.apache.org/repos/asf/flink-table-store.git

commit eeb09ca128553d77e9f8886b335e6048cd498179
Author: yuzelin <33...@users.noreply.github.com>
AuthorDate: Wed Jan 4 09:42:59 2023 +0800

    [FLINK-30522] Fix 'SHOW TBLPROPERTIES' can't read properties of table in Spark3
    
    This closes #451
---
 .../org/apache/flink/table/store/CoreOptions.java  |  4 +++
 .../table/store/file/schema/SchemaManagerTest.java | 20 +++++++-----
 .../apache/flink/table/store/spark/SparkTable.java | 12 +++++++
 .../flink/table/store/spark/SparkReadITCase.java   | 18 ++++++++++
 .../store/spark/SparkSchemaEvolutionITCase.java    | 38 +++++++++++++++++++++-
 5 files changed, 83 insertions(+), 9 deletions(-)

diff --git a/flink-table-store-core/src/main/java/org/apache/flink/table/store/CoreOptions.java b/flink-table-store-core/src/main/java/org/apache/flink/table/store/CoreOptions.java
index 22974af1..ba61e105 100644
--- a/flink-table-store-core/src/main/java/org/apache/flink/table/store/CoreOptions.java
+++ b/flink-table-store-core/src/main/java/org/apache/flink/table/store/CoreOptions.java
@@ -405,6 +405,10 @@ public class CoreOptions implements Serializable {
         this.options = options;
     }
 
+    public Map<String, String> toMap() {
+        return options.toMap();
+    }
+
     public int bucket() {
         return options.get(BUCKET);
     }
diff --git a/flink-table-store-core/src/test/java/org/apache/flink/table/store/file/schema/SchemaManagerTest.java b/flink-table-store-core/src/test/java/org/apache/flink/table/store/file/schema/SchemaManagerTest.java
index 5d6a4f94..fb4086a1 100644
--- a/flink-table-store-core/src/test/java/org/apache/flink/table/store/file/schema/SchemaManagerTest.java
+++ b/flink-table-store-core/src/test/java/org/apache/flink/table/store/file/schema/SchemaManagerTest.java
@@ -110,14 +110,18 @@ public class SchemaManagerTest {
 
         assertThatThrownBy(
                         () ->
-                                manager.commitNewVersion(
-                                        new UpdateSchema(
-                                                rowType,
-                                                partitionKeys,
-                                                primaryKeys,
-                                                Collections.singletonMap(
-                                                        CoreOptions.SEQUENCE_FIELD.key(), "f4"),
-                                                "")))
+                                retryArtificialException(
+                                        () ->
+                                                manager.commitNewVersion(
+                                                        new UpdateSchema(
+                                                                rowType,
+                                                                partitionKeys,
+                                                                primaryKeys,
+                                                                Collections.singletonMap(
+                                                                        CoreOptions.SEQUENCE_FIELD
+                                                                                .key(),
+                                                                        "f4"),
+                                                                ""))))
                 .isInstanceOf(IllegalArgumentException.class)
                 .hasMessageContaining("Nonexistent sequence field: 'f4'");
     }
diff --git a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkTable.java b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkTable.java
index 0984dba1..5e2aeb44 100644
--- a/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkTable.java
+++ b/flink-table-store-spark/src/main/java/org/apache/flink/table/store/spark/SparkTable.java
@@ -21,6 +21,7 @@ package org.apache.flink.table.store.spark;
 import org.apache.flink.configuration.Configuration;
 import org.apache.flink.table.store.file.operation.Lock;
 import org.apache.flink.table.store.file.predicate.Predicate;
+import org.apache.flink.table.store.table.DataTable;
 import org.apache.flink.table.store.table.SupportsPartition;
 import org.apache.flink.table.store.table.Table;
 
@@ -39,8 +40,10 @@ import org.apache.spark.sql.types.StructType;
 import org.apache.spark.sql.util.CaseInsensitiveStringMap;
 
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
 
@@ -118,6 +121,15 @@ public class SparkTable
         castToWritable(table).deleteWhere(commitUser, predicates, lockFactory);
     }
 
+    @Override
+    public Map<String, String> properties() {
+        if (table instanceof DataTable) {
+            return ((DataTable) table).options().toMap();
+        } else {
+            return Collections.emptyMap();
+        }
+    }
+
     private static org.apache.flink.table.store.table.SupportsWrite castToWritable(Table table) {
         if (!(table instanceof org.apache.flink.table.store.table.SupportsWrite)) {
             throw new UnsupportedOperationException(
diff --git a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkReadITCase.java b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkReadITCase.java
index 1c6f8caf..2d2cba1f 100644
--- a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkReadITCase.java
+++ b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkReadITCase.java
@@ -147,6 +147,24 @@ public class SparkReadITCase extends SparkReadTestBase {
                 .isEqualTo("[[a,bigint,], [b,string,], [,,], [# Partitioning,,], [Part 0,a,]]");
     }
 
+    @Test
+    public void testShowTableProperties() {
+        spark.sql("USE tablestore");
+        spark.sql(
+                "CREATE TABLE default.tbl (\n"
+                        + "a INT\n"
+                        + ") TBLPROPERTIES (\n"
+                        + "'k1' = 'v1',\n"
+                        + "'k2' = 'v2'"
+                        + ")");
+
+        assertThat(
+                        spark.sql("SHOW TBLPROPERTIES default.tbl").collectAsList().stream()
+                                .map(Row::toString)
+                                .collect(Collectors.toList()))
+                .contains("[k1,v1]", "[k2,v2]");
+    }
+
     @Test
     public void testCreateTableWithInvalidPk() {
         spark.sql("USE tablestore");
diff --git a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
index fb88cc88..22a096dd 100644
--- a/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
+++ b/flink-table-store-spark/src/test/java/org/apache/flink/table/store/spark/SparkSchemaEvolutionITCase.java
@@ -93,6 +93,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 + "  `a` INT NOT NULL,\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testAddNotNullColumn")
                                 + "]]");
 
         assertThatThrownBy(
@@ -120,6 +121,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 + "  `a` INT NOT NULL,\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testRenameColumn")
                                 + "]]");
         Dataset<Row> table1 = spark.table("tablestore.default.testRenameColumn");
         List<Row> results = table1.select("a", "c").collectAsList();
@@ -135,6 +137,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 + "  `aa` INT NOT NULL,\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testRenameColumn")
                                 + "]]");
         Dataset<Row> table2 = spark.table("tablestore.default.testRenameColumn");
         results = table2.select("aa", "c").collectAsList();
@@ -163,7 +166,14 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                         "[[CREATE TABLE testRenamePartitionKey (\n"
                                 + "  `a` BIGINT,\n"
                                 + "  `b` STRING)\n"
+                                + "USING tablestore\n"
                                 + "PARTITIONED BY (a)\n"
+                                + "COMMENT 'table comment'\n"
+                                + "TBLPROPERTIES(\n"
+                                + "  'foo' = 'bar',\n"
+                                + String.format(
+                                        "  'path' = '%s/%s')\n",
+                                        warehousePath, "default.db/testRenamePartitionKey")
                                 + "]]");
 
         assertThatThrownBy(
@@ -194,6 +204,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 + "  `a` INT NOT NULL,\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testDropSingleColumn")
                                 + "]]");
 
         spark.sql("ALTER TABLE tablestore.default.testDropSingleColumn DROP COLUMN a");
@@ -206,6 +217,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                         "[[CREATE TABLE testDropSingleColumn (\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testDropSingleColumn")
                                 + "]]");
 
         Dataset<Row> table = spark.table("tablestore.default.testDropSingleColumn");
@@ -226,6 +238,7 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 + "  `a` INT NOT NULL,\n"
                                 + "  `b` BIGINT,\n"
                                 + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testDropColumns")
                                 + "]]");
 
         spark.sql("ALTER TABLE tablestore.default.testDropColumns DROP COLUMNS a, b");
@@ -233,7 +246,11 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
         List<Row> afterRename =
                 spark.sql("SHOW CREATE TABLE tablestore.default.testDropColumns").collectAsList();
         assertThat(afterRename.toString())
-                .isEqualTo("[[CREATE TABLE testDropColumns (\n" + "  `c` STRING)\n" + "]]");
+                .isEqualTo(
+                        "[[CREATE TABLE testDropColumns (\n"
+                                + "  `c` STRING)\n"
+                                + buildTableProperties("default.db/testDropColumns")
+                                + "]]");
     }
 
     @Test
@@ -255,7 +272,14 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                         "[[CREATE TABLE testDropPartitionKey (\n"
                                 + "  `a` BIGINT,\n"
                                 + "  `b` STRING)\n"
+                                + "USING tablestore\n"
                                 + "PARTITIONED BY (a)\n"
+                                + "COMMENT 'table comment'\n"
+                                + "TBLPROPERTIES(\n"
+                                + "  'foo' = 'bar',\n"
+                                + String.format(
+                                        "  'path' = '%s/%s')\n",
+                                        warehousePath, "default.db/testDropPartitionKey")
                                 + "]]");
 
         assertThatThrownBy(
@@ -288,7 +312,13 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                         "[[CREATE TABLE testDropPrimaryKey (\n"
                                 + "  `a` BIGINT NOT NULL,\n"
                                 + "  `b` STRING NOT NULL)\n"
+                                + "USING tablestore\n"
                                 + "PARTITIONED BY (a)\n"
+                                + "COMMENT 'table comment'\n"
+                                + "TBLPROPERTIES(\n"
+                                + String.format(
+                                        "  'path' = '%s/%s')\n",
+                                        warehousePath, "default.db/testDropPrimaryKey")
                                 + "]]");
 
         assertThatThrownBy(
@@ -533,4 +563,10 @@ public class SparkSchemaEvolutionITCase extends SparkReadTestBase {
                                 .toString())
                 .isEqualTo("[[15,18,17,16], [19,22,21,20]]");
     }
+
+    private String buildTableProperties(String tablePath) {
+        return String.format(
+                "TBLPROPERTIES(\n" + "  'file.format' = 'avro',\n" + "  'path' = '%s/%s')\n",
+                warehousePath, tablePath);
+    }
 }