Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jdbc catalog - error read datetime column #45175

Open
maulanaady opened this issue May 7, 2024 · 3 comments
Open

jdbc catalog - error read datetime column #45175

maulanaady opened this issue May 7, 2024 · 3 comments
Labels
type/bug Something isn't working

Comments

@maulanaady
Copy link

maulanaady commented May 7, 2024

I have table in mariadb server with datetime columns, when I query it using mysql client, it shows the row, but when I query it using starrocks via jdbc catalog (I used mysql client, too), it shows errors.

Steps to reproduce the behavior (Required)

  1. My DDL table in mariadb:
    CREATE TABLE mydb.mytable (
    ID int(11) NOT NULL,
    INVOICE_TYPE varchar(30) NOT NULL,
    INVOICE_DATE datetime DEFAULT NULL,
    DUE_DATE datetime DEFAULT NULL,
    DATE_CREATED datetime NOT NULL DEFAULT current_timestamp(),
    DATE_MODIFIED datetime DEFAULT NULL,
    MODIFIED_BY varchar(50) DEFAULT NULL,
    PAYMENT_DATE datetime DEFAULT NULL,
    PROFORMA_DATE datetime DEFAULT NULL,
    FLAG_TERMIN varchar(5) DEFAULT NULL,
    PRIMARY KEY (ID)
    ) ENGINE=InnoDB;

  2. insert into `mydb.mytable` values (291860,"1",'2023-11-05 00:00:00','2023-12-01 00:00:00', '2023-11-02 13:30:43','2023-12-04 13:25:34','dummy_name','0000-00-00 00:00:00',NULL,NULL);

  3. Create jdbc catalog:
    CREATE EXTERNAL CATALOG mariadb
    PROPERTIES (
    "type"="jdbc",
    "user"="myuser",
    "password"="mypassword",
    "jdbc_uri"="jdbc:mysql://host:port",
    "driver_url"="https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.28/mysql-connector-java-8.0.28.jar",
    "driver_class"="com.mysql.cj.jdbc.Driver"
    );

  4. SELECT mariadb.mydb.mytable :

Expected behavior:

+--------+--------------+---------------------+---------------------+---------------------+---------------------+-------------+---------------------+---------------+-------------+
| ID | INVOICE_TYPE | INVOICE_DATE | DUE_DATE | DATE_CREATED | DATE_MODIFIED | MODIFIED_BY | PAYMENT_DATE | PROFORMA_DATE | FLAG_TERMIN |
+--------+--------------+---------------------+---------------------+---------------------+---------------------+-------------+---------------------+---------------+-------------+
| 291860 | 1 | 2023-11-05 00:00:00 | 2023-12-01 00:00:00 | 2023-11-02 13:30:43 | 2023-12-04 13:25:34 | dummy_name | 0000-00-00 00:00:00 | NULL | NULL |
+--------+--------------+---------------------+---------------------+---------------------+---------------------+-------------+---------------------+---------------+-------------+

Real behavior:

SQL Error [1064] [42000]: getNextChunk failed, error: java.sql.SQLException: Zero date value prohibited[com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129), com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97), com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89), com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63), com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73), com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:99), com.mysql.cj.jdbc.result.ResultSetImpl.getObject(ResultSetImpl.java:1285), com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java), com.starrocks.jdbcbridge.JDBCScanner.getNextChunk(JDBCScanner.java:145)]

StarRocks version

  • 3.1.9
@maulanaady maulanaady added the type/bug Something isn't working label May 7, 2024
@zombee0
Copy link
Contributor

zombee0 commented May 7, 2024

could you add ?ZeroDateTimeBehavior=convertToNull to jdbc_uri and it's supported from 3.1.10

@maulanaady maulanaady reopened this May 7, 2024
@maulanaady maulanaady reopened this May 8, 2024
@maulanaady
Copy link
Author

same issue already sent before my post, #24277

@maulanaady maulanaady reopened this May 8, 2024
@zombee0
Copy link
Contributor

zombee0 commented May 15, 2024

have you upgrade to 3.1.10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants