-
Notifications
You must be signed in to change notification settings - Fork 862
ASOF Join panics on UInt8 type — unwrap on unsupported type #19570
Copy link
Copy link
Open
Labels
agent-issueAgent-created issue markerAgent-created issue marker
Description
Summary
- Location:
src/query/sql/src/planner/binder/bind_table_reference/bind_asof_join.rs:167and:173 - Panic message:
called Result::unwrap() on an Err value: "only support numeric types and time types, but got Number(UInt8)" - Occurrences: 2 (lines 167 and 173 in the same file)
Likely trigger files
DuckDB source: test/sql/join/asof/test_asof_join.test
Converted file: sql/join/asof/test_asof_join.test
The active (uncommented) ASOF queries use range(0,10) which produces UInt64 in Databend,
joined against events0.begin (DOUBLE). The ASOF rewrite calls create_window_func which
needs to create a boundary scalar for the join key type. The error message says Number(UInt8),
suggesting the type coercion path resolves to UInt8 for small literal ranges.
-- Active query in test_asof_join.test (line 59-63):
SELECT p.ts, e.value
FROM range(0,10) p(ts) ASOF JOIN events0 e
ON 1 = 1 AND p.ts >= e.begin
ORDER BY p.ts ASCOther ASOF files that may also trigger this (all have status=partial):
test/sql/join/asof/test_asof_join_doubles.testtest/sql/join/asof/test_asof_join_integers.testtest/sql/join/asof/test_asof_join_timestamps.testtest/sql/join/asof/test_asof_join_filter_pushdown.test
Reproduction
Any ASOF JOIN query where the join key column is UInt8 (or likely UInt16, Int8, etc.):
-- Schema: table with a UInt8 column used as ASOF join key
CREATE TABLE t1 (id INT, val TINYINT UNSIGNED); -- UInt8
CREATE TABLE t2 (id INT, val TINYINT UNSIGNED);
SELECT * FROM t1 ASOF JOIN t2 ON t1.id = t2.id AND t1.val >= t2.val;Call chain
Binder::bind_join (bind_join.rs:154)
→ Binder::bind_join_with_type (bind_join.rs:478)
→ Binder::rewrite_asof (bind_asof_join.rs:73)
→ Binder::create_window_func (bind_asof_join.rs:167/173) ← PANIC (.unwrap())
Key stack frames
| # | Function | File |
|---|---|---|
| 12 | Binder::create_window_func |
bind_asof_join.rs:167 / :173 |
| 13 | Binder::rewrite_asof |
bind_asof_join.rs:73 |
| 14 | Binder::bind_join_with_type |
bind_join.rs:478 |
Root cause
Two issues stacked:
UInt8is a numeric type but is missing from the ASOF join's supported type list.- The code uses
.unwrap()on the result, causing a panic instead of returning anErrorCode.
Fix direction
- Extend the supported type list to cover all integer types (
UInt8,UInt16,Int8,Int16, etc.). - Replace
.unwrap()with?or.map_err(...)to return a proper error to the user.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
agent-issueAgent-created issue markerAgent-created issue marker