You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "jin xing (JIRA)" <ji...@apache.org> on 2019/07/14 05:50:00 UTC

[jira] [Updated] (CALCITE-3197) Convert data of Timestamp/Time/Date as original form when enumerating from ArrayTable

     [ https://issues.apache.org/jira/browse/CALCITE-3197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

jin xing updated CALCITE-3197:
------------------------------
    Description: 
In current implementation ColumnLoader, data of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}} are converted as numeric during loading. https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java#L234
But current code seems forgot to revert the data back to original form when enumerating.
As a result, below test is failing now
{code:java}
// MaterializationTest.java

@Test public void testTimestampType() {
  String sql = "select \"eventid\", \"ts\"\n"
        + "from \"events\"\n"
        + "where \"eventid\" > 5";
  checkMaterialize(sql, sql);
}{code}
For type of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}}, cursor acesses by {{TimestampAccessor/TimeAccessor/DateAccessor}}, which expect column value as {{Timestamp/Time/Date}}.
It make sense to 'unwrap' the data as original form when enumerating from {{ArrayTable}}.

  was:
In current implementation ColumnLoader, data of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}} are converted as numeric during loading. https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java#L234
But current code seems forgot to revert the data back to original form when enumerating.
As a result, below test is failing now
{code:java}
// MaterializationTest.java

@Test public void testTimestampType() {
  String sql = "select \"eventid\", \"ts\"\n"
        + "from \"events\"\n"
        + "where \"eventid\" > 5";
  checkMaterialize(sql, sql);
}{code}
For type of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}}, cursor acesses {{TimestampAccessor/TimeAccessor/DateAccessor}}, which expect column value as {{Timestamp/Time/Date}}.
It make sense to 'unwrap' the data as original form when enumerating from {{ArrayTable}}.


> Convert data of Timestamp/Time/Date as original form when enumerating from ArrayTable
> -------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3197
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3197
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: jin xing
>            Priority: Major
>
> In current implementation ColumnLoader, data of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}} are converted as numeric during loading. https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/adapter/clone/ColumnLoader.java#L234
> But current code seems forgot to revert the data back to original form when enumerating.
> As a result, below test is failing now
> {code:java}
> // MaterializationTest.java
> @Test public void testTimestampType() {
>   String sql = "select \"eventid\", \"ts\"\n"
>         + "from \"events\"\n"
>         + "where \"eventid\" > 5";
>   checkMaterialize(sql, sql);
> }{code}
> For type of {{Rep.JAVA_SQL_TIMESTAMP/Rep.JAVA_SQL_TIME/Rep.JAVA_SQL_DATE}}, cursor acesses by {{TimestampAccessor/TimeAccessor/DateAccessor}}, which expect column value as {{Timestamp/Time/Date}}.
> It make sense to 'unwrap' the data as original form when enumerating from {{ArrayTable}}.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)