xuyangzhong commented on code in PR #1726:
URL: https://github.com/apache/fluss/pull/1726#discussion_r2367764811
##########
fluss-flink/fluss-flink-2.1/src/test/java/org/apache/fluss/flink/catalog/Flink21CatalogITCase.java:
##########
@@ -17,5 +17,267 @@
package org.apache.fluss.flink.catalog;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.Schema;
+import org.apache.flink.table.catalog.CatalogTable;
+import org.apache.flink.table.catalog.ObjectPath;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.fluss.flink.FlinkConnectorOptions.BUCKET_KEY;
+import static org.apache.fluss.flink.FlinkConnectorOptions.BUCKET_NUMBER;
+import static org.assertj.core.api.Assertions.assertThat;
+
/** IT case for catalog in Flink 2.1. */
-public class Flink21CatalogITCase extends FlinkCatalogITCase {}
+public class Flink21CatalogITCase extends FlinkCatalogITCase {
+
+ @BeforeAll
+ static void beforeAll() {
+ FlinkCatalogITCase.beforeAll();
+
+ // close the old one and open a new one later
+ catalog.close();
+
+ catalog =
+ new Flink21Catalog(
+ catalog.catalogName,
+ catalog.defaultDatabase,
+ catalog.bootstrapServers,
+ catalog.classLoader,
+ catalog.securityConfigs);
+ catalog.open();
+ }
+
+ @Test
+ @Override
+ void testCreateTable() throws Exception {
+ // create a table will all supported data types
+ tEnv.executeSql(
Review Comment:
Because the expected schema has been changed in Flink 2.1. I just overrided
this test and update the new changes.
##########
fluss-flink/fluss-flink-2.1/src/test/java/org/apache/fluss/flink/catalog/Flink21CatalogITCase.java:
##########
@@ -17,5 +17,267 @@
package org.apache.fluss.flink.catalog;
+import org.apache.flink.table.api.DataTypes;
+import org.apache.flink.table.api.Schema;
+import org.apache.flink.table.catalog.CatalogTable;
+import org.apache.flink.table.catalog.ObjectPath;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.apache.fluss.flink.FlinkConnectorOptions.BUCKET_KEY;
+import static org.apache.fluss.flink.FlinkConnectorOptions.BUCKET_NUMBER;
+import static org.assertj.core.api.Assertions.assertThat;
+
/** IT case for catalog in Flink 2.1. */
-public class Flink21CatalogITCase extends FlinkCatalogITCase {}
+public class Flink21CatalogITCase extends FlinkCatalogITCase {
+
+ @BeforeAll
+ static void beforeAll() {
+ FlinkCatalogITCase.beforeAll();
+
+ // close the old one and open a new one later
+ catalog.close();
+
+ catalog =
+ new Flink21Catalog(
+ catalog.catalogName,
+ catalog.defaultDatabase,
+ catalog.bootstrapServers,
+ catalog.classLoader,
+ catalog.securityConfigs);
+ catalog.open();
+ }
+
+ @Test
+ @Override
+ void testCreateTable() throws Exception {
+ // create a table will all supported data types
+ tEnv.executeSql(
+ "create table test_table "
+ + "(a int not null primary key not enforced,"
+ + " b CHAR(3),"
+ + " c STRING not null COMMENT 'STRING COMMENT',"
+ + " d STRING,"
+ + " e BOOLEAN,"
+ + " f BINARY(2),"
+ + " g BYTES COMMENT 'BYTES',"
+ + " h BYTES,"
+ + " i DECIMAL(12, 2),"
+ + " j TINYINT,"
+ + " k SMALLINT,"
+ + " l BIGINT,"
+ + " m FLOAT,"
+ + " n DOUBLE,"
+ + " o DATE,"
+ + " p TIME,"
+ + " q TIMESTAMP,"
+ + " r TIMESTAMP_LTZ,"
+ + " s ROW<a INT>) COMMENT 'a test table'");
+ Schema.Builder schemaBuilder = Schema.newBuilder();
+ schemaBuilder
+ .column("a", DataTypes.INT().notNull())
+ .column("b", DataTypes.CHAR(3))
+ .column("c", DataTypes.STRING().notNull())
+ .withComment("STRING COMMENT")
+ .column("d", DataTypes.STRING())
+ .column("e", DataTypes.BOOLEAN())
+ .column("f", DataTypes.BINARY(2))
+ .column("g", DataTypes.BYTES())
+ .withComment("BYTES")
+ .column("h", DataTypes.BYTES())
+ .column("i", DataTypes.DECIMAL(12, 2))
+ .column("j", DataTypes.TINYINT())
+ .column("k", DataTypes.SMALLINT())
+ .column("l", DataTypes.BIGINT())
+ .column("m", DataTypes.FLOAT())
+ .column("n", DataTypes.DOUBLE())
+ .column("o", DataTypes.DATE())
+ .column("p", DataTypes.TIME())
+ .column("q", DataTypes.TIMESTAMP())
+ .column("r", DataTypes.TIMESTAMP_LTZ())
+ .column("s", DataTypes.ROW(DataTypes.FIELD("a",
DataTypes.INT())))
+ .primaryKey("a")
+ .index("a");
+ Schema expectedSchema = schemaBuilder.build();
+ CatalogTable table =
+ (CatalogTable) catalog.getTable(new ObjectPath(DEFAULT_DB,
"test_table"));
+ assertThat(table.getUnresolvedSchema()).isEqualTo(expectedSchema);
+ }
+
+ @Test
+ @Override
+ void testTableWithExpression() throws Exception {
+ // create a table with watermark and computed column
+ tEnv.executeSql(
Review Comment:
ditto
--
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]