Skip to content

Error to cast String or BigInt when the column type is UInt64/Int128/UInt128/Int256/UInt256 on Nifi #2779

Description

@HanchiMed

Description

Steps to reproduce

  1. create a Clickhouse table with columns :

create table test
(
numliv UInt32,
cdc_changesequence UInt128
)
ENGINE = SharedReplacingMergeTree(cdc_changesequence)
ORDER BY (numliv)

  1. create à PutDatabaseRecord on Nifi

  2. Insert json with column cdc_changesequence filled by a BigInt

{"numliv" : 54878 , "cdc_changesequence " : 20260219145041580000000000403034229 }

Error Log or Exception StackTrace

Failed to put Records to database for FlowFile[filename=c797411d-7c71-4403-9f92-e204c26849a2]. Routing to failure.: java.io.IOException: Unable to setObject() with value 20260219145041580000000000403034240 at index 208 of type 1111

  • Caused by: java.sql.SQLException: Cannot convert OTHER to a ClickHouse one. Consider using java.sql.JDBCType or com.clickhouse.data.ClickHouseDataType
Image

Expected Behaviour

Insertion is functionnal in case of cdc_changesequence is typed as String or BigInt

cdc_changesequence as BigInt
{"numliv" : 54878 , "cdc_changesequence " : 20260219145041580000000000403034229 }

cdc_changesequence as BigInt
{"numliv" : 54878 , "cdc_changesequence " : "20260219145041580000000000403034229" }

Code Example

com.clickhouse.jdbc.JdbcTypeMapping:
public int toSqlType : .......
case UInt64:
case Int128:
case UInt128:
case Int256:
case UInt256:
sqlType = Types.NUMERIC;
break;

com.clickhouse.jdbc.internal.JdbcUtils:

private static Map<ClickHouseDataType, SQLType> generateTypeMap() { ...........
map.put(ClickHouseDataType.Int128, JDBCType.NUMERIC);
map.put(ClickHouseDataType.Int256, JDBCType.NUMERIC);
map.put(ClickHouseDataType.UInt64, JDBCType.NUMERIC);
map.put(ClickHouseDataType.UInt128, JDBCType.NUMERIC);
map.put(ClickHouseDataType.UInt256, JDBCType.NUMERIC);



Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions