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

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

Garvit created CALCITE-2777:
-------------------------------

             Summary: 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


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(n) WITH TIMEZONE)
PERIOD(TIMESTAMP (n))
PERIOD(TIME(n))
PERIOD (TIME(n) 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)