asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yingyi Bu <buyin...@gmail.com>
Subject Re: Round Tripping ADM Interval Data
Date Tue, 26 Jan 2016 01:52:11 GMT
+1.

Best,
Yingyi

On Mon, Jan 25, 2016 at 5:36 PM, Till Westmann <tillw@apache.org> wrote:

> Voting for a. Seems to be the least redundant option.
>
> Cheers,
> Till
>
>
> On 25 Jan 2016, at 16:47, Eldon Carman wrote:
>
> The interval field value printed in the ADM results can not be used to
>> create an interval.
>>
>> Intervals have several functions that are used to construct an interval:
>> interval-from-date/time/datetime
>> and interval-start-from-date/time/datetime. It appears that this is the
>> only way to create an interval. Thus, a user must use one of these
>> function
>> to create an interval.
>>
>> The following query shows how to create three intervals.
>>
>> Query:
>> let $di := {"date-interval": interval-from-date("2012-01-01",
>> "2013-04-01")}
>> let $ti := {"time-interval": interval-from-time("12:23:34.456Z",
>> "233445567+0800")}
>> let $dti := {"datetime-interval":
>> interval-from-datetime("2012-01-01T12:23:34.456+08:00",
>> "20130401T153445567Z")}
>> return [$di, $ti, $dti];
>>
>> Result:
>> { "date-interval": interval-date("2012-01-01, 2013-04-01") }, {
>> "time-interval": interval-time("12:23:34.456Z, 15:34:45.567Z") }, {
>> "datetime-interval": interval-datetime("2012-01-01T04:23:34.456Z,
>> 2013-04-01T15:34:45.567Z") } ]
>>
>> Notice the results show interval-date("date, date") which is different
>> than
>> the functions that are used to create a date interval. Notice that
>> interval-date does not exists in AsterixDB and that the input is a single
>> string of dates separated by a comma. Below are some ideas on how to
>> create
>> a round-trip for intervals.
>>
>> Options for round tripping:
>> a: Rename "interval-from-date" to "interval-date" and update the output to
>> put both dates in quotes.
>> b: Add alias for "interval-from-date" to "interval-date" and update the
>> output to put both dates in quotes.
>> c: Create an interval date constructor (called interval-date) that can
>> parse the string "date, date".
>>
>> The same process should be used for intervals with time and datetime.
>>
>> Thoughts?
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message