[Bug] clickhouse 作为source时报空指针
- Dominant language
- Java
- Stars
- 4.1k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Search before asking
- [X] I had searched in the [issues](https://github.com/DTStack/chunjun/issues) and found no similar issues.
### What happened
看到之前的issue已经处理过这样的问题,https://github.com/DTStack/chunjun/pull/1450;
我的代码已经是1.12最新的代码,重新拉的新项目;
在运行mysql-clickhouse是时是没问题的;
运行clickhouse-clickhouse报空指针:
### What you expected to happen
`2023-06-14 17:20:41,277 - 4960 ERROR [Legacy Source Thread - Source: clickhousesourcefactory -> Sink: clickhousesinkfactory (1/1)#0] com.dtstack.chunjun.source.DtInputFormatSourceFunction:Exception happened, start to close format
java.lang.NullPointerException
at com.dtstack.chunjun.connector.jdbc.source.JdbcInputFormat.executeQuery(JdbcInputFormat.java:680)
at com.dtstack.chunjun.connector.clickhouse.source.ClickhouseInputFormat.openInternal(ClickhouseInputFormat.java:55)
at com.dtstack.chunjun.source.format.BaseRichInputFormat.open(BaseRichInputFormat.java:162)
at com.dtstack.chunjun.source.DtInputFormatSourceFunction.run(DtInputFormatSourceFunction.java:126)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110)
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:66)
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:267)`
我的json:
`{
"job": {
"content": [
{
"reader": {
"parameter" : {
"customSql" : "",
"startLocation" : "",
"increColumn" : "",
"column" : [
{
"name" : "id",
"type" : "INT",
"key" : "id"
}, {
"name" : "name",
"type" : "STRING",
"key" : "name"
}
],
"connection" : [ {
"sourceId" : 11,
"jdbcUrl" : [ "jdbc:clickhouse://ip:8123/default" ],
"type" : 1,
"table" : [ "test" ]
} ],
"username" : "default",
"password" : "admin1234",
"splitPk" : "",
"sourceIds" : [ 10 ]
},
"name" : "clickhousereader"
},
"writer" : {
"parameter" : {
"column" : [ {
"name" : "id",
"index" : 0,
"isPart" : false,
"type" : "int",
"key" : "id"
}
, {
"name" : "name",
"index" : 1,
"isPart" : false,
"type" : "string",
"key" : "name"
}
],
"writeMode" : "insert",
"encoding" : "utf-8",
"fullColumnName" : [ "id", "name"],
"connection" : [ {
"jdbcUrl" : "jdbc:clickhouse://ip:8123/default",
"table" : [ "test1" ]
} ],
"sourceIds" : [ 2 ],
"password" : "admin1234",
"username" : "default",
"fullColumnType" : [ "INT", "STRING"]
},
"name" : "clickhousewriter"
}
}
],
"setting": {
"speed": {
"channel": 1,
"bytes": 0
}
}
}
}`
source的建表语句:
CREATE TABLE default.test
(
`id` Int32,
`name` String
)
ENGINE = MergeTree
PRIMARY KEY (id,
name)
ORDER BY (id,
name)
SETTINGS index_granularity = 8192;
### How to reproduce
按照提供的json和sql即可
### Anything else
_No response_
### Version
1.12_release
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Assessment
This issue has not been assessed yet.