apache / apache/doris-flink-connector
[Bug] Text '0000-00-00' could not be parsed: Invalid value for MonthOfYear
- Dominant language
- Java
- Stars
- 385
- Forks
- 279
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 6
Description
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/incubator-doris/issues?q=is%3Aissue) and found no similar issues.
### Version
flink-doris-connector-1.17-1.5.2.jar
doris-2.0.3-rc06-37d31a5
mysql5.7
flink-sql-connector-mysql-cdc-2.4.0.jar
### What's Wrong?
`
CREATE TABLE IF NOT EXISTS `xxx`.`asku`(
`id` LARGEINT,
`date` DATEV2 DEFAULT '0000-00-00',
`k` VARCHAR(192) DEFAULT '',
`store_id` LARGEINT DEFAULT '0',
`sku_id` LARGEINT DEFAULT '0',
`product_id` LARGEINT DEFAULT '0',
`tenant_id` VARCHAR(36) DEFAULT '',
`day_quantity_ordered` INT DEFAULT '0',
`day7_quantity_ordered` INT DEFAULT '0',
`day14_quantity_ordered` INT DEFAULT '0',
`day30_quantity_ordered` INT DEFAULT '0',
`week_quantity_ordered` INT DEFAULT '0',
`month_quantity_ordered` INT DEFAULT '0',
`today_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`day7_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`day14_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`day30_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`week_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`month_total_price` DECIMALV3(20,2) DEFAULT '0.00',
`today_tax` DECIMALV3(20,2) DEFAULT '0.00',
`shipping_price` DECIMALV3(20,2) DEFAULT '0.00',
`shipping_tax` DECIMALV3(20,2) DEFAULT '0.00',
`gift_wrap_price` DECIMALV3(20,2) DEFAULT '0.00',
`gift_wrap_tax` DECIMALV3(20,2) DEFAULT '0.00',
`promotion_discount` DECIMALV3(20,2) DEFAULT '0.00',
`ship_promotion_discount` DECIMALV3(20,2) DEFAULT '0.00',
`can_sale_quantity` INT DEFAULT '0',
`fba_on_way_quantity` INT DEFAULT '0',
`fba_contains_on_way_quantity` INT DEFAULT '0',
`working_quantity` INT DEFAULT '0',
`inv_age_three_months_less_days` INT DEFAULT '0',
`inv_age_three_six_months_days` INT DEFAULT '0',
`inv_age_six_nine_months_days` INT DEFAULT '0',
`inv_age_nine_twelve_months_days` INT DEFAULT '0',
`inv_age_twelve_months_plus_days` INT DEFAULT '0',
`inv_age_earlier_six_month` INT DEFAULT '0',
`afn_unsellable_quantity` INT DEFAULT '0',
`mfn_fulfillable_quantity` INT DEFAULT '0',
`afn_warehouse_quantity` INT DEFAULT '0',
`afn_fulfillable_quantity` INT DEFAULT '0',
`afn_reserved_quantity` INT DEFAULT '0',
`afn_total_quantity` INT DEFAULT '0',
`afn_inbound_receiving_quantity` INT DEFAULT '0',
`reserved_qty` INT DEFAULT '0',
`reserved_customer_orders` INT DEFAULT '0',
`reserved_fc_transfers` INT DEFAULT '0',
`reserved_fc_processing` INT DEFAULT '0'
) UNIQUE KEY(`id`) DISTRIBUTED BY HASH(`id`) BUCKETS AUTO PROPERTIES ('replication_num'='1','light_schema_change'='true');
at org.apache.doris.flink.catalog.doris.DorisSystem.execute(DorisSystem.java:131)
at org.apache.doris.flink.catalog.doris.DorisSystem.createTable(DorisSystem.java:122)
at org.apache.doris.flink.tools.cdc.DatabaseSync.build(DatabaseSync.java:145)
at org.apache.doris.flink.tools.cdc.CdcTools.syncDatabase(CdcTools.java:146)
at org.apache.doris.flink.tools.cdc.CdcTools.createMySQLSyncDatabase(CdcTools.java:74)
at org.apache.doris.flink.tools.cdc.CdcTools.main(CdcTools.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.flink.client.program.PackagedProgram.callMainMethod(PackagedProgram.java:355)
... 12 more
Caused by: java.sql.SQLException: errCode = 2, detailMessage = date literal [0000-00-00] is invalid: Text '0000-00-00' could not be parsed: Invalid value for MonthOfYear (valid values 1 - 12): 0
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:763)
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:648)
at org.apache.doris.flink.catalog.doris.DorisSystem.execute(DorisSystem.java:128)
... 22 more
`
### What You Expected?
希望能兼容default的格式。有些人确实有些0000-00-00的习惯。
### How to Reproduce?
_No response_
### Anything Else?
_No response_
### Are you willing to submit PR?
- [ ] 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)
Contributor guide
Research direction
Start with the failing DDL and stack trace, especially DorisSystem.java:131 and createTable, then trace the CREATE TABLE path through DatabaseSync.build and CdcTools. Reproduce the DATEV2 default of '0000-00-00' with the listed connector and Doris versions. Done means the stated default format is handled compatibly without the reported parsing error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100