clickhouse-java
clickhouse-java copied to clipboard
jdbc isn't allows to insert shorter string into FixedString field
The field declared as FixedString(2)
CREATE TABLE test
(
country FixedString(2)
)
ENGINE = MergeTree()
PRIMARY KEY (country)
ORDER BY (country)
;
If we tried to insert data in SQL, its work fine:
INSERT INTO test VALUES('C')
And will selecting it back
SELECT * FROM test WHERE country = 'C'
But jdbc driver isn't allow it:
Caused by: java.lang.IllegalArgumentException: length of byte array value is 1, but it should be 2
at com.clickhouse.client.ClickHouseChecker.newException(ClickHouseChecker.java:19) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.ClickHouseChecker.notWithDifferentLength(ClickHouseChecker.java:382) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.ClickHouseChecker.notWithDifferentLength(ClickHouseChecker.java:364) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.data.ClickHouseStringValue.asBinary(ClickHouseStringValue.java:230) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.ClickHouseValue.asBinary(ClickHouseValue.java:569) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.data.ClickHouseRowBinaryProcessor$MappedFunctions.lambda$buildMappingsForDataTypes$63(ClickHouseRowBinaryProcessor.java:334) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.client.data.ClickHouseRowBinaryProcessor$MappedFunctions.serialize(ClickHouseRowBinaryProcessor.java:486) ~[clickhouse-cli-client-0.3.2-patch11-shaded.jar:clickhouse-cli-client 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.addBatch(InputBasedPreparedStatement.java:333) ~[clickhouse-jdbc-0.3.2-patch11.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.executeAny(InputBasedPreparedStatement.java:110) ~[clickhouse-jdbc-0.3.2-patch11.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.jdbc.internal.InputBasedPreparedStatement.executeLargeUpdate(InputBasedPreparedStatement.java:185) ~[clickhouse-jdbc-0.3.2-patch11.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
at com.clickhouse.jdbc.internal.AbstractPreparedStatement.executeUpdate(AbstractPreparedStatement.java:135) ~[clickhouse-jdbc-0.3.2-patch11.jar:clickhouse-jdbc 0.3.2-patch11 (revision: 27f8951)]
Hi @TheHett, yes it's too restrict. Will fix it later today.
Hi, will this fix be released with a 0.3.2-patch version?
Hi, will this fix be released with a 0.3.2-patch version?
Hi @mkeckmkeck, could you use nightly build for now? As legacy driver being removed in develop branch , the next release will be 0.3.3.
Fixed in v0.4 and above.