Summary
- Location:
src/query/sql/src/planner/binder/bind_table_reference/bind_asof_join.rs:167 and :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 ASC
Other ASOF files that may also trigger this (all have status=partial):
test/sql/join/asof/test_asof_join_doubles.test
test/sql/join/asof/test_asof_join_integers.test
test/sql/join/asof/test_asof_join_timestamps.test
test/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:
UInt8 is 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 an ErrorCode.
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.
Summary
src/query/sql/src/planner/binder/bind_table_reference/bind_asof_join.rs:167and:173called Result::unwrap() on an Err value: "only support numeric types and time types, but got Number(UInt8)"Likely trigger files
DuckDB source:
test/sql/join/asof/test_asof_join.testConverted file:
sql/join/asof/test_asof_join.testThe active (uncommented) ASOF queries use
range(0,10)which producesUInt64in Databend,joined against
events0.begin(DOUBLE). The ASOF rewrite callscreate_window_funcwhichneeds 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.
Other 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.testReproduction
Any ASOF JOIN query where the join key column is
UInt8(or likelyUInt16,Int8, etc.):Call chain
Key stack frames
Binder::create_window_funcbind_asof_join.rs:167/:173Binder::rewrite_asofbind_asof_join.rs:73Binder::bind_join_with_typebind_join.rs:478Root cause
Two issues stacked:
UInt8is a numeric type but is missing from the ASOF join's supported type list..unwrap()on the result, causing a panic instead of returning anErrorCode.Fix direction
UInt8,UInt16,Int8,Int16, etc.)..unwrap()with?or.map_err(...)to return a proper error to the user.