You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/07/10 07:49:49 UTC

[GitHub] [incubator-seatunnel] wry13172 opened a new issue, #2154: Sink Jdbc duplicateIncs Error

wry13172 opened a new issue, #2154:
URL: https://github.com/apache/incubator-seatunnel/issues/2154

   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/incubator-seatunnel/issues?q=is%3Aissue+label%3A%22bug%22) and found no similar issues.
   
   
   ### What happened
   
   **Description**
   
   ## duplicateIncs [string]
   Configure when `saveMode` is specified as `update` , and when the specified key conflicts, the value is updated to the existing value plus the original value
   
   table:
   CREATE TABLE `blanca_test` (
     `aml_type` varchar(64) NOT NULL COMMENT 'xxx',
     `import_type` varchar(128) DEFAULT NULL,
     `type` varchar(128) DEFAULT NULL COMMENT 'xx',
     PRIMARY KEY (`aml_type`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='xxx'
   
   my conf  file:
   sink {
     Jdbc {
       ignore other......
       duplicateIncs = "aml_type, import_type"
     }
   
   source code => org.apache.spark.sql.execution.datasources.jdbc2.JdbcUtils
   line 176
   if (duplicateIncs.contains(name)) s"$name=$name+VALUES($name)"
   
   so my final sql is ==>>
   INSERT INTO blanca_test (aml_type,import_type, TYPE) VALUES ('cdk_ded_tax','03_GYEYLIST','11111') ON DUPLICATE KEY
   UPDATE aml_type=aml_type+ VALUES(aml_type),import_type=import_type+ VALUES(import_type), TYPE= VALUES(TYPE);
   
   The error is as follows while stmt.executeBatch() :
    Data truncation: Truncated incorrect FLOAT value: cdk_ded_tax
   
   How to solve this problem?
   
   modify:
   if (duplicateIncs.contains(name)) s"$name=$name+VALUES($name)"
   to
   if (duplicateIncs.contains(name)) s"$name=concat ($name, VALUES($name))"
   
   Will this fix the problem?
   
   
   
   
   
   
   ### SeaTunnel Version
   
   2.1
   
   ### SeaTunnel Config
   
   ```conf
   sink {
     Jdbc {
       ignore other......
       duplicateIncs = "aml_type, import_type"
     }
   ```
   
   
   ### Running Command
   
   ```shell
   xx
   ```
   
   
   ### Error Exception
   
   ```log
   Data truncation: Truncated incorrect FLOAT value:
   ```
   
   
   ### Flink or Spark Version
   
   _No response_
   
   ### Java or Scala Version
   
   _No response_
   
   ### Screenshots
   
   _No response_
   
   ### 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)
   


-- 
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: commits-unsubscribe@seatunnel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org