[Bug] [chunjun-connector-jdbc-base] binlog2mysql报IndexOutOfBoundsException错误
- 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
binlog2mysql报IndexOutOfBoundsException错误,debug发现:
dynamicPreparedStmt.getColumnNameList()方法添加的ColumnNameList元素不是表的字段,只有before和after两个无关的属性
,
导致在dynamicPreparedStmt.getColumnMeta()中此段逻辑报错(before和after不是目标表的字段,获取的index为-1,报IndexOutOfBoundsException异常)
for (String columnName : columnNameList) {
int index = nameList.indexOf(columnName);
columnTypeList.add(typeList.get(index));
}

### What you expected to happen
cdc实时采集成功
### How to reproduce
{
"job": {
"content": [
{
"reader": {
"parameter": {
"password": "Pwd@1234_Cmict",
"port": 33061,
"cat": "insert,update,delete",
"host": "10.136.106.163",
"jdbcUrl": "jdbc:mysql://10.136.106.163:33061/sgw_test",
"column": [
{
"name": "test_int",
"type": "int"
},
{
"name": "test_float",
"type": "float"
},
{
"name": "test_double",
"type": "double"
},
{
"name": "test_varchar",
"type": "varchar"
},
{
"name": "test_char",
"type": "char"
},
{
"name": "test_datetime",
"type": "datetime"
}
],
"start": {},
"pavingData": false,
"table": [
"sgw_test.src_test_table"
],
"username": "root"
},
"name": "binlogreader"
},
"writer": {
"parameter": {
"password": "Pwd@1234_Cmict",
"updateKey": {
"updateKey": [
"test_int"
]
},
"column": [
{
"name": "test_int",
"type": "int"
},
{
"name": "test_float",
"type": "float"
},
{
"name": "test_double",
"type": "double"
},
{
"name": "test_varchar",
"type": "varchar"
},
{
"name": "test_char",
"type": "char"
},
{
"name": "test_datetime",
"type": "datetime"
}
],
"connection": [
{
"jdbcUrl": "jdbc:mysql://10.136.106.163:33061/sgw_test",
"table": [
"sgw_test.sink_test_table"
]
}
],
"writeMode": "insert",
"batchSize": 1024,
"flushIntervalMills": 10,
"username": "root"
},
"name": "mysqlwriter"
}
}
],
"setting": {
"speed": {
"channel": 1,
"readerChannel": 1,
"writerChannel": 1,
"bytes": -1048576
},
"restore": {
"isRestore": true,
"isStream": true
}
}
}
}
### Anything else
_No response_
### Version
master
### 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.