asterixdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hillery <chill...@hillery.land>
Subject Re: Round Tripping ADM Interval Data
Date Tue, 26 Jan 2016 01:58:09 GMT
I would vote for:

d. Update the serialized format to output "interval-from-date" and put both
dates in quotes.

I like the function name interval-from-date() better, and I don't think
there's any need to maintain backwards compatibility with the old name
which clearly never worked.

Couple thoughts, though: The serialized format really should be "ADM", not
"AQL". As such I don't think it should reference functions at all. We
already do this for many datatypes, such as uuid("...") and
datetime("..."). Are those truly "Functions"? Are they "constructors", and
is that different? In any case, the answer for interval types should be
consistent with that.

Final note: quite possibly the lossless-JSON and clean-JSON outputs for
intervals are broken as well, and should be fixed.

Ceej
aka Chris Hillery

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