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

[jira] [Commented] (CALCITE-2777) Inclusion of Period data type in calcite.

    [ https://issues.apache.org/jira/browse/CALCITE-2777?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16754208#comment-16754208 ] 

Stamatis Zampetakis commented on CALCITE-2777:
----------------------------------------------

Hi [~gvijay],

As of CALCITE-715, Calcite has a constructor for period data types and provides also support for the standard predicates on periods (e.g., CONTAINS, PRECEDES, OVERLAPS, etc.). 

I think currently periods are not suppored in table definitions so the create statement above will most likely fail so certainly there are some extensions to the parser that are necessary however I am not sure if a separate SqlTypeName for periods is required. 

On the other hand I think you can already work with periods using a workaround by defining the period column as a structured type composed of two dates. Then I think the INSERT and SELECT statement should work without problem.

> Inclusion of Period data type in calcite.
> -----------------------------------------
>
>                 Key: CALCITE-2777
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2777
>             Project: Calcite
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 1.18.0
>            Reporter: Garvit
>            Assignee: Julian Hyde
>            Priority: Major
>
> Currently SqlTypeName does not have support for period data type in calcite. Need to include following data type for period data type support. :-
> Periond (Date)
> PERIOD(TIMESTAMP WITH TIMEZONE)
> PERIOD(TIMESTAMP )
> PERIOD(TIME)
> PERIOD (TIME WITH TIME ZONE)
> These data type exists in Teradata (TDv13 onwards).
> Common use of these data types :-
> CREATE MULTISET TABLE person_coaching_period (
>   person_id        INTEGER                          NOT NULL,
>   coaching_program CHAR(2)                          NOT NULL,
>   enrolled_period  PERIOD(DATE) FORMAT 'YYYY-MM-DD' NULL
> )
> PRIMARY INDEX (person_id);
> INSERT INTO person_coaching_period
> VALUES (
>   1001,
>   'SC',
>   PERIOD(
>     DATE '2010-03-01',
>     DATE '2010-08-01'
>   )
> );
>  
> Usage in the query :-
> SELECT person_id
> FROM person_coaching_period
> WHERE enrolled_period OVERLAPS
> PERIOD(DATE '2006-05-01', DATE '2007-09-24');
> Other operators used :-
> LDIFF, OVERLAPS, BEGIN, END, EXPAND ON, By ANCHOR, NEXT, PRIOR, INTERVAL



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)