test: add IN list slt coverage for temporal, Decimal128 and Interval types - #23875
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #23875 +/- ##
=======================================
Coverage 80.86% 80.86%
=======================================
Files 1101 1101
Lines 374985 374985
Branches 374985 374985
=======================================
+ Hits 303214 303219 +5
+ Misses 53674 53668 -6
- Partials 18097 18098 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…types Part of apache#23307. Adds sqllogictest coverage for IN lists over Date32, Date64, Time32, Time64, Timestamp (with and without a timezone), Duration, Decimal128 and Interval(MonthDayNano), none of which had any SQL level coverage. Also adds a 17 element Int8/UInt8 list and a 9 element Float16 list so the bitmap specialization stays covered as shorter lists gain their own specializations. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
6d501e6 to
a3fd8f3
Compare
nuno-faria
left a comment
There was a problem hiding this comment.
Thanks @alamb, LGTM, I leave some minor suggestions below.
Also, according to the code coverage there are some uncovered IN cases with larger lists, like INT32. I don't know if it is important.
| CREATE TABLE in_list_temporal AS | ||
| SELECT | ||
| label, | ||
| arrow_cast(arrow_cast(value, 'Int32'), 'Date32') AS d32, | ||
| arrow_cast(arrow_cast(value, 'Int64'), 'Date64') AS d64, | ||
| arrow_cast(arrow_cast(value, 'Int32'), 'Time32(Second)') AS t32s, | ||
| arrow_cast(arrow_cast(value, 'Int64'), 'Time64(Nanosecond)') AS t64ns, | ||
| arrow_cast(arrow_cast(value, 'Int64'), 'Timestamp(Nanosecond, None)') AS ts_ns, | ||
| arrow_cast(arrow_cast(value, 'Int64'), 'Timestamp(Second, Some("UTC"))') AS ts_s_utc, | ||
| arrow_cast(arrow_cast(value, 'Int64'), 'Duration(Second)') AS dur_s |
There was a problem hiding this comment.
nit: The aliases are not aligned, if that was the idea 😄.
| d32 IN (arrow_cast(arrow_cast(3, 'Int32'), 'Date32'), arrow_cast(arrow_cast(4, 'Int32'), 'Date32'), arrow_cast(arrow_cast(5, 'Int32'), 'Date32'), arrow_cast(arrow_cast(11, 'Int32'), 'Date32')), | ||
| d64 IN (arrow_cast(arrow_cast(3, 'Int64'), 'Date64'), arrow_cast(arrow_cast(4, 'Int64'), 'Date64'), arrow_cast(arrow_cast(5, 'Int64'), 'Date64'), arrow_cast(arrow_cast(11, 'Int64'), 'Date64')), | ||
| t32s IN (arrow_cast(arrow_cast(3, 'Int32'), 'Time32(Second)'), arrow_cast(arrow_cast(4, 'Int32'), 'Time32(Second)'), arrow_cast(arrow_cast(5, 'Int32'), 'Time32(Second)'), arrow_cast(arrow_cast(11, 'Int32'), 'Time32(Second)')), | ||
| t64ns IN (arrow_cast(arrow_cast(3, 'Int64'), 'Time64(Nanosecond)'), arrow_cast(arrow_cast(4, 'Int64'), 'Time64(Nanosecond)'), arrow_cast(arrow_cast(5, 'Int64'), 'Time64(Nanosecond)'), arrow_cast(arrow_cast(11, 'Int64'), 'Time64(Nanosecond)')), | ||
| ts_ns IN (arrow_cast(arrow_cast(3, 'Int64'), 'Timestamp(Nanosecond, None)'), arrow_cast(arrow_cast(4, 'Int64'), 'Timestamp(Nanosecond, None)'), arrow_cast(arrow_cast(5, 'Int64'), 'Timestamp(Nanosecond, None)'), arrow_cast(arrow_cast(11, 'Int64'), 'Timestamp(Nanosecond, None)')), | ||
| ts_s_utc IN (arrow_cast(arrow_cast(3, 'Int64'), 'Timestamp(Second, Some("UTC"))'), arrow_cast(arrow_cast(4, 'Int64'), 'Timestamp(Second, Some("UTC"))'), arrow_cast(arrow_cast(5, 'Int64'), 'Timestamp(Second, Some("UTC"))'), arrow_cast(arrow_cast(11, 'Int64'), 'Timestamp(Second, Some("UTC"))')), | ||
| dur_s IN (arrow_cast(arrow_cast(3, 'Int64'), 'Duration(Second)'), arrow_cast(arrow_cast(4, 'Int64'), 'Duration(Second)'), arrow_cast(arrow_cast(5, 'Int64'), 'Duration(Second)'), arrow_cast(arrow_cast(11, 'Int64'), 'Duration(Second)')) |
There was a problem hiding this comment.
In this test and the others, I don't think the double arrow_cast is needed, only for Time32:
> select arrow_cast(3, 'Date32');
+-------------------------------------+
| arrow_cast(Int64(3),Utf8("Date32")) |
+-------------------------------------+
| 1970-01-04 |
+-------------------------------------+
> select arrow_cast(3, 'Time32');
Execution error: Unsupported type 'Time32'. Must be a supported arrow type name such as 'Int32' or 'Timestamp(ns)'. Error finding next token| #### | ||
| ## Decimal128 IN List Specializations | ||
| #### | ||
|
|
||
| statement ok | ||
| CREATE TABLE in_list_wide AS | ||
| SELECT * FROM (VALUES | ||
| ('match', arrow_cast(11, 'Decimal128(10, 2)'), INTERVAL '11 months'), | ||
| ('no_match', arrow_cast(7, 'Decimal128(10, 2)'), INTERVAL '7 months'), | ||
| ('nulls', NULL, NULL) | ||
| ) AS t(label, d128, imdn); | ||
|
|
||
| query TT | ||
| SELECT arrow_typeof(d128), arrow_typeof(imdn) FROM in_list_wide LIMIT 1 | ||
| ---- | ||
| Decimal128(10, 2) Interval(MonthDayNano) |
There was a problem hiding this comment.
Should Decimal128 and INTERVAL maybe be split into different tests?
- Align the AS aliases in the in_list_temporal CREATE TABLE for readability. - Drop the unneeded intermediate arrow_cast to Int32/Int64 for all temporal types except Time32(Second), which requires an Int32 input. - Split the combined Decimal128/Interval table and tests into separate sections, one per type.
|
Thank you @nuno-faria -- I have addressed your comments |
Which issue does this PR close?
Rationale for this change
IN lists over temporal,
Decimal128andIntervalcolumns had no SQL level coverage at all, and the specializations being added in #23014 route those types onto new code paths.What changes are included in this PR?
Adds
in_list.sltcoverage forDate32,Date64,Time32(Second),Time64(Nanosecond),Timestamp(Nanosecond, None),Timestamp(Second, "UTC"),Duration(Second),Decimal128andInterval(MonthDayNano)Are these changes tested?
This PR is only tests; they pass on
mainand against the head of #23014.Are there any user-facing changes?
No.