You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "WenDing-Y (via GitHub)" <gi...@apache.org> on 2023/05/18 15:56:09 UTC

[GitHub] [flink-connector-jdbc] WenDing-Y opened a new pull request, #49: FLINK-32068 connector jdbc support clickhouse

WenDing-Y opened a new pull request, #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49

   1. the clickhouse in batch mode ,as sink and source
   2. the clickhouse in streaming mode ,as sink


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1588427649

   @MartijnVisser the pr is ready


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] MartijnVisser commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1560845389

   @WenDing-Y Could you please rebase?


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210380038


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   The testcontainer in the parent pom corresponds to ru.yandex.clickhouse.ClickHouseDriver, but this driver has stopped maintenance, so I have declared a new version of the image here, corresponding to the driver com.clickhouse.jdbc.ClickHouseDriver



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1211723597


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSinkITCase.java:
##########
@@ -322,6 +325,9 @@ void testBatchSink() throws Exception {
 
     @Test
     void testReadingFromChangelogSource() throws Exception {
+        if (!getMetadata().supportUpsert()) {

Review Comment:
   I have updated the method name



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1211581006


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSinkITCase.java:
##########
@@ -322,6 +325,9 @@ void testBatchSink() throws Exception {
 
     @Test
     void testReadingFromChangelogSource() throws Exception {
+        if (!getMetadata().supportUpsert()) {

Review Comment:
   Ok, I will modify this issue later



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-32068] connector jdbc support clickhouse [flink-connector-jdbc]

Posted by "Edward-Gavin (via GitHub)" <gi...@apache.org>.
Edward-Gavin commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-2453426422

   @WenDing-Y hello, in our project, we want to import data to clickhouse. Now this PR no longer merges with the main branch? 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221225513


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseRowConvert.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.data.DecimalData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import com.clickhouse.data.value.UnsignedByte;
+import com.clickhouse.data.value.UnsignedInteger;
+import com.clickhouse.data.value.UnsignedShort;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * Runtime converter that responsible to convert between JDBC object and Flink internal object for
+ * ClickHouse.
+ */
+public class ClickHouseRowConvert extends AbstractJdbcRowConverter {
+    @Override
+    public String converterName() {
+        return "ClickHouse";
+    }
+
+    public ClickHouseRowConvert(RowType rowType) {
+        super(rowType);
+    }
+
+    @Override
+    protected JdbcDeserializationConverter createInternalConverter(LogicalType type) {
+        switch (type.getTypeRoot()) {
+            case NULL:
+                return null;
+            case BOOLEAN:
+            case FLOAT:
+            case DOUBLE:
+                return val -> val;
+            case TINYINT:
+                return val -> ((Byte) val).byteValue();
+            case SMALLINT:
+                return val ->
+                        val instanceof UnsignedByte
+                                ? ((UnsignedByte) val).shortValue()
+                                : ((Short) val).shortValue();
+            case INTEGER:
+                return val ->
+                        val instanceof UnsignedShort
+                                ? ((UnsignedShort) val).intValue()
+                                : ((Integer) val).intValue();
+            case BIGINT:
+                return jdbcField -> {
+                    if (jdbcField instanceof UnsignedInteger) {
+                        return ((UnsignedInteger) jdbcField).longValue();
+                    } else if (jdbcField instanceof Long) {
+                        return ((Long) jdbcField).longValue();
+                    }
+                    // UINT64 is not supported,the uint64 range exceeds the long range

Review Comment:
   i still don't see the issue why for `UInt64`, `UInt128`, `UInt256` we can not return `BigInteger` ?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210360121


##########
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(", ")),
+                "ENGINE = MergeTree",
+                getStreamFields().map(TableField::getName).findFirst().get());
+    }
+
+    @Override
+    protected String getDeleteFromQuery() {
+        return String.format("truncate table %s", getTableName());
+    }
+
+    private Stream<TableField> getStreamFields() {

Review Comment:
   This method is private, can I change it to protected



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1212195434


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   we have update master.. if you rebase will be available the last version o testcontainers



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1570299520

   Please help me review, where else can I improve? Thank you very much @eskabetxe 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] boring-cyborg[bot] commented on pull request #49: FLINK-32068 connector jdbc support clickhouse

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1553268136

   Thanks for opening this pull request! Please check out our contributing guidelines. (https://flink.apache.org/contributing/how-to-contribute.html)
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1567061806

   Please help me review, thank you very much @snuyanzin 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1209918327


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   this is not needed as testcontainers-bom is defined on parent..
   
   if needed should be used ${testcontainers.version}



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1212587682


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   ok,I have deleted the generated version



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577102594

   > Sorry i was late here, thanks for your PR @WenDing-Y The thing that I do not understand... why do we need 2 `ClickhouseDialect` classes
   > 
   > ```
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialect.java
   > ```
   > 
   > and 2 `ClickhouseDialectFactory`
   > 
   > ```
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectFactory.java
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialectFactory.java
   > ```
   
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218281097


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */
+public class ClickhouseDialect extends AbstractDialect {
+
+    private static final long serialVersionUID = 1L;
+
+    // Define MAX/MIN precision of TIMESTAMP type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html

Review Comment:
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved



##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */
+public class ClickhouseDialect extends AbstractDialect {
+
+    private static final long serialVersionUID = 1L;
+
+    // Define MAX/MIN precision of TIMESTAMP type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html
+    private static final int MAX_TIMESTAMP_PRECISION = 6;
+    private static final int MIN_TIMESTAMP_PRECISION = 1;
+
+    // Define MAX/MIN precision of DECIMAL type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html

Review Comment:
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-32068] connector jdbc support clickhouse [flink-connector-jdbc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #49: [FLINK-32068] connector jdbc support clickhouse
URL: https://github.com/apache/flink-connector-jdbc/pull/49


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1570248521

   compile_and_test (1.18-SNAPSHOT) fail, It doesn't seem like the problem was caused by my submission


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210527285


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSinkITCase.java:
##########
@@ -322,6 +325,9 @@ void testBatchSink() throws Exception {
 
     @Test
     void testReadingFromChangelogSource() throws Exception {
+        if (!getMetadata().supportUpsert()) {

Review Comment:
   the approach is fine, I only dont know if the name of method is the correct (supportUpsert)..



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1576766451

   Ok, I have rebase @MartijnVisser 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1576807765

   Sorry i was late here, thanks for your PR @WenDing-Y 
   The thing that I do not understand...
   why do we need 2 `ClickhouseDialect` classes
   ```
   flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java
   flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialect.java
   ```
   and 
   2 ClickhouseDialectFactory
   ```
   flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectFactory.java
   flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialectFactory.java
   ```


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577935401

   > > Now this has always been resolved
   > 
   > Unfortunately it hasn't been resolved. In case you want to rebase, what you should do is the following (this is assuming that you've added this repository as a remote called `upstream`.)
   > 
   > 1. Run `git fetch upstream`
   > 2. Run `git rebase upstream/main` and complete this until the rebase has successfully completed
   > 3. Force push your changes to your branch
   
   It seems like this, my local submit history, the new feature started working after [Flink-31551]
   
   <img width="1000" alt="image" src="https://github.com/apache/flink-connector-jdbc/assets/19184146/0e983af8-e2ce-4178-b17a-7bb6032b8eb1">
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1578935469

   > how do you recognize that `rebase` has successfully completed? I tried to do it with your branch (`git rebase upstream/main`) and got a number of conflicts
   
   The problem should be solved, you can try again


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1561651398

   Okay, I have rebased, but I found that there were quite a few modifications in the testing section. I have already submitted some code, but the unit test cannot pass now. I am still modifying this section.  @MartijnVisser 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1630722843

   > > One question that comes to my mind now.. This will only work with a 1 server no? if we have a Clickhouse cluster with more than 1 server (that will have a zookeeper envolved) will not work no?
   > > if this is true, I think we should have a note on documentation
   > 
   > I tried to work normally in cluster mode
   > 
   > My steps are as follows 1.create ck table
   > 
   > ```
   > create table if not exists default.ck_flink_test_local on cluster clicks_cluster
   > (
   >     user_id Int32,
   >     message String
   > )
   > engine = ReplicatedMergeTree('/clickhouse/tables/{shard}/ck_flink_test_local', '{replica}')
   > PRIMARY KEY (user_id)
   > 
   > 
   > 
   > 
   > create table if not exists default.ck_flink_test on cluster clicks_cluster
   > (
   > user_id Int32,
   >     message String
   > )
   > engine = Distributed('clicks_cluster', 'default', 'ck_flink_test_local', user_id);
   > ```
   > 
   > 2. in flink sql client
   > 
   > ```
   > 
   > CREATE TABLE ck_flink_test(
   >    user_id INTEGER,
   >   message String
   > ) WITH (
   >   'connector' = 'jdbc',
   >   'url' = 'jdbc:clickhouse://xx:xx/default',
   >  'table-name' = 'ck_flink_test',
   >  'username’='xx',
   >  'password’='xx'
   > );
   > ```
   > 
   > 3. exec insert sql
   > 
   > ```
   > INSERT INTO ck_flink_test (user_id, message) VALUES
   >     (101, 'Hello');
   > ```
   > 
   > 4. thd data can be viewed on the ck client
   > 
   > ```
   > select * from ck_flink_test;
   > ```
   > 
   > 5.the flink sql client
   > 
   > ![image](https://user-images.githubusercontent.com/19184146/252660687-89eca20f-eabf-4090-9460-c46716653afc.png)
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1578086021

   how do you recognize that `rebase` has successfully completed?
   I tried to doit with your branch  (`git rebase upstream/main`) and got a number of conflicts


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] MartijnVisser commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1576782524

   > Ok, I have rebase @MartijnVisser
   
   I don't think you have, given that there are 4 merge-commits in this PR which shouldn't be there when rebased properly: bb13e1f51d071c5180ccf7d658839a3afac61468 bced473fbb8a606dca287fcf9329c7f052b9c4be 9abdfafac76b17dcce371239ff5e16d9b90b9980 2655b6badefbea699ddb2465803076ec229b884b
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218069220


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseRowConvert.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.data.DecimalData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import com.clickhouse.data.value.UnsignedByte;
+import com.clickhouse.data.value.UnsignedInteger;
+import com.clickhouse.data.value.UnsignedShort;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * Runtime converter that responsible to convert between JDBC object and Flink internal object for
+ * ClickHouse.
+ */
+public class ClickHouseRowConvert extends AbstractJdbcRowConverter {
+    @Override
+    public String converterName() {
+        return "ClickHouse";
+    }
+
+    public ClickHouseRowConvert(RowType rowType) {
+        super(rowType);
+    }
+
+    @Override
+    protected JdbcDeserializationConverter createInternalConverter(LogicalType type) {
+        switch (type.getTypeRoot()) {
+            case NULL:
+                return null;
+            case BOOLEAN:
+            case FLOAT:
+            case DOUBLE:
+                return val -> val;
+            case TINYINT:
+                return val -> ((Byte) val).byteValue();
+            case SMALLINT:
+                return val ->
+                        val instanceof UnsignedByte
+                                ? ((UnsignedByte) val).shortValue()
+                                : ((Short) val).shortValue();
+            case INTEGER:
+                return val ->
+                        val instanceof UnsignedShort
+                                ? ((UnsignedShort) val).intValue()
+                                : ((Integer) val).intValue();
+            case BIGINT:
+                return jdbcField -> {
+                    if (jdbcField instanceof UnsignedInteger) {
+                        return ((UnsignedInteger) jdbcField).longValue();
+                    } else if (jdbcField instanceof Long) {
+                        return ((Long) jdbcField).longValue();
+                    }
+                    // UINT64 is not supported,the uint64 range exceeds the long range

Review Comment:
   can we use `BigInteger` for `UINT64`?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218062955


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */

Review Comment:
   well it's better to have some description about the class rather than an empty comment



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577063078

   > Sorry i was late here, thanks for your PR @WenDing-Y The thing that I do not understand... why do we need 2 `ClickhouseDialect` classes
   > 
   > ```
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialect.java
   > ```
   > 
   > and 2 `ClickhouseDialectFactory`
   > 
   > ```
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectFactory.java
   > flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialectFactory.java
   > ```
   
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-32068] connector jdbc support clickhouse [flink-connector-jdbc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-3591041881

   This PR is being marked as stale since it has not had any activity in the last 90 days. 
   If you would like to keep this PR alive, please leave a comment asking for a review. 
   If the PR has merge conflicts, update it with the latest from the base branch.
   
   If you are having difficulty finding a reviewer, please reach out to the 
   community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
   
   If this PR is no longer valid or desired, please feel free to close it. 
   If no activity occurs in the next 30 days, it will be automatically closed.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1630721467

   > One question that comes to my mind now.. This will only work with a 1 server no? if we have a Clickhouse cluster with more than 1 server (that will have a zookeeper envolved) will not work no?
   > 
   > if this is true, I think we should have a note on documentation
   
   I tried to work normally in cluster mode
   
   
   
   My steps are as follows
   1.create ck table 
   ```
   create table if not exists default.ck_flink_test_local on cluster clicks_cluster
   (
       user_id Int32,
       message String
   )
   engine = ReplicatedMergeTree('/clickhouse/tables/{shard}/ck_flink_test_local', '{replica}')
   PRIMARY KEY (user_id)
   
   
   
   
   create table if not exists default.ck_flink_test on cluster clicks_cluster
   (
   user_id Int32,
       message String
   )
   engine = Distributed('clicks_cluster', 'default', 'ck_flink_test_local', user_id);
   ```
   
   2. in flink sql client 
   
   ```
   
   CREATE TABLE ck_flink_test(
      user_id INTEGER,
     message String
   ) WITH (
     'connector' = 'jdbc',
     'url' = 'jdbc:clickhouse://xx:xx/default',
    'table-name' = 'ck_flink_test',
    'username’='xx',
    'password’='xx'
   );
   
   
   ```
   3. exec insert sql
   
   ```
   INSERT INTO ck_flink_test (user_id, message) VALUES
       (101, 'Hello');
   
   
   
   ```
   
   4. thd data can be viewed on the ck client 
   
   ```
   select * from ck_flink_test;
   ```
   5.the flink sql client 
   
   ![image](https://github.com/apache/flink-connector-jdbc/assets/19184146/89eca20f-eabf-4090-9460-c46716653afc)
   
   
   
   
   
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218061040


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */
+public class ClickhouseDialect extends AbstractDialect {
+
+    private static final long serialVersionUID = 1L;
+
+    // Define MAX/MIN precision of TIMESTAMP type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html

Review Comment:
   Shouldn't we refer here to Clickhouse doc?



##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */
+public class ClickhouseDialect extends AbstractDialect {
+
+    private static final long serialVersionUID = 1L;
+
+    // Define MAX/MIN precision of TIMESTAMP type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fractional-seconds.html
+    private static final int MAX_TIMESTAMP_PRECISION = 6;
+    private static final int MIN_TIMESTAMP_PRECISION = 1;
+
+    // Define MAX/MIN precision of DECIMAL type according to Mysql docs:
+    // https://dev.mysql.com/doc/refman/8.0/en/fixed-point-types.html

Review Comment:
   Shouldn't we refer here to Clickhouse doc?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210383231


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   I hope you can give me some advice on how to handle it. Thank you very much



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210524440


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   we can update the version on parent



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1222721429


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   Do you have a better idea for this question @snuyanzin 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1578933279

   I have identified the problem and during the final step, I executed a push instead of a force push, which caused the git rebase to fall into a loop. Thank you for your guidance @MartijnVisser @snuyanzin 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-32068] connector jdbc support clickhouse [flink-connector-jdbc]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-3695580424

   This PR has been closed since it has not had any activity in 120 days. 
   If you feel like this was a mistake, or you would like to continue working on it, 
   please feel free to re-open the PR and ask for a review.


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577060660

   > > Ok, I have rebase @MartijnVisser
   > 
   > I don't think you have, given that there are 4 merge-commits in this PR which shouldn't be there when rebased properly: [bb13e1f](https://github.com/apache/flink-connector-jdbc/commit/bb13e1f51d071c5180ccf7d658839a3afac61468) [bced473](https://github.com/apache/flink-connector-jdbc/commit/bced473fbb8a606dca287fcf9329c7f052b9c4be) [9abdfaf](https://github.com/apache/flink-connector-jdbc/commit/9abdfafac76b17dcce371239ff5e16d9b90b9980) [2655b6b](https://github.com/apache/flink-connector-jdbc/commit/2655b6badefbea699ddb2465803076ec229b884b)
   
   
   
   > > What other tasks are needed for this PR to merge
   > 
   > You will need to rebase, because there are a couple of merge commits when you merged `main` into your branch. Those merge commits prevent merging; by rebasing, those commits should not be needed anymore
   
   Sorry, it's my problem. I have rebase it again @MartijnVisser 
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218280732


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialect.java:
##########
@@ -0,0 +1,78 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.connector.jdbc.dialect.AbstractDialect;
+import org.apache.flink.connector.jdbc.internal.converter.ClickhouseRowConvert;
+import org.apache.flink.table.types.logical.LogicalTypeRoot;
+import org.apache.flink.table.types.logical.RowType;
+
+import java.util.EnumSet;
+import java.util.Optional;
+import java.util.Set;
+
+/** */

Review Comment:
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved



##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialectFactory.java:
##########
@@ -0,0 +1,19 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.connector.jdbc.dialect.JdbcDialect;
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectFactory;
+
+/** */

Review Comment:
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved



##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/ClickhouseRowConvert.java:
##########
@@ -0,0 +1,19 @@
+package org.apache.flink.connector.jdbc.internal.converter;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.types.logical.RowType;
+
+/** */

Review Comment:
   Sorry, there was a slight error in my rebase just now, which caused this to happen. Now this has always been resolved



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y closed pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y closed pull request #49: [FLINK-32068] connector jdbc support clickhouse
URL: https://github.com/apache/flink-connector-jdbc/pull/49


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210357598


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java:
##########
@@ -291,4 +291,12 @@ protected <T> T getNullable(ResultSet rs, FunctionWithException<ResultSet, T, SQ
     protected <T> T getNullable(ResultSet rs, T value) throws SQLException {
         return rs.wasNull() ? null : value;
     }
+
+    public TableField[] getFields() {
+        return fields;
+    }
+
+    public String getName() {

Review Comment:
   Ok, I have deleted 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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1210426185


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSinkITCase.java:
##########
@@ -322,6 +325,9 @@ void testBatchSink() throws Exception {
 
     @Test
     void testReadingFromChangelogSource() throws Exception {
+        if (!getMetadata().supportUpsert()) {

Review Comment:
   If I remove this judgment, this test case will fail. I would like to hear your opinion on how to handle this issue



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1211584622


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   the parent pom is 
   ```
   <dependency>
                   <groupId>org.testcontainers</groupId>
                   <artifactId>testcontainers-bom</artifactId>
                   <version>${testcontainers.version}</version>
                   <type>pom</type>
                   <scope>import</scope>
               </dependency>
   ```



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221243546


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   Based on https://clickhouse.com/docs/en/sql-reference/data-types
   ClickHouse also supports `MAP`, `ARRAY`, nested
   can we support them as well?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221555134


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   the map types support @snuyanzin 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1594502796

   Can you provide more specific information, such as error messages
   
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1573107357

   What other tasks are needed for this PR to merge


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218062705


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/internal/converter/ClickhouseRowConvert.java:
##########
@@ -0,0 +1,19 @@
+package org.apache.flink.connector.jdbc.internal.converter;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.types.logical.RowType;
+
+/** */

Review Comment:
   well it's better to have some description about the class rather than an empty comment



##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/dialect/clickhouse/ClickhouseDialectFactory.java:
##########
@@ -0,0 +1,19 @@
+package org.apache.flink.connector.jdbc.dialect.clickhouse;
+
+import org.apache.flink.annotation.Internal;
+import org.apache.flink.connector.jdbc.dialect.JdbcDialect;
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectFactory;
+
+/** */

Review Comment:
   well it's better to have some description about the class rather than an empty comment



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] MartijnVisser commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1576150642

   > What other tasks are needed for this PR to merge
   
   You will need to rebase, because there are a couple of merge commits when you merged `main` into your branch. Those merge commits prevent merging; by rebasing, those commits should not be needed anymore


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] MartijnVisser commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577192740

   > Now this has always been resolved
   
   Unfortunately it hasn't been resolved. In case you want to rebase, what you should do is the following (this is assuming that you've added this repository as a remote called `upstream`.)
   
   1. Run `git fetch upstream`
   2. Run `git rebase upstream/main` and complete this until the rebase has successfully completed
   3. Force push your changes to your branch


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1209918327


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   this is not needed as testcontainers-bom is defined on parent..
   
   if needed should be used ${testcontainers.version} to use same version defined



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221506906


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   I tried to implement this function, when the data type is nested, array, and this object has uncertain data type information
   
   ```
    case ARRAY:
                   return new JdbcDeserializationConverter() {
                       @Override
                       public Object deserialize(Object jdbcField) throws SQLException {
                           return new GenericArrayData((Object[]) jdbcField);
                       }
                   };
   ```
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221225513


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseRowConvert.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.data.DecimalData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import com.clickhouse.data.value.UnsignedByte;
+import com.clickhouse.data.value.UnsignedInteger;
+import com.clickhouse.data.value.UnsignedShort;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * Runtime converter that responsible to convert between JDBC object and Flink internal object for
+ * ClickHouse.
+ */
+public class ClickHouseRowConvert extends AbstractJdbcRowConverter {
+    @Override
+    public String converterName() {
+        return "ClickHouse";
+    }
+
+    public ClickHouseRowConvert(RowType rowType) {
+        super(rowType);
+    }
+
+    @Override
+    protected JdbcDeserializationConverter createInternalConverter(LogicalType type) {
+        switch (type.getTypeRoot()) {
+            case NULL:
+                return null;
+            case BOOLEAN:
+            case FLOAT:
+            case DOUBLE:
+                return val -> val;
+            case TINYINT:
+                return val -> ((Byte) val).byteValue();
+            case SMALLINT:
+                return val ->
+                        val instanceof UnsignedByte
+                                ? ((UnsignedByte) val).shortValue()
+                                : ((Short) val).shortValue();
+            case INTEGER:
+                return val ->
+                        val instanceof UnsignedShort
+                                ? ((UnsignedShort) val).intValue()
+                                : ((Integer) val).intValue();
+            case BIGINT:
+                return jdbcField -> {
+                    if (jdbcField instanceof UnsignedInteger) {
+                        return ((UnsignedInteger) jdbcField).longValue();
+                    } else if (jdbcField instanceof Long) {
+                        return ((Long) jdbcField).longValue();
+                    }
+                    // UINT64 is not supported,the uint64 range exceeds the long range

Review Comment:
   i still don't see the issue why `UInt64`, `UInt128`, `UInt256` we can not return `BigInteger` ?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1230973150


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBuilder.java:
##########
@@ -51,4 +52,8 @@ private static TableField createField(
             String name, TableField.DbType dbType, DataType dataType, boolean pkField) {
         return new TableField(name, dataType, dbType, pkField);
     }
+
+    public static ClickhouseTableRow ckTableRow(String name, TableField... fields) {

Review Comment:
   ck? do you mean ch?



##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java:
##########
@@ -291,4 +291,12 @@ protected <T> T getNullable(ResultSet rs, FunctionWithException<ResultSet, T, SQ
     protected <T> T getNullable(ResultSet rs, T value) throws SQLException {
         return rs.wasNull() ? null : value;
     }
+
+    public TableField[] getFields() {

Review Comment:
   this is not used, could be removed



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1212587682


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   ok,I have deleted the specified version @eskabetxe 



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] eskabetxe commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "eskabetxe (via GitHub)" <gi...@apache.org>.
eskabetxe commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1209929711


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java:
##########
@@ -291,4 +291,12 @@ protected <T> T getNullable(ResultSet rs, FunctionWithException<ResultSet, T, SQ
     protected <T> T getNullable(ResultSet rs, T value) throws SQLException {
         return rs.wasNull() ? null : value;
     }
+
+    public TableField[] getFields() {
+        return fields;
+    }
+
+    public String getName() {

Review Comment:
   already exist a getTableName()



##########
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(", ")),
+                "ENGINE = MergeTree",
+                getStreamFields().map(TableField::getName).findFirst().get());

Review Comment:
   you are ignoring the PKs defined in table definition with this...



##########
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:
   as this is also used on TableBase could we create a method for it there?



##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBase.java:
##########
@@ -291,4 +291,12 @@ protected <T> T getNullable(ResultSet rs, FunctionWithException<ResultSet, T, SQ
     protected <T> T getNullable(ResultSet rs, T value) throws SQLException {
         return rs.wasNull() ? null : value;
     }
+
+    public TableField[] getFields() {

Review Comment:
   for the use I see you should use getStreamFields() 



##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   should be ${testcontainers.version}



##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSinkITCase.java:
##########
@@ -322,6 +325,9 @@ void testBatchSink() throws Exception {
 
     @Test
     void testReadingFromChangelogSource() throws Exception {
+        if (!getMetadata().supportUpsert()) {

Review Comment:
   Here the problem is the deletion no? (I have this same problem in Trino dialect)
   



##########
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(", ")),
+                "ENGINE = MergeTree",
+                getStreamFields().map(TableField::getName).findFirst().get());
+    }
+
+    @Override
+    protected String getDeleteFromQuery() {
+        return String.format("truncate table %s", getTableName());
+    }
+
+    private Stream<TableField> getStreamFields() {

Review Comment:
   TableBase already have a getStreamFields()



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1562933275

   the pr is ready


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221509236


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   the jdbcField is 
   ![image](https://github.com/apache/flink-connector-jdbc/assets/19184146/f717ddc2-5bc1-4df4-a5e2-93f5f0f2aa2f)
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221252967


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   > Based on https://clickhouse.com/docs/en/sql-reference/data-types ClickHouse also supports `MAP`, `ARRAY`, nested can we support them as well?
   not support 
   



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577954701

   if you execute this comment on your branch
   ```
   git log --pretty-online
   ```
   you'll se several merge remote-tracking commits like 
   ```
   c9e316596dc29fe3cb60578f53dce3b2b7fa8c1a (HEAD, WenDing/jdbc-clickhouse) Merge remote-tracking branch 'origin/jdbc-clickhouse' into jdbc-clickhouse
   9098ce56b0d703cda0a1f24f69058b9ab15af556 [FLINK-32068]connector jdbc support clickhouse
   8f6eff4e98003d568da8e722c06167dd491d4b53 [FLINK-32068]connector jdbc support clickhouse
   79cc7987be514afd0580d377208c798ec04a9415 [FLINK-32068] jdbc support clickhouse
   210968dca5a1fb47cd3268fa130f0ff5e54f299c [FLINK-32068]connector jdbc support clickhouse
   c49485360a58e12ce7aad13ee627dcecc74c891e [FLINK-32068] connector jdbc support clickhouse
   00c94f815e8fda71777a83d63bd1e14111bc5650 [FLINK-32068] connector jdbc support clickhouse
   cd268a2111ecfd0602f4150d5b1cc44b99779456 [FLINK-32068] connector jdbc support clickhouse
   86b5eeee7b88c1ef46f7d768875762ae253eec97 [FLINK-32068] connector jdbc support clickhouse
   b81bc533fb98da2e5a76bddb22a4da8a52fb411e [FLINK-32068]connector jdbc support clickhouse
   55f79f215456c0dbb5fdd3d99a8be6985be092ef [FLINK-32068]connector jdbc support clickhouse
   1ff9e70dfbeefaa2e92c11db36fcca3c27bf9b49 Merge remote-tracking branch 'origin/jdbc-clickhouse' into jdbc-clickhouse
   b6663a5fced2e4703c263827ca67c2dbacbf96bd [FLINK-32068]connector jdbc support clickhouse
   2655b6badefbea699ddb2465803076ec229b884b Merge remote-tracking branch 'origin/main' into jdbc-clickhouse
   9abdfafac76b17dcce371239ff5e16d9b90b9980 Merge branch 'main' into jdbc-clickhouse
   d67de5f0f94b1de912470028ea1fc74376bd64b8 [FLINK-31551] Add support for CrateDB (#29)
   7b8617e03048d32d44dc453bd556d9f59d58a3e1 [FLINK-32068]connector jdbc support clickhouse,delete testcontainers version
   bced473fbb8a606dca287fcf9329c7f052b9c4be Merge remote-tracking branch 'upstream/main' into jdbc-clickhouse
   
   ```
   and this the issue
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1231704047


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/testutils/tables/TableBuilder.java:
##########
@@ -51,4 +52,8 @@ private static TableField createField(
             String name, TableField.DbType dbType, DataType dataType, boolean pkField) {
         return new TableField(name, dataType, dbType, pkField);
     }
+
+    public static ClickhouseTableRow ckTableRow(String name, TableField... fields) {

Review Comment:
   yes



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577098449

   > > Ok, I have rebase @MartijnVisser
   > 
   > I don't think you have, given that there are 4 merge-commits in this PR which shouldn't be there when rebased properly: [bb13e1f](https://github.com/apache/flink-connector-jdbc/commit/bb13e1f51d071c5180ccf7d658839a3afac61468) [bced473](https://github.com/apache/flink-connector-jdbc/commit/bced473fbb8a606dca287fcf9329c7f052b9c4be) [9abdfaf](https://github.com/apache/flink-connector-jdbc/commit/9abdfafac76b17dcce371239ff5e16d9b90b9980) [2655b6b](https://github.com/apache/flink-connector-jdbc/commit/2655b6badefbea699ddb2465803076ec229b884b)
   
   Sorry, it's my problem. I have rebase it again @MartijnVisser


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1218215385


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseRowConvert.java:
##########
@@ -0,0 +1,85 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.converter.AbstractJdbcRowConverter;
+import org.apache.flink.table.data.DecimalData;
+import org.apache.flink.table.data.StringData;
+import org.apache.flink.table.data.TimestampData;
+import org.apache.flink.table.types.logical.DecimalType;
+import org.apache.flink.table.types.logical.LogicalType;
+import org.apache.flink.table.types.logical.RowType;
+
+import com.clickhouse.data.value.UnsignedByte;
+import com.clickhouse.data.value.UnsignedInteger;
+import com.clickhouse.data.value.UnsignedShort;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * Runtime converter that responsible to convert between JDBC object and Flink internal object for
+ * ClickHouse.
+ */
+public class ClickHouseRowConvert extends AbstractJdbcRowConverter {
+    @Override
+    public String converterName() {
+        return "ClickHouse";
+    }
+
+    public ClickHouseRowConvert(RowType rowType) {
+        super(rowType);
+    }
+
+    @Override
+    protected JdbcDeserializationConverter createInternalConverter(LogicalType type) {
+        switch (type.getTypeRoot()) {
+            case NULL:
+                return null;
+            case BOOLEAN:
+            case FLOAT:
+            case DOUBLE:
+                return val -> val;
+            case TINYINT:
+                return val -> ((Byte) val).byteValue();
+            case SMALLINT:
+                return val ->
+                        val instanceof UnsignedByte
+                                ? ((UnsignedByte) val).shortValue()
+                                : ((Short) val).shortValue();
+            case INTEGER:
+                return val ->
+                        val instanceof UnsignedShort
+                                ? ((UnsignedShort) val).intValue()
+                                : ((Integer) val).intValue();
+            case BIGINT:
+                return jdbcField -> {
+                    if (jdbcField instanceof UnsignedInteger) {
+                        return ((UnsignedInteger) jdbcField).longValue();
+                    } else if (jdbcField instanceof Long) {
+                        return ((Long) jdbcField).longValue();
+                    }
+                    // UINT64 is not supported,the uint64 range exceeds the long range

Review Comment:
   the  clickhouse data types range
   UInt8 — [0 : 255]
   UInt16 — [0 : 65535]
   UInt32 — [0 : 4294967295]
   UInt64 — [0 : 18446744073709551615]
   UInt128 — [0 : 340282366920938463463374607431768211455]
   UInt256 — [0 : 115792089237316195423570985008687907853269984665640564039457584007913129639935]



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1577972673

   > if you execute this command on your branch
   > 
   > ```
   > git log --pretty-oneline
   > ```
   > 
   > you'll se several merge remote-tracking commits like
   > 
   > ```
   > c9e316596dc29fe3cb60578f53dce3b2b7fa8c1a (HEAD, WenDing/jdbc-clickhouse) Merge remote-tracking branch 'origin/jdbc-clickhouse' into jdbc-clickhouse
   > 9098ce56b0d703cda0a1f24f69058b9ab15af556 [FLINK-32068]connector jdbc support clickhouse
   > 8f6eff4e98003d568da8e722c06167dd491d4b53 [FLINK-32068]connector jdbc support clickhouse
   > 79cc7987be514afd0580d377208c798ec04a9415 [FLINK-32068] jdbc support clickhouse
   > 210968dca5a1fb47cd3268fa130f0ff5e54f299c [FLINK-32068]connector jdbc support clickhouse
   > c49485360a58e12ce7aad13ee627dcecc74c891e [FLINK-32068] connector jdbc support clickhouse
   > 00c94f815e8fda71777a83d63bd1e14111bc5650 [FLINK-32068] connector jdbc support clickhouse
   > cd268a2111ecfd0602f4150d5b1cc44b99779456 [FLINK-32068] connector jdbc support clickhouse
   > 86b5eeee7b88c1ef46f7d768875762ae253eec97 [FLINK-32068] connector jdbc support clickhouse
   > b81bc533fb98da2e5a76bddb22a4da8a52fb411e [FLINK-32068]connector jdbc support clickhouse
   > 55f79f215456c0dbb5fdd3d99a8be6985be092ef [FLINK-32068]connector jdbc support clickhouse
   > 1ff9e70dfbeefaa2e92c11db36fcca3c27bf9b49 Merge remote-tracking branch 'origin/jdbc-clickhouse' into jdbc-clickhouse
   > b6663a5fced2e4703c263827ca67c2dbacbf96bd [FLINK-32068]connector jdbc support clickhouse
   > 2655b6badefbea699ddb2465803076ec229b884b Merge remote-tracking branch 'origin/main' into jdbc-clickhouse
   > 9abdfafac76b17dcce371239ff5e16d9b90b9980 Merge branch 'main' into jdbc-clickhouse
   > d67de5f0f94b1de912470028ea1fc74376bd64b8 [FLINK-31551] Add support for CrateDB (#29)
   > 7b8617e03048d32d44dc453bd556d9f59d58a3e1 [FLINK-32068]connector jdbc support clickhouse,delete testcontainers version
   > bced473fbb8a606dca287fcf9329c7f052b9c4be Merge remote-tracking branch 'upstream/main' into jdbc-clickhouse
   > ```
   > 
   > and this the issue
   
   
   What else do I need to do? I executed it
   1.Run git fetch upstream
   2.Run git rebase upstream/main and complete this until the rebase has successfully completed
   3.Force push your changes to your branch


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1580174935

   > > What other tasks are needed for this PR to merge
   > 
   > You will need to rebase, because there are a couple of merge commits when you merged `main` into your branch. Those merge commits prevent merging; by rebasing, those commits should not be needed anymore
   
   the pr is ready @MartijnVisser 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221252647


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   not support



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] snuyanzin commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1221254921


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   it would be great if share more info about reasons



##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/databases/clickhouse/dialect/ClickHouseDialectTypeTest.java:
##########
@@ -0,0 +1,41 @@
+package org.apache.flink.connector.jdbc.databases.clickhouse.dialect;
+
+import org.apache.flink.connector.jdbc.dialect.JdbcDialectTypeTest;
+
+import java.util.Arrays;
+import java.util.List;
+
+/** The Clickhouse params for {@link JdbcDialectTypeTest}. */
+public class ClickHouseDialectTypeTest extends JdbcDialectTypeTest {
+
+    @Override
+    protected String testDialect() {
+        return "clickhouse";
+    }
+
+    @Override
+    protected List<TestItem> testData() {
+        return Arrays.asList(
+                createTestItem("CHAR"),

Review Comment:
   it would be you great if share more info about reasons



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on a diff in pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on code in PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#discussion_r1211582778


##########
flink-connector-jdbc/pom.xml:
##########
@@ -194,6 +194,22 @@ under the License.
 			<scope>test</scope>
 		</dependency>
 
+		<!-- clickhouse tests -->
+		<dependency>
+			<groupId>com.clickhouse</groupId>
+			<artifactId>clickhouse-jdbc</artifactId>
+			<version>0.4.6</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.testcontainers</groupId>
+			<artifactId>clickhouse</artifactId>
+			<version>1.18.1</version>

Review Comment:
   If I modify this version number in parent pom.xml, it will affect other testcontainers



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1630724942

   > > One question that comes to my mind now.. This will only work with a 1 server no? if we have a Clickhouse cluster with more than 1 server (that will have a zookeeper envolved) will not work no?
   > > if this is true, I think we should have a note on documentation
   > 
   > I tried to work normally in cluster mode
   > 
   > My steps are as follows 1.create ck table
   > 
   > ```
   > create table if not exists default.ck_flink_test_local on cluster clicks_cluster
   > (
   >     user_id Int32,
   >     message String
   > )
   > engine = ReplicatedMergeTree('/clickhouse/tables/{shard}/ck_flink_test_local', '{replica}')
   > PRIMARY KEY (user_id)
   > 
   > 
   > 
   > 
   > create table if not exists default.ck_flink_test on cluster clicks_cluster
   > (
   > user_id Int32,
   >     message String
   > )
   > engine = Distributed('clicks_cluster', 'default', 'ck_flink_test_local', user_id);
   > ```
   > 
   > 2. in flink sql client
   > 
   > ```
   > 
   > CREATE TABLE ck_flink_test(
   >    user_id INTEGER,
   >   message String
   > ) WITH (
   >   'connector' = 'jdbc',
   >   'url' = 'jdbc:clickhouse://xx:xx/default',
   >  'table-name' = 'ck_flink_test',
   >  'username’='xx',
   >  'password’='xx'
   > );
   > ```
   > 
   > 3. exec insert sql
   > 
   > ```
   > INSERT INTO ck_flink_test (user_id, message) VALUES
   >     (101, 'Hello');
   > ```
   > 
   > 4. thd data can be viewed on the ck client
   > 
   > ```
   > select * from ck_flink_test;
   > ```
   > 
   > 5.the flink sql client
   > 
   > ![image](https://user-images.githubusercontent.com/19184146/252660687-89eca20f-eabf-4090-9460-c46716653afc.png)
   
   
   @eskabetxe I guess you might have defined the table incorrectly
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] WenDing-Y commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "WenDing-Y (via GitHub)" <gi...@apache.org>.
WenDing-Y commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1592422341

   What other tasks are needed for this PR to merge @MartijnVisser 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [flink-connector-jdbc] MartijnVisser commented on pull request #49: [FLINK-32068] connector jdbc support clickhouse

Posted by "MartijnVisser (via GitHub)" <gi...@apache.org>.
MartijnVisser commented on PR #49:
URL: https://github.com/apache/flink-connector-jdbc/pull/49#issuecomment-1592940408

   > What other tasks are needed for this PR to merge
   
   Please mark review items as resolved, if you really have resolved them. Right now, it looks like there are still open items. 


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org