apache / seatunnel

SeaTunnel is a next-generation super high-performance, distributed, massive data integration tool.
https://seatunnel.apache.org/
Apache License 2.0
7.75k stars 1.73k forks source link

[Bug] [Connectors-v2 CDC] SQLServer CDC Don't support SqlSever type 'uniqueidentifier' yet #6957

Open trhlxc opened 2 months ago

trhlxc commented 2 months ago

Search before asking

What happened

Tested sqlserver CDC function and found that SqlSever type ‘uniqueidentifier’ is not supported at the moment.

SeaTunnel Version

2.3.5

SeaTunnel Config

env {
  # You can set engine configuration here
  parallelism = 1
  job.mode = "STREAMING"
  checkpoint.interval = 5000
}

source {

  SqlServer-CDC {
    result_table_name = "customers"
    username = "xxx"
    password = "xxx@read"
    startup.mode = "initial"
    incremental.parallelism = "1"
    database-names = ["iplant"]
    table-names = ["iplant.dbo.SendSampleRecordtest"]
    base-url = "jdbc:sqlserver://172.161.11.51:1433;databaseName=iplant"
    }
}

transform {
}

sink {
    Doris {
        # Doris 连接信息
        fenodes = "172.161.11.61:8030"
        username = root
        password = ""
        database = "ODS"
        table = "ODS_TEST_${table_name}_CDC"

        # 其他通用配置
        sink.enable-delete = "true"
        schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
        data_save_mode = "APPEND_DATA"
        sink.label-prefix = "test_onetable"
        sink.enable-2pc = "true"

        # Doris 数据格式配置
        doris.config {
        format = "json"
        read_json_by_line = "true"
        }
    }  
}

Running Command

./bin/seatunnel.sh --config ./job/sqlservercdc2doris.config

Error Exception

Exception in thread "main" org.apache.seatunnel.core.starter.exception.CommandExecuteException: SeaTunnel job executed failed
        at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:199)
        at org.apache.seatunnel.core.starter.SeaTunnel.run(SeaTunnel.java:40)
        at org.apache.seatunnel.core.starter.seatunnel.SeaTunnelClient.main(SeaTunnelClient.java:34)
Caused by: org.apache.seatunnel.engine.common.exception.SeaTunnelEngineException: java.lang.RuntimeException: Generate Splits for table iplant.dbo.SendSampleRecordtest error
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.splitter.AbstractJdbcSourceChunkSplitter.generateSplits(AbstractJdbcSourceChunkSplitter.java:112)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.SnapshotSplitAssigner.getNext(SnapshotSplitAssigner.java:181)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.HybridSplitAssigner.getNext(HybridSplitAssigner.java:94)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.IncrementalSourceEnumerator.assignSplits(IncrementalSourceEnumerator.java:160)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.IncrementalSourceEnumerator.run(IncrementalSourceEnumerator.java:69)
        at org.apache.seatunnel.engine.server.task.SourceSplitEnumeratorTask.stateProcess(SourceSplitEnumeratorTask.java:307)
        at org.apache.seatunnel.engine.server.task.SourceSplitEnumeratorTask.call(SourceSplitEnumeratorTask.java:134)
        at org.apache.seatunnel.engine.server.TaskExecutionService$BlockingWorker.run(TaskExecutionService.java:643)
        at org.apache.seatunnel.engine.server.TaskExecutionService$NamedTaskWrapper.run(TaskExecutionService.java:944)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:750)
Caused by: java.lang.UnsupportedOperationException: Don't support SqlSever type 'uniqueidentifier' yet, jdbcType:'1'.
        at org.apache.seatunnel.connectors.seatunnel.cdc.sqlserver.source.utils.SqlServerTypeUtils.convertFromColumn(SqlServerTypeUtils.java:126)
        at org.apache.seatunnel.connectors.seatunnel.cdc.sqlserver.source.source.eumerator.SqlServerChunkSplitter.fromDbzColumn(SqlServerChunkSplitter.java:92)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.splitter.JdbcSourceChunkSplitter.isEvenlySplitColumn(JdbcSourceChunkSplitter.java:133)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.splitter.AbstractJdbcSourceChunkSplitter.getSplitColumn(AbstractJdbcSourceChunkSplitter.java:392)
        at org.apache.seatunnel.connectors.cdc.base.source.enumerator.splitter.AbstractJdbcSourceChunkSplitter.generateSplits(AbstractJdbcSourceChunkSplitter.java:64)
        ... 13 more

        at org.apache.seatunnel.core.starter.seatunnel.command.ClientExecuteCommand.execute(ClientExecuteCommand.java:191)
        ... 2 more

Zeta or Flink or Spark Version

zate

Java or Scala Version

java1.8

Screenshots

No response

Are you willing to submit PR?

Code of Conduct

zhangshenghang commented 2 months ago

I can try to fix it, please assign me

trhlxc commented 2 months ago

@zhangshenghang

I can try to fix it, please assign me

Please add the following types: uniqueidentifier, xml, user_defined and sql_variant

zhangshenghang commented 1 month ago

@zhangshenghang

I can try to fix it, please assign me

Please add the following types: uniqueidentifier, xml, user_defined and sql_variant

@trhlxc This issue has been fixed:#5872