You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Evgeny Stanilovsky (Jira)" <ji...@apache.org> on 2023/03/30 06:21:00 UTC
[jira] [Updated] (IGNITE-19162) Sql. Trim all less than millisecond information from timestamp.
[ https://issues.apache.org/jira/browse/IGNITE-19162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Evgeny Stanilovsky updated IGNITE-19162:
----------------------------------------
Description:
Trim useful timestamp part:
{noformat}
CREATE TABLE timestamps(id INTEGER PRIMARY KEY, i TIMESTAMP(9));
INSERT INTO timestamps VALUES (101, TIMESTAMP '2023-03-29 08:22:33.005007');
SELECT i from timestamps; <--- expect inserted, obtain trimmed : 2023-03-29 08:22:33.005
{noformat}
The root cause :
RelJson#toJson() -> getValue3 -> getValue2 ->
RexLiteral#getValueAs ->
case TIMESTAMP:
if (clazz == Long.class) {
return clazz.cast(((TimestampString) value).getMillisSinceEpoch()); <-- here info is loosed.
}
Also CURRENT_TIMESTAMP return only 3 digits after last dot, don`t take into account *TIMESTAMP(precision)*
was:
Trim useful timestamp part:
{noformat}
CREATE TABLE timestamps(id INTEGER PRIMARY KEY, i TIMESTAMP(9));
INSERT INTO timestamps VALUES (101, TIMESTAMP '2023-03-29 08:22:33.005007');
SELECT i from timestamps; <--- expect inserted, obtain trimmed : 2023-03-29 08:22:33.005
{noformat}
The root cause :
RelJson#toJson() -> getValue3 -> getValue2 ->
RexLiteral#getValueAs ->
case TIMESTAMP:
if (clazz == Long.class) {
// Milliseconds since 1970-01-01 00:00:00
return clazz.cast(((TimestampString) value).getMillisSinceEpoch()); <-- here info is loosed.
}
> Sql. Trim all less than millisecond information from timestamp.
> ---------------------------------------------------------------
>
> Key: IGNITE-19162
> URL: https://issues.apache.org/jira/browse/IGNITE-19162
> Project: Ignite
> Issue Type: Bug
> Components: sql
> Affects Versions: 3.0.0-beta1
> Reporter: Evgeny Stanilovsky
> Priority: Major
> Labels: calcite2-required, calcite3-required, ignite-3
>
> Trim useful timestamp part:
> {noformat}
> CREATE TABLE timestamps(id INTEGER PRIMARY KEY, i TIMESTAMP(9));
> INSERT INTO timestamps VALUES (101, TIMESTAMP '2023-03-29 08:22:33.005007');
> SELECT i from timestamps; <--- expect inserted, obtain trimmed : 2023-03-29 08:22:33.005
> {noformat}
> The root cause :
> RelJson#toJson() -> getValue3 -> getValue2 ->
> RexLiteral#getValueAs ->
> case TIMESTAMP:
> if (clazz == Long.class) {
>
> return clazz.cast(((TimestampString) value).getMillisSinceEpoch()); <-- here info is loosed.
> }
> Also CURRENT_TIMESTAMP return only 3 digits after last dot, don`t take into account *TIMESTAMP(precision)*
--
This message was sent by Atlassian Jira
(v8.20.10#820010)