WenDing-Y commented on code in PR #49:
URL:
https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210434972
##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/table/ClickhouseTableRow.java:
##########
@@ -0,0 +1,35 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.table;
+
+import org.apache.flink.connector.jdbc.testutils.tables.TableField;
+import org.apache.flink.connector.jdbc.testutils.tables.TableRow;
+
+import java.util.Arrays;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/** ClickhouseTableRow . */
+public class ClickhouseTableRow extends TableRow {
+
+ public ClickhouseTableRow(String name, TableField[] fields) {
+ super(name, fields);
+ }
+
+ @Override
+ public String getCreateQuery() {
+ return String.format(
+ "CREATE TABLE %s (%s) %s PRIMARY KEY (%s)",
+ getTableName(),
+
getStreamFields().map(TableField::asString).collect(Collectors.joining(", ")),
Review Comment:
The syntax for creating a table in the clickhouse like
`CREATE TABLE my_first_table
(
user_id UInt32,
message String,
timestamp DateTime,
metric Float32
)
ENGINE = MergeTree
PRIMARY KEY (user_id, timestamp)`
somewhat different from standard SQL, so I think it is reasonable for
ClickhouseTableRow to extend TableBase and then @Override the getCreateQuery
method. If I put it in TableBase, I also need to choose different methods based
on the dialect to obtain the statement for creating the table
--
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]