xuyangzhong commented on code in PR #1726:
URL: https://github.com/apache/fluss/pull/1726#discussion_r2367870081
##########
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");
Review Comment:
Good idea! Done for it.
--
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]