@@ -77,6 +77,11 @@ INSERT INTO broken_doubles VALUES (1361129467683753853853498429727072845824.0),
7777# 9.223372036854776e18
7878# -9.223372036854776e18
7979
80+ # Keep the string/HUGEINT blocks commented for now: they rely on DuckDB's
81+ # HUGEINT and overflow handling semantics. Databend currently casts BIGINT to
82+ # Int64-compatible ranges and reports overflow instead of silently widening,
83+ # saturating, or wrapping.
84+
8085# statement ok
8186# CREATE TABLE working_strings(f VARCHAR)
8287
@@ -109,23 +114,35 @@ SELECT typeof(18446744073709551615), 18446744073709551615
109114----
110115BIGINT UNSIGNED 18446744073709551615
111116
112- # query II
113- # SELECT typeof(4832904823908104981209840981240981277), 4832904823908104981209840981240981277
117+ query TR
118+ SELECT typeof(4832904823908104981209840981240981277), 4832904823908104981209840981240981277
119+ ----
120+ DECIMAL(37, 0) 4832904823908104981209840981240981277
114121
115- # query II
116- # SELECT typeof(48329048239081049812098409812409812772), 48329048239081049812098409812409812772
122+ query TR
123+ SELECT typeof(48329048239081049812098409812409812772), 48329048239081049812098409812409812772
124+ ----
125+ DECIMAL(38, 0) 48329048239081049812098409812409812772
117126
118- # query II
119- # SELECT typeof(483290482390810498120984098124098127725), 483290482390810498120984098124098127725
127+ query TR
128+ SELECT typeof(483290482390810498120984098124098127725), 483290482390810498120984098124098127725
129+ ----
130+ DECIMAL(39, 0) 483290482390810498120984098124098127725
120131
121- # query II
122- # SELECT typeof(4832904823908104981209840981240981277256), 4832904823908104981209840981240981277256
132+ query TR
133+ SELECT typeof(4832904823908104981209840981240981277256), 4832904823908104981209840981240981277256
134+ ----
135+ DECIMAL(40, 0) 4832904823908104981209840981240981277256
123136
124- # query II
125- # SELECT typeof(48329048239081049812098409812409812772568), 48329048239081049812098409812409812772568
137+ query TR
138+ SELECT typeof(48329048239081049812098409812409812772568), 48329048239081049812098409812409812772568
139+ ----
140+ DECIMAL(41, 0) 48329048239081049812098409812409812772568
126141
127- # query II
128- # SELECT typeof(483290482390810498120984098124098127725683), 483290482390810498120984098124098127725683
142+ query TR
143+ SELECT typeof(483290482390810498120984098124098127725683), 483290482390810498120984098124098127725683
144+ ----
145+ DECIMAL(42, 0) 483290482390810498120984098124098127725683
129146
130147query T
131148SELECT 0::BIGINT::VARCHAR
@@ -137,35 +154,33 @@ select '255'::BIGINT::UINT8
137154----
138155255
139156
140- # TODO https://github.com/datafuselabs/databend/issues/7347
141- # statement error xxx
142- # select '-1'::BIGINT::uint8
157+ statement error 1006
158+ select '-1'::BIGINT::uint8
143159
144- # TODO https://github.com/datafuselabs/databend/issues/7347
145- # statement error xxx
146- # select '256'::BIGINT::uint8
160+ statement error 1006
161+ select '256'::BIGINT::uint8
147162
148163query I
149164select '65535'::BIGINT::UINT16
150165----
15116665535
152167
153- # TODO https://github.com/datafuselabs/databend/issues/7347
154- # statement error xxx
155- # select '-1'::BIGINT::uint16
168+ statement error 1006
169+ select '-1'::BIGINT::uint16
156170
157- # TODO https://github.com/datafuselabs/databend/issues/7347
158- # statement error xxx
159- # select '65536'::BIGINT::uint16
171+ statement error 1006
172+ select '65536'::BIGINT::uint16
160173
161174query I
162175select '4294967295'::BIGINT::UINT32
163176----
1641774294967295
165178
166- # TODO https://github.com/datafuselabs/databend/issues/7347
167- # statement error xxx
168- # select '-1'::BIGINT::uint32
179+ statement error 1006
180+ select '-1'::BIGINT::uint32
181+
182+ # Keep this commented for now: DuckDB expects UINT32 saturation to 4294967295,
183+ # while Databend currently treats the out-of-range cast as overflow.
169184
170185# TODO https://github.com/datafuselabs/databend/issues/7347
171186# query I
@@ -177,9 +192,8 @@ select '4294967295'::BIGINT::UINT32
177192statement error 1006
178193select '18446744073709551615'::BIGINT::UINT64
179194
180- # TODO https://github.com/datafuselabs/databend/issues/7347
181- # statement error XXX
182- # select '-1'::BIGINT::UINT64
195+ statement error 1006
196+ select '-1'::BIGINT::UINT64
183197
184198statement error 1006
185199select '18446744073709551616'::BIGINT::UINT64
@@ -199,10 +213,13 @@ select '4294967295'::UINT32::BIGINT
199213----
2002144294967295
201215
216+ # Keep this commented for now: the UINT64 value cannot fit in Databend's signed
217+ # BIGINT/Int64 range. Returning a value here would require a separate decision
218+ # on widening, saturation, or wrapping semantics.
219+
202220# TODO https://github.com/datafuselabs/databend/issues/7347
203221# query I
204222# select '18446744073709551615'::UINT64::BIGINT
205223
206224# ----
207225# 18446744073709551615
208-
0 commit comments