Skip to content

Replace deprecated driver ru.yandex.clickhouse.ClickHouseDriver#10559

Closed
tangjiangling wants to merge 4 commits intotrinodb:masterfrom
tangjiangling:replace-clickhouse-driver
Closed

Replace deprecated driver ru.yandex.clickhouse.ClickHouseDriver#10559
tangjiangling wants to merge 4 commits intotrinodb:masterfrom
tangjiangling:replace-clickhouse-driver

Conversation

@tangjiangling
Copy link
Copy Markdown
Member

@tangjiangling tangjiangling commented Jan 12, 2022

Fixes: #10541

The driver ru.yandex.clickhouse.ClickHouseDriver has been marked as deprecated.
Also everything in package ru.yandex.clickhouse will be removed starting from 0.4.0.

Here are some things I've done for review:

  • Check if there are compatibility issues between com.clickhouse.jdbc.ClickHouseDriver and ru.yandex.clickhouse.ClickHouseDriver
  • Replace all ru.yandex.clickhouse.ClickHouseDriver
    image
  • Run all tests underplugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse

@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Jan 12, 2022

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please submit the signed CLA to cla@trino.io. For more information, see https://github.com/trinodb/cla.

@ebyhr ebyhr self-requested a review January 12, 2022 09:44
@tangjiangling
Copy link
Copy Markdown
Member Author

cc @ebyhr

@tangjiangling
Copy link
Copy Markdown
Member Author

@ebyhr i have encountered some testing problems, please help ~

Caused by: java.lang.IllegalStateException: No suitable ClickHouse client(out of 1) found in classpath.
	at com.clickhouse.client.ClickHouseClientBuilder.build(ClickHouseClientBuilder.java:103)
	at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:185)
	at com.clickhouse.jdbc.internal.ClickHouseConnectionImpl.<init>(ClickHouseConnectionImpl.java:168)
	at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:145)
	at com.clickhouse.jdbc.ClickHouseDriver.connect(ClickHouseDriver.java:41)
	at io.trino.plugin.jdbc.DriverConnectionFactory.openConnection(DriverConnectionFactory.java:65)
	at io.trino.plugin.clickhouse.ClickHouseConnectionFactory$1.<init>(ClickHouseConnectionFactory.java:43)
	at io.trino.plugin.clickhouse.ClickHouseConnectionFactory.openConnection(ClickHouseConnectionFactory.java:41)

Copy link
Copy Markdown
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: src/main/java/io/trino/plugin/clickhouse/ClickHouseClientModule.java:[29,1] (imports) ImportOrder: Wrong order for 'com.clickhouse.jdbc.ClickHouseDriver' import.

Please fix import order. Style guide exists in https://github.com/trinodb/trino/blob/master/.github/DEVELOPMENT.md#code-style

I guess "No suitable ClickHouse client" comes from clickhouse-http-client exclusion in pom.xml.

@tangjiangling
Copy link
Copy Markdown
Member Author

Got it.

@tangjiangling
Copy link
Copy Markdown
Member Author

@ebyhr When I removed the exclusion clickhouse-http-client from pom.xml, I encountered the following error when running tests:

java.lang.RuntimeException: line 1:15: Table 'clickhouse.tpch.test_basic_typesz8en9dj3po' does not exist

	at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
	at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:505)
	at io.trino.sql.query.QueryAssertions$QueryAssert.newQueryAssert(QueryAssertions.java:257)
	at io.trino.sql.query.QueryAssertions.query(QueryAssertions.java:105)
	at io.trino.testing.datatype.SqlDataTypeTest.verifySelect(SqlDataTypeTest.java:90)
	at io.trino.testing.datatype.SqlDataTypeTest.execute(SqlDataTypeTest.java:79)
	at io.trino.testing.datatype.SqlDataTypeTest.execute(SqlDataTypeTest.java:72)
	at io.trino.plugin.clickhouse.TestClickHouseTypeMapping.testBasicTypes(TestClickHouseTypeMapping.java:130)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
	at org.testng.TestRunner.privateRun(TestRunner.java:756)
	at org.testng.TestRunner.run(TestRunner.java:610)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
	at org.testng.SuiteRunner.run(SuiteRunner.java:289)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
	at org.testng.TestNG.runSuites(TestNG.java:1133)
	at org.testng.TestNG.run(TestNG.java:1104)
	at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
	at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)
	Suppressed: java.lang.Exception: SQL: SELECT * FROM tpch.test_basic_typesz8en9dj3po
		at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:508)
		... 30 more

Have these test codes been tested?
Now it looks like some table initialization is needed to get the tests to run successfully.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 12, 2022

@tangjiangling The error message mean you need to debug why new tables don't appear after the creation.

@tangjiangling
Copy link
Copy Markdown
Member Author

Oh i see, i will do that.

@tangjiangling
Copy link
Copy Markdown
Member Author

The error message mean you need to debug why new tables don't appear after the creation.

java.lang.RuntimeException: line 1:15: Table 'clickhouse.tpch.test_basic_typesz8en9dj3po' does not exist

@ebyhr The reason for this error is:

After replacing ru.yandex.clickhouse.ClickHouseDriver with com.clickhouse.jdbc.ClickHouseDriver, the data in the test was indeed written to ClickHouse, but then there was a problem comparing the data written to ClickHouse with the data in TPCH, using com.clickhouse.jdbc.ClickHouseDatabaseMetaData#getTables is the error shown in the figure below:

image

From the above diagram we can see:

the ClickHouse (version 20.8.19.4) used in the test has no comment field in the table system.tables, which causes com.clickhouse.jdbc.ClickHouseDatabaseMetaData#getTables fails and the exception is ignored (the default behavior of the method), so the test eventually fails.

Why is there no problem running the test with ru.yandex.clickhouse.ClickHouseDriver?

SQL used in com.clickhouse.jdbc.ClickHouseDatabaseMetaData#getTables:
image

SQL used in ru.yandex.clickhouse.ClickHouseDatabaseMetaData#getTables:
image

Because ru.yandex.clickhouse.ClickHouseDatabaseMetaData#getTables does not use the comment field of system.tables, the test runs successfully.

@hashhar
Copy link
Copy Markdown
Member

hashhar commented Jan 13, 2022

Does this mean that the driver isn't backward compatible (and considered a bug in ClickHouse JDBC driver?)?
In that case we'd need to keep using the current one until all supported ClickHouse versions move to newer versions.

@tangjiangling
Copy link
Copy Markdown
Member Author

Does this mean that the driver isn't backward compatible (and considered a bug in ClickHouse JDBC driver?)?

Yes, it is a compatibility issue.

In that case we'd need to keep using the current one until all supported ClickHouse versions move to newer versions.

Yes, I'm going to send this question back to the clickhouse-jdbc community and see if I can get some feedback.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 13, 2022

Sent a PR to clickhouse-jdbc repository ClickHouse/clickhouse-java#804

@tangjiangling
Copy link
Copy Markdown
Member Author

@ebyhr @hashhar Another problem:

When I upgraded the ClickHouse version to 21.11 (changing TestingClickHouseServer.CLICKHOUSE_IMAGE), the compatibility problem disappeared, but io.trino.plugin.clickhouse.ClickHouseClient#getTables has problems using tableTypes:

image

We need to be more careful with tableTypes, for example in the picture above we actually want to get the tableclickhouse.tpch.customer, this table in ClickHouse is of type LOG TABLE, if we use tableTypes=["TABLE", "VIEW"] to query , there is no result because com.clickhouse.jdbc.ClickHouseDatabaseMetaData#getTables has a more strict tableTypes check.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 13, 2022

@tangjiangling Could you add smoke tests with 20.8 and 21.11.10.1? You can refer to SQL Server connector (BaseSqlServerConnectorSmokeTest, TestSqlServerConnectorSmokeTest, TestSqlServerLatestConnectorSmokeTest).

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 13, 2022

@tangjiangling you can pass either an empty string array or even null as table types instead. As to pom.xml, I think it's better to use shaded jar for least dependency and avoid potential conflict, for example:

<dependency>
    <groupId>com.clickhouse</groupId>
    <artifactId>clickhouse-jdbc</artifactId>
    <version>0.3.2-patch1</version>
    <!-- chance classifier to 'all' if you need experimental gRPC support  -->
    <classifier>http</classifier>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>

I'll release 0.3.2-patch2 to close this on Sunday if there's no more issue.

@tangjiangling
Copy link
Copy Markdown
Member Author

@tangjiangling Could you add smoke tests with 20.8 and 21.11.10.1? You can refer to SQL Server connector (BaseSqlServerConnectorSmokeTest, TestSqlServerConnectorSmokeTest, TestSqlServerLatestConnectorSmokeTest).

@ebyhr Sorry for the delay. I noticed that you have added smoke tests(#10600). So next I need to wait for your PR to merge to master and then update the current PR?

@tangjiangling
Copy link
Copy Markdown
Member Author

I'll release 0.3.2-patch2 to close this on Sunday if there's no more issue.

I will update the current PR when this version is released.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 14, 2022

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Jan 14, 2022
@cla-bot
Copy link
Copy Markdown

cla-bot bot commented Jan 14, 2022

The cla-bot has been summoned, and re-checked this pull request!

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 16, 2022

I will update the current PR when this version is released.

Thanks. Just released 0.3.2-patch2, which will be available in maven central soon.

The driver `ru.yandex.clickhouse.ClickHouseDriver` has been marked as deprecated.
Also everything in package `ru.yandex.clickhouse` will be removed starting from 0.4.0.
@tangjiangling
Copy link
Copy Markdown
Member Author

[WARN] This is a draft PR.

TODOs:

I will update the current PR again once the two issues above have been fixed.
Also I have verified the above two fixes locally and all tests in the plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse directory run successfully.

When we replace `ru.yandex.clickhouse.ClickHouseDriver` with `com.clickhouse.jdbc.ClickHouseDriver`,
the `com.clickhouse.jdbc.internal.ClickHouseConnectionImpl#getCatalog` method already returns `null`,
so there's no need to override the `getTables` method.
This fixes:
- Implement the `getTableTypes` method in `io.trino.plugin.clickhouse.ClickHouseClient`
- Set the correct `SliceReadFunction` for `String` or `FixedString` types when `mapStringAsVarchar` is not set
- Expected error messages in class `io.trino.plugin.clickhouse.TestClickHouseConnectorTest`
@den-crane
Copy link
Copy Markdown

Clickhouse 20.8 is end of life. The minimal supported Clickhouse version is 21.3.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 17, 2022

Clickhouse 20.8 is end of life. The minimal supported Clickhouse version is 21.3.

This is true in vanilla ClickHouse, but EOL of 20.8 in Altinity is 02 December 2022. https://docs.altinity.com/altinitystablebuilds/

edit: I added tests for Altinity. It's ready to upgrade the ClickHouse image version.

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 19, 2022

Replace deprecated ClickHouse Driver testcontainers/testcontainers-java#4924

Does it make sense to use GenericContainer? This way you don't have to rely on this PR.

private final GenericContainer<?> dockerContainer;
...
dockerContainer = new GenericContainer<>(CLICKHOUSE_IMAGE).withExposedPorts(HTTP_PORT)
                .waitingFor(Wait.forHttp("/ping").forPort(HTTP_PORT).forStatusCode(200)
                        .withStartupTimeout(Duration.of(60, SECONDS)));

New Driver returns incorrect precision ClickHouse/clickhouse-jdbc#807

As discussed, I created a new PR to fix the issue, see ClickHouse/clickhouse-java#815

I will update the current PR again once the two issues above have been fixed. Also I have verified the above two fixes locally and all tests in the plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse directory run successfully.

I tried to run all the tests using master branch but ended up with below exception. Not sure if I did something wrong. Could you re-run test at your end with above two changes?

java.lang.RuntimeException: line 1:22: Table 'clickhouse.tpch.customer' does not exist
	at io.trino.testing.AbstractTestingTrinoClient.execute(AbstractTestingTrinoClient.java:122)
	at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:505)
	at io.trino.testing.QueryAssertions.copyTable(QueryAssertions.java:344)
	at io.trino.testing.QueryAssertions.copyTable(QueryAssertions.java:331)
	at io.trino.testing.QueryAssertions.copyTpchTables(QueryAssertions.java:323)
	at io.trino.plugin.clickhouse.ClickHouseQueryRunner.createClickHouseQueryRunner(ClickHouseQueryRunner.java:69)
	at io.trino.plugin.clickhouse.TestClickHouseConnectorTest.createQueryRunner(TestClickHouseConnectorTest.java:62)
	at io.trino.testing.AbstractTestQueryFramework.init(AbstractTestQueryFramework.java:83)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:144)
	at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:169)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
	Suppressed: java.lang.Exception: SQL: SELECT count(*) FROM customer
		at io.trino.testing.DistributedQueryRunner.execute(DistributedQueryRunner.java:508)
		... 19 more
Caused by: io.trino.spi.TrinoException: line 1:22: Table 'clickhouse.tpch.customer' does not exist
	at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:48)
	at io.trino.sql.analyzer.SemanticExceptions.semanticException(SemanticExceptions.java:43)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:1527)
	at io.trino.sql.analyzer.StatementAnalyzer$Visitor.visitTable(StatementAnalyzer.java:405)
	at io.trino.sql.tree.Table.accept(Table.java:60)
...

@tangjiangling
Copy link
Copy Markdown
Member Author

Does it make sense to use GenericContainer? This way you don't have to rely on this PR.

Sounds good. cc @ebyhr

@tangjiangling
Copy link
Copy Markdown
Member Author

I tried to run all the tests using master branch but ended up with below exception. Not sure if I did something wrong. Could you re-run test at your end with above two changes?

Okay, I will take a look.

@ebyhr
Copy link
Copy Markdown
Member

ebyhr commented Jan 19, 2022

@tangjiangling We would like to verify the connection using at query level before running tests, so GenericContainer doesn't make sense. What you are blocked by the testcontainers PR is only driver class name? You can consider extending ClickHouseContainer and overriding getDriverClassName() method. We prefer composition and delegation to inheritance though. Please refer toTestingMSSQLServerContainer as the example.

@tangjiangling
Copy link
Copy Markdown
Member Author

tangjiangling commented Jan 19, 2022

What you are blocked by the testcontainers PR is only driver class name?

Yes, I will take your advice and then see if there are any other problems.

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 19, 2022

Could you also remove custom.xml? It's a workaround for the "failed to response" error, but now I think it's no longer needed.

@tangjiangling
Copy link
Copy Markdown
Member Author

java.lang.RuntimeException: line 1:22: Table 'clickhouse.tpch.customer' does not exist

@zhicwu Sorry for the late reply. The reason for this error I have found before, you can read this.
And there are some other compatibility issues (e.g. the return value of jdbcTypeName has changed and needs to be made compatible).

I will test and collect all compatibility issues with the new driver by this Sunday and then put it together and submit it to you.
Apologies in advance, as I have some other things to do this week, so it's scheduled until Sunday.

@tangjiangling
Copy link
Copy Markdown
Member Author

Could you also remove custom.xml? It's a workaround for the "failed to response" error, but now I think it's no longer needed.

@ebyhr

@tangjiangling
Copy link
Copy Markdown
Member Author

if (column.getScale() > 0 || column.getDataType() == ClickHouseDataType.Float32
        || column.getDataType() == ClickHouseDataType.Float64) {
    r.getValue("DECIMAL_DIGITS").update(column.getScale());
} else {
    r.getValue("DECIMAL_DIGITS").resetToNullOrEmpty();
}

I think you need to consider some special cases (e.g. :decimal(3, 0)).

@tangjiangling
Copy link
Copy Markdown
Member Author

I will test and collect all compatibility issues with the new driver by this Sunday and then put it together and submit it to you.

@zhicwu After testing, I found the following problems:

  1. As mentioned before, the scale=0 case is not supported (e.g. decimal(3,0)).
  2. When executing INSERT INTO test_table (string_column) VALUES (binary_string), com.clickhouse.jdbc.SqlBasedPreparedStatement#setBytes method will eventually fail because binary_string is not quoted. This behaviour is not consistent with ru.yandex.clickhouse.ClickHousePreparedStatementImpl#setBytes.

I've updated my PR and you can review it for me.
I've encountered a strange test exception and I will fix it later.

java.lang.AssertionError: Expected IllegalArgumentException to be thrown, but nothing was thrown

	at org.testng.Assert.expectThrows(Assert.java:1730)
	at org.testng.Assert.assertThrows(Assert.java:1695)
	at com.clickhouse.client.BaseClickHouseValueTest.checkValueOrException(BaseClickHouseValueTest.java:31)
	at com.clickhouse.client.BaseClickHouseValueTest.checkValue(BaseClickHouseValueTest.java:138)
	at com.clickhouse.client.BaseClickHouseValueTest.checkValue(BaseClickHouseValueTest.java:107)
	at com.clickhouse.client.data.ClickHouseStringValueTest.testValue(ClickHouseStringValueTest.java:195)

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 24, 2022

Thanks for the feedback @tangjiangling! Please see my comments below inline.

1. As mentioned before, the `scale=0` case is not supported (e.g. decimal(3,0)).

I guess we should return scale for timestamp(DateTime, Datetime64(scale)) as well. However, it seems trino expects timestamp(0) but got timestamp(3). Apart from that, I also noticed many DDL tests were skipped(mainly due to outdated table creation syntax) and many has no supported columns errors on master branch. In order to avoid duplicated efforts, which repo and branch I'm supposed to use for testing clickhouse connector?

2. When executing `INSERT INTO test_table (string_column) VALUES (binary_string)`, `com.clickhouse.jdbc.SqlBasedPreparedStatement#setBytes` method will eventually fail because `binary_string` is not quoted. This behaviour is not consistent with `ru.yandex.clickhouse.ClickHousePreparedStatementImpl#setBytes`.

Good catch! Besides, the assumption of using UTF8 charset will ruin binary data. Below is an attempt to fix that but I'm seeking a compact format like in Trino(select X'616263' instead of select char(0x61, 0x62, 0x63)).
https://github.com/ClickHouse/clickhouse-jdbc/blob/c9ea0a19f60ac8fec5b12137a4954adcf499630b/clickhouse-client/src/main/java/com/clickhouse/client/data/ClickHouseStringValue.java#L272-L283

I've updated my PR and you can review it for me. I've encountered a strange test exception and I will fix it later.

Didn't see that in CI but I'll definitely enhance the test by adding more descriptions.

@tangjiangling
Copy link
Copy Markdown
Member Author

which repo and branch I'm supposed to use for testing clickhouse connector?

I will update this PR soon, and you can test it with the branch corresponding to this PR.

@tangjiangling
Copy link
Copy Markdown
Member Author

Besides, the assumption of using UTF8 charset will ruin binary data.

Yes, this will cause this test to fail. (https://github.com/trinodb/trino/blob/master/plugin/trino-clickhouse/src/test/java/io/trino/plugin/clickhouse/TestClickHouseTypeMapping.java#L386)

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 24, 2022

I will update this PR soon, and you can test it with the branch corresponding to this PR.

Any concern to make your repo public? Will try it out tonight.

@tangjiangling
Copy link
Copy Markdown
Member Author

@zhicwu

I will update this PR soon, and you can test it with the branch corresponding to this PR.

I mistakenly deleted the branch corresponding to the current PR (both local and remote were overwritten) and now I can't seem to update the current PR.
You can use this branch to test.

Besides, the assumption of using UTF8 charset will ruin binary data. Below is an attempt to fix that but I'm seeking a compact format like in Trino(select X'616263' instead of select char(0x61, 0x62, 0x63)).

In order to support binary data, We need to implement com.clickhouse.jdbc.ClickHouseResultSet#getBytes method as well.

@tangjiangling
Copy link
Copy Markdown
Member Author

I mistakenly deleted the branch corresponding to the current PR (both local and remote were overwritten) and now I can't seem to update the current PR.

@ebyhr Is there a remedy for this situation? Or do I have to file a new PR? o(╥﹏╥)o

@tangjiangling
Copy link
Copy Markdown
Member Author

tangjiangling commented Jan 24, 2022

Any concern to make your repo public? Will try it out tonight.

You can use this branch to test.

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 24, 2022

@tangjiangling, I updated ClickHouse/clickhouse-java#815, test against your branch, and it's all green now :) Could you double check at your end and let me know if there's more issue? I'll need to run a few benchmarks tomorrow and I'll probably update the PR accordingly. If no other issue shows up, I'm going to release patch3 by tomorrow.

Also I want to take the chance to thank you all for your help and efforts for integrating the new driver. Please feel free to let me know how I can help to expedite.

Lastly, below are some items I think you guys may want to consider before closing this PR:

  1. dependency
    IMO, it's better to change clickhouse-jdbc dependency like below. You may change classifier to http if that's the only protocol you'll use.(grpc is supported in 0.3.2, and tcp will be added in 0.3.3).
<dependency>
    <groupId>com.clickhouse</groupId>
    <artifactId>clickhouse-jdbc</artifactId>
    <classifier>all</classifier>
    <version>0.3.2-patch3</version>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>
  1. delete and update
    The driver supports standard synchronous DELTE and UPDATE for single table. You may want to enable the feature in clickhouse connector accordingly. Actually fake transaction is supported as well but you probably don't want to enable that in trino to avoid confusion.

  2. update table creation script(e.g. WITH (engine = 'MergeTree', order_by = ARRAY['x']) -> engine = MergeTree order by x) and re-enable DDL test cases

@tangjiangling
Copy link
Copy Markdown
Member Author

Could you double check at your end and let me know if there's more issue?

I'll do that.

@tangjiangling
Copy link
Copy Markdown
Member Author

Could you double check at your end and let me know if there's more issue?

Great, I tested it and all results are also green. Thank you for doing this.

If no other issue shows up, I'm going to release patch3 by tomorrow.

I will update current PR as soon as the new patch3 is released.

@zhicwu
Copy link
Copy Markdown
Contributor

zhicwu commented Jan 25, 2022

Great, I tested it and all results are also green. Thank you for doing this.
I will update current PR as soon as the new patch3 is released.

Thanks for confirming. 0.3.2-patch3 is available in maven central now, cheers :)

@tangjiangling
Copy link
Copy Markdown
Member Author

I will update current PR as soon as the new patch3 is released.

I mistakenly deleted the branch corresponding to the current PR (both local and remote were overwritten) and now I can't seem to update the current PR.

@ebyhr All updates are in a new pr(#10801) and can be reviewed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Use com.clickhouse.jdbc.ClickHouseDriver in ClickHouse connector

5 participants