[ https://issues.apache.org/jira/browse/IGNITE-23297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Vladimir Steshin updated IGNITE-23297: -------------------------------------- Ignite Flags: Release Notes Required (was: Docs Required,Release Notes Required) > Calcite. String TIMESTAMP value is not cased when passed as a dynamic > parameter. > -------------------------------------------------------------------------------- > > Key: IGNITE-23297 > URL: https://issues.apache.org/jira/browse/IGNITE-23297 > Project: Ignite > Issue Type: Bug > Reporter: Vladimir Steshin > Priority: Major > > Looks wierd that a string value is not casted to a TIMESTAMP when passed as a > dynamic parameter but is casted as a literal. > Reproducer: > {code:java} > public void testTimestampWithDynamicStringParam(){ > sql("CREATE TABLE test2 (val TIMESTAMP)"); > // OK > assertQuery("INSERT INTO test2 VALUES ('2024-05-21 > 12:00:00')").check(); > assertQuery("INSERT INTO test2 VALUES (CAST('2024-05-21 12:00:00' AS > VARCHAR))").check(); > assertQuery("INSERT INTO test2 VALUES (1727370292791)").check(); > assertQuery("INSERT INTO test2 VALUES (CAST(1727370292791 AS > BIGINT))").check(); > assertQuery("INSERT INTO test2 VALUES > (?)").withParams(LocalDateTime.now()).check(); > assertQuery("INSERT INTO test2 VALUES (?)").withParams(new > Date()).check(); > assertQuery("INSERT INTO test2 VALUES (?)").withParams(new > Time(System.currentTimeMillis())).check(); > // OK > assertQuery("SELECT CAST('2024-05-21 12:00:00' AS > TIMESTAMP)").check(); > assertQuery("SELECT CAST(1727370292791 AS TIMESTAMP)").check(); > assertQuery("SELECT CAST(? AS > TIMESTAMP)").withParams(LocalDateTime.now()).check(); > // Fails > assertQuery("INSERT INTO test2 VALUES (?)").withParams("2024-05-21 > 12:00:00").check(); > assertQuery("INSERT INTO test2 VALUES (?)").withParams("'2024-05-21 > 12:00:00'").check(); > assertQuery("SELECT CAST(? AS TIMESTAMP)").withParams("'2024-05-21 > 12:00:00'").check(); > assertQuery("SELECT CAST(? AS TIMESTAMP)").withParams("2024-05-21 > 12:00:00").check(); > // Fails (worked with a long above too) > assertQuery("INSERT INTO test2 VALUES > (?)").withParams(1727370292791L).check(); > assertQuery("SELECT CAST(? AS > TIMESTAMP)").withParams(1727370292791L).check(); > } > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)