SEPURI-SAI-KRISHNA opened a new issue, #13188:
URL: https://github.com/apache/seatunnel/issues/13188

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Bug%22)
 and found no similar issues. This is the follow-up promised on #13040, which 
fixed the same type for schema changes only (#13038). The review of #13040 
raised it as Issue 1. #13072 (docs) changes the `TIME` row of the sink docs, 
but no PR changes the code.
   
   ### What happened
   
   A Databend sink job with a `TIME` column fails, even though 
`DatabendTypeConverter` has mapped `TIME` to `STRING` since #13040. It can fail 
in two places:
   
   1. **Creating the table.** With `schema_save_mode = 
CREATE_SCHEMA_WHEN_NOT_EXIST`, the table is created by 
`DatabendCatalog.createTable`, and `DatabendCatalog.toDatabendTypeString` still 
returns `TIME` for a `TIME` column. Databend has no `TIME` type, as #13038 
describes, so the `CREATE TABLE` cannot parse.
   2. **Writing the row.** Outside CDC mode, `DatabendSinkWriter.processRow` 
passes each value to `PreparedStatement.setObject`. A `TIME` value is a 
`java.time.LocalTime`, and databend-jdbc 0.3.7 rejects it.
   
   I checked the second point by calling the real driver's 
`DatabendPreparedStatement.setObject` with the value classes SeaTunnel uses (no 
server is needed, since the check runs before any request):
   
   | Value | Result |
   |---|---|
   | `String` | accepted |
   | `java.time.LocalDate` | accepted |
   | `java.time.LocalTime` | `SQLException: Unsupported object type: 
java.time.LocalTime` |
   | `java.time.LocalDateTime` | `SQLException: Unsupported object type: 
java.time.LocalDateTime` |
   
   So fixing only the `CREATE TABLE` would still fail the job at the first row. 
The `LocalDateTime` row means `TIMESTAMP` columns fail the same way outside CDC 
mode. That is a separate problem, and I will raise it separately.
   
   No E2E in `connector-databend-e2e` writes a `TIME` or `TIMESTAMP` value 
through the sink, which is why neither path was caught.
   
   I would like to submit a PR that maps `TIME` to `STRING` in 
`DatabendCatalog`, as #13040 did in `DatabendTypeConverter`, and writes a 
`LocalTime` as text.
   
   ### SeaTunnel Version
   
   dev (f54bb5876b)
   
   ### SeaTunnel Config
   
   ```conf
   env {
     parallelism = 1
     job.mode = "BATCH"
   }
   
   source {
     FakeSource {
       schema {
         fields {
           id = int
           start_time = time
         }
       }
       rows = [
         { kind = INSERT, fields = [1, "08:00:00"] }
       ]
     }
   }
   
   sink {
     Databend {
       url = "jdbc:databend://localhost:8000/default"
       username = "root"
       password = ""
       database = "default"
       table = "time_sink_table"
       schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
       data_save_mode = "APPEND_DATA"
     }
   }
   ```
   
   ### Running Command
   
   ```shell
   ./bin/seatunnel.sh --config time_to_databend.conf -m local
   ```
   
   ### Error Exception
   
   ```log
   The driver error, from the call above:
   java.sql.SQLException: Unsupported object type: java.time.LocalTime
   
   I could not run the job against a Databend server, because I have no Docker 
here, so I do not
   quote the CREATE TABLE error. For the config above, the statement the 
catalog builds names
   the column as `start_time TIME`.
   ```
   
   ### Zeta or Flink or Spark Version
   
   Not engine specific. Both points are in the connector.
   
   ### Java or Scala Version
   
   Not version specific.
   
   ### 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: [email protected]

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

  • [I] [Bug][Connector-V2][Databe... SEPURI-SAI-KRISHNA (via GitHub) via commits

Reply via email to