seatunnel icon indicating copy to clipboard operation
seatunnel copied to clipboard

How to set multiple sources at same time in one task

Open lingtaolf opened this issue 3 years ago • 6 comments

Hi all: I use seatunnel to fetch data from multiple hive sources and write them to clickhouse. But the result is only the first table in source have been write to clickhouse. And I'm sure all other hive tables have data. My config file is just like below:

env {
  spark.app.name = "seatunnel_2023-02-01"
  spark.driver.cores = 2
  spark.rpc.message.maxSize = 2047
  spark.executor.instances = 200 
  spark.driver.maxResultSize="5g"
  spark.driver.memory = "20g"
  spark.executor.cores = 5 
  spark.executor.memory = "10g"
  spark.sql.catalogImplementation = "hive"
}

source {
    hive {
      pre_sql = "select .... from A'" 
      parallelism = 6 
      table_name = "A"
      metastore_uri = "xxxxx"
      result_table_name = "result_table_A"
    }
    hive {
      pre_sql = "select .... from B" 
      parallelism = 6 
      table_name = "B"
      metastore_uri = "xxxxx"
      result_table_name = "result_table_B"
    }
transform {}

sink {
    clickhouse {
        host = "1xxxx" 
        database = "xx"
        table = "sink_table"
        fields = [....]
        username = "default"
        password = "default"
        bulk_size = 4000000
        clickhouse.socket_timeout = 300000
        clickhouse.connection_timeout = 300000
        clickhouse.dataTransferTimeout = 300000
        retry = 3
    }
}

I don't know why. Could someone help me ?
Thx! Btw, The seatunnel version I used is 2.1.3.

lingtaolf avatar Mar 13 '23 07:03 lingtaolf

maybe it not supported

laglangyue avatar Mar 13 '23 08:03 laglangyue

maybe it not supported

@laglangyue But, I‘ve read the doc for 2.1.3, it says ' Multiple sources can be defined at the same time'. I'm not sure it can work correctly.

lingtaolf avatar Mar 14 '23 02:03 lingtaolf

I think your sink part should be:

sink {
    clickhouse {
        host = "1xxxx" 
        database = "xx"
        table = "sink_table"
        fields = [....]
        username = "default"
        password = "default"
        bulk_size = 4000000
        clickhouse.socket_timeout = 300000
        clickhouse.connection_timeout = 300000
        clickhouse.dataTransferTimeout = 300000
        retry = 3
        source_table_name= result_table_A
    }
    clickhouse {
        host = "1xxxx" 
        database = "xx"
        table = "sink_table"
        fields = [....]
        username = "default"
        password = "default"
        bulk_size = 4000000
        clickhouse.socket_timeout = 300000
        clickhouse.connection_timeout = 300000
        clickhouse.dataTransferTimeout = 300000
        retry = 3
        source_table_name= result_table_B
    }
}

zorrofox avatar Mar 17 '23 15:03 zorrofox

as zorrofox said,your source table is result_table_A and result_table_B

laglangyue avatar Mar 18 '23 08:03 laglangyue

@zorrofox @laglangyue ok, I will try. Thanks

lingtaolf avatar Mar 20 '23 03:03 lingtaolf

It works. Thanks again!

lingtaolf avatar Mar 21 '23 02:03 lingtaolf