You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's a reopening of #2125 that i closed by mistake.
The #2022 hasn't brought full support for simple aggregate functions. When using ClickHouseBinaryFormatReader to read query response. If the table contains a column with SimpleAggregateFunctions using functions like getLong returns an error message saying that:
Column counter SimpleAggregateFunction cannot be converted to long
This error seems to be also present for jdbc:
Caused by: com.clickhouse.client.api.ClientException: Column counter SimpleAggregateFunction cannot be converted to long
at com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.readNumberValue(AbstractBinaryFormatReader.java:312) ~[jdbc-v2-0.8.0.jar:jdbc-v2 0.8.0 (revision: 5b5ac2e)]
at com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.getLong(AbstractBinaryFormatReader.java:333) ~[jdbc-v2-0.8.0.jar:jdbc-v2 0.8.0 (revision: 5b5ac2e)]
at com.clickhouse.jdbc.ResultSetImpl.getLong(ResultSetImpl.java:293) ~[jdbc-v2-0.8.0.jar:clickhouse-jdbc 0.8.0 (revision: 5b5ac2e)]
The issue seems to be in the AbstractBinaryFormatReader.java class. A lots of functions are using column.getDataType() to determine what type of object is being read. But the implementation make that for a simpleAggregateFunction the column.getDataType always returns SimpleAggregateFunction, which makes that all functions using this are ending up in the default case.
Code example
This test is just adapted from the test case added in the #2022
com.clickhouse.client.api.ClientException: Column lowest_value SimpleAggregateFunction cannot be converted to short
at com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.readNumberValue(AbstractBinaryFormatReader.java:312)
at com.clickhouse.client.api.data_formats.internal.AbstractBinaryFormatReader.getShort(AbstractBinaryFormatReader.java:323)
at com.clickhouse.client.query.QueryTests.testReadingSimpleAggregateFunction2(QueryTests.java:1980)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:569)
at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:136)
at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:658)
at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:219)
at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:923)
at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:192)
at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:808)
at org.testng.TestRunner.run(TestRunner.java:603)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
at org.testng.SuiteRunner.run(SuiteRunner.java:326)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
at org.testng.TestNG.runSuites(TestNG.java:1092)
at org.testng.TestNG.run(TestNG.java:1060)
at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:65)
at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:105
The text was updated successfully, but these errors were encountered:
Describe the bug
It's a reopening of #2125 that i closed by mistake.
The #2022 hasn't brought full support for simple aggregate functions. When using ClickHouseBinaryFormatReader to read query response. If the table contains a column with SimpleAggregateFunctions using functions like getLong returns an error message saying that:
This error seems to be also present for jdbc:
The issue seems to be in the
AbstractBinaryFormatReader.java class
. A lots of functions are usingcolumn.getDataType()
to determine what type of object is being read. But the implementation make that for a simpleAggregateFunction thecolumn.getDataType
always returns SimpleAggregateFunction, which makes that all functions using this are ending up in the default case.Code example
This test is just adapted from the test case added in the #2022
Error log
The text was updated successfully, but these errors were encountered: