StarRocks / starrocks

The world's fastest open query engine for sub-second analytics both on and off the data lakehouse. With the flexibility to support nearly any scenario, StarRocks provides best-in-class performance for multi-dimensional analytics, real-time analytics, and ad-hoc queries. A Linux Foundation project.
https://starrocks.io
Apache License 2.0
9.1k stars 1.82k forks source link

'0000-00-00 00:00:00' Date error in JDBC catalog connection. #47640

Open YoadBarok opened 4 months ago

YoadBarok commented 4 months ago

Background: When creating a JDBC catalog connection to a MySQL DB, and trying to select rows that have Date values of '0000-00-00 00:00:00' the "error: java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 0" is thrown.

Steps to reproduce the behavior (Required)

INSERT INTO
    my_table (
        id,
        date_column
        )
SELECT
    id,
    date_column
FROM
    ext_catalog.mysql_db.mysql_table;

Expected behavior (Required)

Our table should be populated with the data from the external catalog's table.

Real behavior (Required)

The above mentioned error is thrown

StarRocks version (Required)

Already tried the following:

INSERT INTO
    my_table (
        id,
        date_column
        )
SELECT
    id,
    CASE
    WHEN (
        MONTH(date_column) = 0
        OR YEAR(date_column) = 0
        OR DAY(date_column) = 0
    ) THEN NULL
    ELSE date_column
END AS date_column
FROM
    ext_catalog.mysql_db.mysql_table;

But still receiving the same error.

MariuszJurowicz commented 4 months ago

👍