facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.42k stars 1.12k forks source link

Spark fuzzer failure: Timepoint is outside of supported year range: [-32767, 32767], got 227962 #10989

Open zhli1142015 opened 1 week ago

zhli1142015 commented 1 week ago

Description

terminate called after throwing an instance of 'facebook::velox::VeloxRuntimeError'
  what():  Exception: VeloxRuntimeError
Error Source: RUNTIME
Error Code: INVALID_STATE
Reason: Timepoint is outside of supported year range: [-3[27](https://github.com/facebookincubator/velox/actions/runs/10830178966/job/30051006621?pr=10508#step:4:28)67, 32767], got 227962
Retriable: False
Context: to_utc_timestamp(227962-04-10T18:41:22.768264000:TIMESTAMP, try_cast((multiply(99:TINYINT, checked_add(c1, greatest(21:TINYINT, c1, bitwise_and(bitwise_not(c2), bitwise_not(c2)))))) as VARCHAR))
Additional Context: Top-level Expression: hour(from_utc_timestamp(greatest(1926-01-16T03:08:19.661893927:TIMESTAMP, 20[31](https://github.com/facebookincubator/velox/actions/runs/10830178966/job/30051006621?pr=10508#step:4:32)-03-19T09:52:07.823342167:TIMESTAMP, to_utc_timestamp(227962-04-10T18:41:22.768264000:TIMESTAMP, try_cast((multiply(99:TINYINT, checked_add(c1, greatest(21:TINYINT, c1, bitwise_and(bitwise_not(c2), bitwise_not(c2)))))) as VARCHAR)), c3, c3), rtrim(concat(try_cast((multiply(99:TINYINT, checked_add(c1, greatest(21:TINYINT, c1, bitwise_and(bitwise_not(c2), bitwise_not(c2)))))) as VARCHAR), substring(try_cast((from_utc_timestamp(1910-05-12T01:38:34.[33](https://github.com/facebookincubator/velox/actions/runs/10830178966/job/30051006621?pr=10508#step:4:34)6258612:TIMESTAMP, least(ltrim(c4, c5), ltrim(c4, c5), ltrim(c4, c5), ~L-@[MGD3MG[CVYzXFC?}$JP%]CKsUF[FN&$f[-E,_A"UL:]M<:YR>vG1t&VdYfpS9n:VARCHAR, c6))) as VARCHAR), 95:INTEGER, c7), c8, overlay(c9, try_cast((from_utc_timestamp(1910-05-12T01:38:34.336258612:TIMESTAMP, least(ltrim(c4, c5), ltrim(c4, c5), ltrim(c4, c5), ~L-@[MGD3MG[CVYzXFC?}$JP%]CKsUF[FN&$f[-E,_A"UL:]M<:YR>vG1t&VdYfpS9n:VARCHAR, c6))) as VARCHAR), 7:INTEGER, checked_multiply(c10, 1890862608:INTEGER)), mask(null:VARCHAR, lpad(c4, null:INTEGER), upper(lpad(c4, null:INTEGER)), translate(c9, repeat(reverse(ltrim(c4, c5)), c11), c12)), jjq6TmeFtsp:VARCHAR, c13, L/\KLxi*Ar?'#O;/JM7M\0j`s:VARCHAR, left(overlay(c9, try_cast((from_utc_timestamp(1910-05-12T01:38:34.336258612:TIMESTAMP, least(ltrim(c4, c5), ltrim(c4, c5), ltrim(c4, c5), ~L-@[MGD3MG[CVYzXFC?}$JP%]CKsUF[FN&$f[-E,_A"UL:]M<:YR>vG1t&VdYfpS9n:VARCHAR, c6))) as VARCHAR), 7:INTEGER, checked_multiply(c10, 1890862608:INTEGER)), c10), L/\KLxi*Ar?'#O;/JM7M\0j`s:VARCHAR, try_cast((multiply(99:TINYINT, checked_add(c1, greatest(21:TINYINT, c1, bitwise_and(bitwise_not(c2), bitwise_not(c2)))))) as VARCHAR), c14), U},=.:!kHhZR|,v$&f$,c:VARCHAR)))
Function: validateRangeImpl
File: /__w/velox/velox/velox/velox/type/tz/TimeZoneMap.cpp
Line: 212

Error Reproduction

https://github.com/facebookincubator/velox/actions/runs/10830178966/job/30051006621?pr=10508

Relevant logs

https://github.com/facebookincubator/velox/actions/runs/10830178966/job/30051006621?pr=10508
zhli1142015 commented 1 week ago

I feel this should be marked as user error instead of runtime error. cc @rui-mo and @mbasmanova . Thanks.

rui-mo commented 1 week ago

I notice the runtime error is thrown intentionally in https://github.com/facebookincubator/velox/commit/da48a0880418929f4c531f1ce549912eaff8c858 so they are not suppressed by TRY_CAST, and it looks like there is an on-going work https://github.com/facebookincubator/velox/pull/10962/ to catch cast system error in Expression Fuzzer. cc: @kgpai @kagamiori