yuangjiang commented on issue #963:
URL: 
https://github.com/apache/incubator-seatunnel/issues/963#issuecomment-1048464838


   this is a spark datasource using by seatunnel connector  test code like this 
   
   
   object DebeziumTest {
     def main(args: Array[String]): Unit = {
       val sparkSession = SparkSession
         .builder()
         .master("local[3]")
         .appName("debezium")
         .getOrCreate()
   
       val structType =
         StructType(
             StructField("a", StringType, nullable = true) ::
             StructField("b", DecimalType(6,2), nullable = true) ::
             StructField("c", DecimalType(22,0), nullable = true) ::
             StructField("d", DecimalType(6,0), nullable = true) ::
             StructField("e", DecimalType(22,0), nullable = true) ::
             StructField("f", DecimalType(6,0), nullable = true) ::
               StructField("g", DecimalType(22,0), nullable = true)::
             StructField("h", StringType, nullable = true) ::
             StructField("op", StringType, nullable = true) ::
             StructField("ts_ms", StringType, nullable = true) ::
               Nil
         )
   
       val parameters = new util.HashMap[String,String]()
       parameters.put("database.hostname","localhost")
       parameters.put("database.port","3306")
       parameters.put("database.user","root")
       parameters.put("database.password","123456")
       parameters.put("database.include.list","test")
       parameters.put("snapshot.mode","schema_only")
       parameters.put("table.include.list","temp.ts_cdc_test")
       
parameters.put("connector.class","io.debezium.connector.mysql.MySqlConnector")
       val dataFrame = sparkSession
          .readStream
         .options(parameters)
          .schema(structType)
          
.format("org.apache.spark.sql.execution.streaming.debezium.DefaultSource")
          .load()
   
       dataFrame.createOrReplaceTempView("test")
       sparkSession.sql("select * from test")
         .writeStream
         .format("console")
         .outputMode(OutputMode.Append())
         .start()
         .awaitTermination()
     }
   }
   
   can support all debezium connetcor by seatunnel stream mode


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to