>From Ritik Raj <[email protected]>:

Attention is currently required from: Wail Alkowaileet.

Ritik Raj has posted comments on this change by Ritik Raj. ( 
https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773?usp=email )

Change subject: [ASTERIXDB-3684][STO] Support temporal types in Column
......................................................................


Patch Set 7:

(7 comments)

Commit Message:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/5fabf139_8f5377f6?usp=email
 :
PS5, Line 23: DURATION and
            : INTERVAL
> Ah 😊, will update in whichever next patchset comes up.
Done


File 
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/reader/value/key/temporal/DayTimeDurationKeyValueReader.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/f71bd92d_8b810cf5?usp=email
 :
PS7, Line 26: DayTimeDurationKeyValueReader
> Can this be a key?
Yes
https://github.com/apache/asterixdb/blob/91872ef6b5aed6e4c4fcebe966e2a4f35692a1eb/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java#L76


File 
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/reader/value/key/temporal/YearMonthDurationKeyValueReader.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/ee943005_2700f52d?usp=email
 :
PS7, Line 26: YearMonthDurationKeyValueReader
> Can this be a key?
Yes
https://github.com/apache/asterixdb/blob/91872ef6b5aed6e4c4fcebe966e2a4f35692a1eb/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/util/ValidateUtil.java#L76


File 
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/reader/value/temporal/IntervalValueReader.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/ed1e6a05_fd26a42a?usp=email
 :
PS5, Line 75: intervalTimeType
> sure, I will draft a mail for the discussion.
Done


File 
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/reader/value/temporal/IntervalValueReader.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/4d9745d5_53625940?usp=email
 :
PS7, Line 37: TYPE_BIT_WIDTH
> Minor: Do we need the whole 8 bits here? I know we need 3 bits only, right? 
> We don't have to store t […]
The type tag is being stored for interval. like the ATypeTag.TIME has value of 
18, which can't fit in 3 bits. Maybe mostly we won't need this when we redesign 
Interval type.


https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/7baa050e_5564655f?usp=email
 :
PS7, Line 81:      bytes[s] = (byte) intervalTimeType;
            :         if (intervalTimeType == ATypeTag.DATETIME.serialize()) {
            :             LongPointable.setLong(bytes, s + 1, start);
            :             LongPointable.setLong(bytes, s + 1 + Long.BYTES, end);
            :         } else {
            :             IntegerPointable.setInteger(bytes, s + 1, (int) 
start);
            :             IntegerPointable.setInteger(bytes, s + 1 + 
Integer.BYTES, (int) end);
            :         }
> This logic should be centralized in the IntervalPointable (as in 
> LongPointable).
yeah sure, will update in whatever patch comes next.


File 
asterixdb/asterix-column/src/main/java/org/apache/asterix/column/values/writer/DurationColumnValuesWriter.java:

https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773/comment/637818a9_f659977b?usp=email
 :
PS5, Line 55: * NOTE: Since the columnar page-zero filter stores only two 
8-byte longs, we cannot safely create an
            :  * order-preserving single-long min/max representation for 
DURATION. This writer therefore stores the values, but
            :  * uses a conservative filter that avoids pruning based on 
DURATION filters.
> As I mentioned to you on Slack, I think we should revisit all these types and 
> see what other systems […]
Just updating this from our Slack conversation,

```
[3:00 PM] SELECT INTERVAL '1 day' > INTERVAL '12 hours';
-- Result: true

SELECT INTERVAL '3 hours' = INTERVAL '180 minutes';
-- Result: true

SELECT INTERVAL '1 year' < INTERVAL '365 days';
-- Result: false
```

This doesn't seem right, see the last example, and also these which I ran on 
postgres.

```
=# SELECT INTERVAL '1 month' > INTERVAL '720 hours' ;
 ?column?
----------
 f
(1 row)

=# SELECT INTERVAL '1 year' < INTERVAL '364 days';
 ?column?
----------
 t
```

>From what I understand, months and days are not convertible unit.
basically a duration is made of YearMonthDuration and DayTimeDuration and both 
are not comparable with each other.
we do have two different types for these as well.

For the example:
```
E.g., 1 hour > 1 minute
```
this is comparable as they are part of DayTimeDuration.

I did some checking on this where other systems call our Duration as Interval.
1. Parquet's Interval which is same as our Duration.

INTERVAL is used for an interval of time. It must annotate a 
fixed_len_byte_array of length 12, The first stores a number in months, the 
second stores a number in days, and the third stores a number in milliseconds.

The sort order used for INTERVAL is undefined. When writing data, no min/max 
statistics should be saved for this type and if such non-compliant statistics 
are found during reading, they must be ignored.

2. Clickhouse doesn't have INTERVAL type 
https://clickhouse.com/docs/sql-reference/data-types/date

3. Databricks do similar stuff as ours. It says "You cannot combine or compare 
year-month and day-time intervals"



--
To view, visit https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/20773?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://asterix-gerrit.ics.uci.edu/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Change-Id: I1bdf63561cd5e7c73801380cf0a7c1b5be9c9248
Gerrit-Change-Number: 20773
Gerrit-PatchSet: 7
Gerrit-Owner: Ritik Raj <[email protected]>
Gerrit-Reviewer: Anon. E. Moose #1000171
Gerrit-Reviewer: Jenkins <[email protected]>
Gerrit-Reviewer: Ritik Raj <[email protected]>
Gerrit-Reviewer: Wail Alkowaileet <[email protected]>
Gerrit-Attention: Wail Alkowaileet <[email protected]>
Gerrit-Comment-Date: Thu, 22 Jan 2026 06:49:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Wail Alkowaileet <[email protected]>
Comment-In-Reply-To: Ritik Raj <[email protected]>

Reply via email to