Skip to content

ABORT THROWN BY INTERNAL EXCEPTION: Assertion triggered in file "/Users/christiaan/git/duckdb/src/common/types/hash.cpp" on line 143: h == Hash(val.GetData(), val.GetSize()) #4312

@fuzzerofducks

Description

@fuzzerofducks

Issue found by SQLSmith on git commit hash f88d9 using seed 256357348.

To Reproduce

create table all_types as select * exclude(small_enum, medium_enum, large_enum) from test_all_types();
select  
  sample_0.date as c0, 
  sample_0.timestamp_s as c1, 
  sample_0.bool as c2, 
  sample_0.fixed_varchar_array as c3, 
  sample_0.bool as c4, 
  sample_0.utinyint as c5, 
  sample_0.bool as c6, 
  sample_0.fixed_array_of_int_list as c7, 
  66 as c8, 
  sample_0.timestamp_tz as c9
from 
  main.all_types as sample_0 tablesample bernoulli (4.3) 
where sample_0.varchar !~~ sample_0.varchar
limit 156;
select  
  sample_0.dec_4_1 as c0, 
  sample_0.struct_of_arrays as c1
from 
  main.all_types as sample_0 tablesample system (4.2) 
where case when (current_schema() ^@ sample_0.varchar) 
      and (sample_0.varchar !~~ (select varchar from main.all_types limit 1 offset 2)
          ) then case when sample_0.varchar ~~~ (select varchar from main.all_types limit 1 offset 1)
           then cast(null as t[]) else cast(null as t[]) end
       else case when sample_0.varchar ~~~ (select varchar from main.all_types limit 1 offset 1)
           then cast(null as t[]) else cast(null as t[]) end
       end
     <@ case when sample_0.list_of_fixed_int_array is not NULL then case when sample_0.array_of_structs is NULL then list_where(
        cast(cast(null as t[]) as t[]),
        cast(case when EXISTS (
            select  
                sample_1.fixed_int_array as c0, 
                sample_1.timestamp_ms as c1, 
                (select hugeint from main.all_types limit 1 offset 2)
                   as c2, 
                sample_0.fixed_struct_array as c3, 
                sample_1.interval as c4, 
                sample_0.timestamp_array as c5, 
                sample_1.bool as c6, 
                sample_1.varchar as c7, 
                sample_1.fixed_nested_varchar_array as c8, 
                72 as c9, 
                sample_0.fixed_nested_varchar_array as c10, 
                sample_1.double_array as c11, 
                (select fixed_int_array from main.all_types limit 1 offset 4)
                   as c12, 
                sample_1.fixed_nested_int_array as c13, 
                sample_0.fixed_nested_varchar_array as c14, 
                sample_1.utinyint as c15, 
                sample_1.list_of_fixed_int_array as c16
              from 
                main.all_types as sample_1 tablesample bernoulli (8.2) 
              where sample_1.varchar !~~ sample_0.varchar
              limit 94) then cast(null as t[]) else cast(null as t[]) end
           as t[])) else list_where(
        cast(cast(null as t[]) as t[]),
        cast(case when EXISTS (
            select  
                sample_1.fixed_int_array as c0, 
                sample_1.timestamp_ms as c1, 
                (select hugeint from main.all_types limit 1 offset 2)
                   as c2, 
                sample_0.fixed_struct_array as c3, 
                sample_1.interval as c4, 
                sample_0.timestamp_array as c5, 
                sample_1.bool as c6, 
                sample_1.varchar as c7, 
                sample_1.fixed_nested_varchar_array as c8, 
                72 as c9, 
                sample_0.fixed_nested_varchar_array as c10, 
                sample_1.double_array as c11, 
                (select fixed_int_array from main.all_types limit 1 offset 4)
                   as c12, 
                sample_1.fixed_nested_int_array as c13, 
                sample_0.fixed_nested_varchar_array as c14, 
                sample_1.utinyint as c15, 
                sample_1.list_of_fixed_int_array as c16
              from 
                main.all_types as sample_1 tablesample bernoulli (8.2) 
              where sample_1.varchar !~~ sample_0.varchar
              limit 94) then cast(null as t[]) else cast(null as t[]) end
           as t[])) end
       else case when sample_0.array_of_structs is NULL then list_where(
        cast(cast(null as t[]) as t[]),
        cast(case when EXISTS (
            select  
                sample_1.fixed_int_array as c0, 
                sample_1.timestamp_ms as c1, 
                (select hugeint from main.all_types limit 1 offset 2)
                   as c2, 
                sample_0.fixed_struct_array as c3, 
                sample_1.interval as c4, 
                sample_0.timestamp_array as c5, 
                sample_1.bool as c6, 
                sample_1.varchar as c7, 
                sample_1.fixed_nested_varchar_array as c8, 
                72 as c9, 
                sample_0.fixed_nested_varchar_array as c10, 
                sample_1.double_array as c11, 
                (select fixed_int_array from main.all_types limit 1 offset 4)
                   as c12, 
                sample_1.fixed_nested_int_array as c13, 
                sample_0.fixed_nested_varchar_array as c14, 
                sample_1.utinyint as c15, 
                sample_1.list_of_fixed_int_array as c16
              from 
                main.all_types as sample_1 tablesample bernoulli (8.2) 
              where sample_1.varchar !~~ sample_0.varchar
              limit 94) then cast(null as t[]) else cast(null as t[]) end
           as t[])) else list_where(
        cast(cast(null as t[]) as t[]),
        cast(case when EXISTS (
            select  
                sample_1.fixed_int_array as c0, 
                sample_1.timestamp_ms as c1, 
                (select hugeint from main.all_types limit 1 offset 2)
                   as c2, 
                sample_0.fixed_struct_array as c3, 
                sample_1.interval as c4, 
                sample_0.timestamp_array as c5, 
                sample_1.bool as c6, 
                sample_1.varchar as c7, 
                sample_1.fixed_nested_varchar_array as c8, 
                72 as c9, 
                sample_0.fixed_nested_varchar_array as c10, 
                sample_1.double_array as c11, 
                (select fixed_int_array from main.all_types limit 1 offset 4)
                   as c12, 
                sample_1.fixed_nested_int_array as c13, 
                sample_0.fixed_nested_varchar_array as c14, 
                sample_1.utinyint as c15, 
                sample_1.list_of_fixed_int_array as c16
              from 
                main.all_types as sample_1 tablesample bernoulli (8.2) 
              where sample_1.varchar !~~ sample_0.varchar
              limit 94) then cast(null as t[]) else cast(null as t[]) end
           as t[])) end
       end
    
limit 90;
select  
  current_localtime() as c0, 
  ref_0.int as c1, 
  ref_0.tinyint as c2, 
  ref_0.uint as c3, 
  ref_0.fixed_struct_array as c4, 
  ref_0.bigint as c5, 
  ref_0.map as c6, 
  cast(nullif(list_value(),
    list_pack()) as "null"[]) as c7
from 
  main.all_types as ref_0
where ref_0.date_array is not NULL
limit 58;
select  
  ref_0.dec_9_4 as c0, 
  ref_0.nested_int_array as c1, 
  ref_0.timestamptz_array as c2
from 
  main.all_types as ref_0
where 0;
select  
  ref_0.fixed_nested_varchar_array as c0, 
  ref_0.struct_of_fixed_array as c1, 
  ref_0.bit as c2, 
  ref_0.fixed_nested_varchar_array as c3, 
  json_transform(
    cast(ref_0.varchar as varchar),
    cast(ref_0.varchar as varchar)) as c4, 
  ref_0.int_array as c5, 
  (select uhugeint from main.all_types limit 1 offset 2)
     as c6, 
  ref_0.time as c7, 
  ref_0.uhugeint as c8, 
  ref_0.timestamp_s as c9, 
  ref_0.map as c10, 
  ref_0.uhugeint as c11
from 
  main.all_types as ref_0
where repeat(
    cast(flatten(
      cast(cast(null as t[][]) as t[][])) as t[]),
    cast(cast(null as t[]) as t[])) @> cast(coalesce(cast(coalesce(array_distinct(
        cast(cast(null as t[]) as t[])),
      case when (cast(null as t[]) <@ cast(null as t[])) 
          and ((EXISTS (
              select  
                  ref_0.map as c0, 
                  ref_0.date as c1, 
                  sample_0.double_array as c2
                from 
                  main.all_types as sample_0 tablesample system (2.1) 
                where (sample_0.varchar !~~* ref_0.varchar) 
                  and (sample_0.varchar ~~~ sample_0.varchar)
                limit 98)) 
            or (ref_0.varchar ~~* ref_0.varchar)) then cast(coalesce(case when cast(null as t[]) <@ cast(null as t[]) then cast(null as t[]) else cast(null as t[]) end
            ,
          case when 1 then cast(null as t[]) else cast(null as t[]) end
            ) as t[]) else cast(coalesce(case when cast(null as t[]) <@ cast(null as t[]) then cast(null as t[]) else cast(null as t[]) end
            ,
          case when 1 then cast(null as t[]) else cast(null as t[]) end
            ) as t[]) end
        ) as t[]),
    list_where(
      cast(case when ref_0.float is not NULL then cast(null as t[]) else cast(null as t[]) end
         as t[]),
      cast(case when cast(null as varchar) !~~ ref_0.varchar then cast(coalesce(array_distinct(
            cast(cast(null as t[]) as t[])),
          cast(null as t[])) as t[]) else cast(coalesce(array_distinct(
            cast(cast(null as t[]) as t[])),
          cast(null as t[])) as t[]) end
         as t[]))) as t[]);
select  
  subq_0.c3 as c0, 
  subq_0.c3 as c1
from 
  (select  
        ref_0.dec_18_6 as c0, 
        ref_0.int_array as c1, 
        ref_0.struct_of_arrays as c2, 
        ref_0.bigint as c3
      from 
        main.all_types as ref_0
      where ref_0.varchar !~~ cast(null as varchar)
      limit 36) as subq_0
where (case when subq_0.c3 is not NULL then version() else version() end
       !~~ (select varchar from main.all_types limit 1 offset 5)
      ) 
  and ((((EXISTS (
          select  
              subq_0.c0 as c0, 
              subq_0.c0 as c1, 
              subq_0.c0 as c2
            from 
              main.all_types as ref_1
            where cast(null as t[]) && cast(null as t[]))) 
        and ((((subq_0.c2 is not NULL) 
              and (subq_0.c2 is NULL)) 
            and (cast(null as t[]) <@ cast(null as t[]))) 
          and ((0) 
            or ((subq_0.c0 is not NULL) 
              or (cast(null as geometry) && cast(null as geometry)))))) 
      and (EXISTS (
        select  
            ref_2.dec_18_6 as c0, 
            subq_0.c1 as c1, 
            subq_0.c2 as c2, 
            ref_2.date as c3, 
            subq_3.c0 as c4, 
            (select fixed_struct_array from main.all_types limit 1 offset 3)
               as c5, 
            subq_0.c1 as c6, 
            (select timestamp from main.all_types limit 1 offset 3)
               as c7, 
            subq_3.c0 as c8, 
            ref_2.uuid as c9, 
            ref_2.timestamp_s as c10, 
            ref_2.uuid as c11, 
            ref_2.fixed_int_array as c12, 
            subq_3.c0 as c13, 
            ref_2.dec38_10 as c14, 
            ref_2.dec38_10 as c15, 
            ref_2.uhugeint as c16, 
            ref_2.list_of_fixed_int_array as c17, 
            subq_0.c1 as c18
          from 
            main.all_types as ref_2,
            lateral (select  
                  sample_0.varchar as c0
                from 
                  main.all_types as sample_0 tablesample system (5.9) ,
                  lateral (select  
                        ref_2.fixed_nested_int_array as c0, 
                        ref_3.uhugeint as c1, 
                        ref_2.double as c2, 
                        ref_2.list_of_fixed_int_array as c3
                      from 
                        main.all_types as ref_3
                      where (sample_0.varchar ^@ ref_2.varchar) 
                        or (ref_2.varchar !~~* sample_0.varchar)
                      limit 107) as subq_1,
                  lateral (select  
                        subq_0.c0 as c0, 
                        ref_4.ubigint as c1, 
                        ref_2.bigint as c2, 
                        (select struct_of_arrays from main.all_types limit 1 offset 82)
                           as c3, 
                        sample_0.double as c4, 
                        ref_2.varchar as c5, 
                        64 as c6, 
                        subq_0.c1 as c7, 
                        subq_0.c3 as c8, 
                        ref_4.fixed_array_of_int_list as c9
                      from 
                        main.all_types as ref_4
                      where ref_4.varchar ^@ cast(null as varchar)
                      limit 82) as subq_2
                where cast(null as t[]) <@ cast(null as t[])) as subq_3
          where (ref_2.ubigint is not NULL) 
            or (48 is NULL)
          limit 142))) 
    or (cast(null as t[]) <@ case when EXISTS (
          select  
              76 as c0, 
              sample_1.timestamp_array as c1
            from 
              main.all_types as sample_1 tablesample system (4.5) 
            where cast(null as t[]) <@ cast(null as t[])
            limit 78) then cast(coalesce(case when cast(null as t[]) && cast(null as t[]) then cast(null as t[]) else cast(null as t[]) end
            ,
          case when 0 then cast(null as t[]) else cast(null as t[]) end
            ) as t[]) else cast(coalesce(case when cast(null as t[]) && cast(null as t[]) then cast(null as t[]) else cast(null as t[]) end
            ,
          case when 0 then cast(null as t[]) else cast(null as t[]) end
            ) as t[]) end
        ))
limit 68;
insert into main.all_types values (
0, 
default, 
default, 
83, 
cast(null as bigint), 
cast(null as hugeint), 
case when case when (1) 
        or (cast(null as varchar) !~~ cast(null as varchar)) then cast(coalesce(cast(null as t[]),
        cast(null as t[])) as t[]) else cast(coalesce(cast(null as t[]),
        cast(null as t[])) as t[]) end
       <@ cast(null as t[]) then cast(null as uhugeint) else cast(null as uhugeint) end
  , 
default, 
cast(null as usmallint), 
cast(null as uinteger), 
(select ubigint from main.all_types limit 1 offset 1)
  , 
cast(null as bignum), 
default, 
default, 
default, 
cast(null as timestamp_s), 
cast(null as timestamp_ms), 
cast(null as timestamp_ns), 
cast(null as time with time zone), 
(select timestamp_tz from main.all_types limit 1 offset 5)
  , 
ceil(
  cast(cast(null as float) as float)), 
case when (75 is NULL) 
    and (cast(null as varchar) !~~ cast(null as varchar)) then cast(null as double) else cast(null as double) end
  , 
cast(null as decimal(4,1)), 
default, 
cast(coalesce(cast(null as decimal(18,6)),
  cast(null as decimal(18,6))) as decimal(18,6)), 
cast(null as decimal(38,10)), 
cast(null as uuid), 
(select avg(interval) from main.all_types)
  , 
icu_collate_fr(
  cast(cast(null as varchar) as varchar)), 
cast(null as blob), 
default, 
cast(null as integer[]), 
(select double_array from main.all_types limit 1 offset 5)
  , 
default, 
generate_series(
  cast(cast(null as timestamp) as timestamp),
  cast(cast(null as timestamp) as timestamp),
  cast(cast(null as timestamp) as timestamp)), 
default, 
default, 
default, 
cast(null as struct(a integer, b varchar)), 
case when cast(null as t[]) @> cast(null as t[]) then case when cast(null as varchar) !~~* cast(null as varchar) then cast(null as struct(a integer[], b varchar[])) else cast(null as struct(a integer[], b varchar[])) end
     else case when cast(null as varchar) !~~* cast(null as varchar) then cast(null as struct(a integer[], b varchar[])) else cast(null as struct(a integer[], b varchar[])) end
     end
  , 
default, 
default, 
cast(null as union("name" varchar, age smallint)), 
default, 
default, 
default, 
cast(null as varchar[3][3]), 
cast(null as struct(a integer, b varchar)[3]), 
default, 
default, 
default);
select  
  subq_0.c1 as c0
from 
  (select  
        sample_0.dec38_10 as c0, 
        sample_0.timestamp_array as c1, 
        list_concat() as c2, 
        sample_0.fixed_int_array as c3, 
        sample_0.bigint as c4
      from 
        main.all_types as sample_0 tablesample bernoulli (3.8) 
      where 0) as subq_0
where cast(null as t[]) <@ cast(nullif(array_where(
      cast(case when cast(null as t[]) <@ repeat(
            cast(cast(null as t[]) as t[]),
            cast(cast(null as t[]) as t[])) then array_select(
          cast(case when (cast(null as geometry) && cast(null as geometry)) 
              and (cast(null as varchar) ^@ (select varchar from main.all_types limit 1 offset 4)
                  ) then cast(null as t[]) else cast(null as t[]) end
             as t[]),
          cast(cast(null as t[]) as t[])) else array_select(
          cast(case when (cast(null as geometry) && cast(null as geometry)) 
              and (cast(null as varchar) ^@ (select varchar from main.all_types limit 1 offset 4)
                  ) then cast(null as t[]) else cast(null as t[]) end
             as t[]),
          cast(cast(null as t[]) as t[])) end
         as t[]),
      cast(cast(null as t[]) as t[])),
    case when 0 then array_where(
        cast(cast(null as t[]) as t[]),
        cast(cast(coalesce(list_pack(
            cast(cast(null as t) as t)),
          cast(null as t[])) as t[]) as t[])) else array_where(
        cast(cast(null as t[]) as t[]),
        cast(cast(coalesce(list_pack(
            cast(cast(null as t) as t)),
          cast(null as t[])) as t[]) as t[])) end
      ) as t[])
limit 106;
select  
  cast(coalesce(subq_1.c4,
    subq_1.c4) as decimal(38,10)) as c0, 
  subq_1.c0 as c1, 
  subq_1.c3 as c2, 
  subq_1.c2 as c3, 
  subq_1.c0 as c4, 
  cast(nullif(subq_1.c4,
    subq_1.c4) as decimal(38,10)) as c5, 
  subq_1.c0 as c6, 
  subq_1.c5 as c7, 
  subq_1.c5 as c8, 
  subq_1.c2 as c9, 
  subq_1.c5 as c10, 
  cast(coalesce(subq_1.c3,
    subq_1.c3) as integer[3][]) as c11, 
  subq_1.c0 as c12, 
  row() as c13
from 
  (select  
        subq_0.c0 as c0, 
        sample_0.map as c1, 
        ref_0.fixed_nested_int_array as c2, 
        ref_0.list_of_fixed_int_array as c3, 
        (select dec38_10 from main.all_types limit 1 offset 3)
           as c4, 
        19 as c5, 
        ref_0.timestamp_s as c6
      from 
        main.all_types as sample_0 tablesample bernoulli (4) 
            left join main.all_types as ref_0
            on ((ref_0.varchar ~~ sample_0.varchar) 
                and (ref_0.varchar ~~* sample_0.varchar))
          inner join (select  
                (select fixed_struct_array from main.all_types limit 1 offset 6)
                   as c0
              from 
                main.all_types as sample_1 tablesample system (9.6) 
              where cast(null as t[]) <@ cast(null as t[])
              limit 123) as subq_0
          on (1)
      where (EXISTS (
          select  
              sample_2.dec_9_4 as c0, 
              sample_3.double_array as c1
            from 
              main.all_types as sample_2 tablesample system (5.1) 
                right join main.all_types as sample_3 tablesample system (1.5) 
                on ((cast(null as t[]) <@ cast(null as t[])) 
                    or (((cast(null as t[]) @> cast(null as t[])) 
                        or (sample_0.bit is not NULL)) 
                      and (ref_0.varchar ~~* ref_0.varchar)))
            where (select varchar from main.all_types limit 1 offset 3)
                 !~~ sample_3.varchar
            limit 92)) 
        and (cast(null as t[]) @> case when ref_0.union is NULL then cast(null as t[]) else cast(null as t[]) end
            )
      limit 91) as subq_1
where 1
limit 120;
update main.all_types set 
  tinyint = main.all_types.tinyint, 
  bigint = case when main.all_types.varchar ^@ main.all_types.varchar then main.all_types.bigint else main.all_types.bigint end
    , 
  uhugeint = main.all_types.uhugeint, 
  utinyint = cast(null as utinyint), 
  usmallint = main.all_types.usmallint, 
  uint = cast(null as uinteger), 
  ubigint = (select bit_or(ubigint) from main.all_types)
    , 
  bignum = subtract(
    cast((select sum(bignum) from main.all_types)
       as bignum)), 
  date = main.all_types.date, 
  timestamp_s = main.all_types.timestamp_s, 
  timestamp_ns = main.all_types.timestamp_ns, 
  time_tz = main.all_types.time_tz, 
  timestamp_tz = main.all_types.timestamp_tz, 
  double = main.all_types.double, 
  dec38_10 = main.all_types.dec38_10, 
  uuid = main.all_types.uuid, 
  bit = main.all_types.bit, 
  varchar_array = main.all_types.varchar_array, 
  struct_of_arrays = cast(coalesce(main.all_types.struct_of_arrays,
    cast(null as struct(a integer[], b varchar[]))) as struct(a integer[], b varchar[])), 
  array_of_structs = (select array_of_structs from main.all_types limit 1 offset 4)
    , 
  map = main.all_types.map, 
  fixed_nested_int_array = main.all_types.fixed_nested_int_array, 
  fixed_struct_array = main.all_types.fixed_struct_array, 
  list_of_fixed_int_array = main.all_types.list_of_fixed_int_array
returning 
  main.all_types.union as c0, 
  isoyear(
    cast(main.all_types.timestamp as timestamp)) as c1, 
  main.all_types.uint as c2, 
  main.all_types.bignum as c3, 
  main.all_types.int_array as c4, 
  main.all_types.timestamp_tz as c5, 
  main.all_types.uuid as c6, 
  main.all_types.date as c7;
WITH 
jennifer_0 AS (select  
    array_to_json() as c0, 
    subq_2.c0 as c1, 
    subq_2.c1 as c2, 
    
      arg_min_null(
        cast(case when subq_2.c0 is NULL then cast(null as decimal) else cast(null as decimal) end
           as decimal),
        cast(cast(null as decimal) as decimal)) over (partition by subq_2.c1 order by subq_2.c1,subq_2.c1) as c3, 
    19 as c4, 
    struct_pack() as c5
  from 
    (select  
          sample_1.double as c0, 
          ref_0.dec_9_4 as c1
        from 
          main.all_types as ref_0
            inner join main.all_types as sample_0 tablesample bernoulli (2) 
              inner join main.all_types as sample_1 tablesample bernoulli (1.6) 
              on (sample_1.varchar ^@ sample_0.varchar)
            on (sample_1.varchar ^@ sample_1.varchar),
          lateral (select  
                22 as c0
              from 
                main.all_types as sample_2 tablesample system (7.6) ,
                lateral (select  
                      sample_2.fixed_struct_array as c0, 
                      (select int from main.all_types limit 1 offset 6)
                         as c1, 
                      sample_2.dec_4_1 as c2, 
                      sample_3.double as c3, 
                      sample_0.smallint as c4, 
                      sample_1.float as c5, 
                      ref_0.timestamp_ns as c6, 
                      ref_0.bool as c7
                    from 
                      main.all_types as sample_3 tablesample bernoulli (4.7) 
                    where sample_2.uhugeint is not NULL
                    limit 93) as subq_0
              where cast(null as t[]) && cast(null as t[])
              limit 129) as subq_1
        where case when ref_0.usmallint is NULL then cast(null as geometry) else cast(null as geometry) end
             && cast(null as geometry)
        limit 65) as subq_2
  where current_schema() ~~~ (select varchar from main.all_types limit 1 offset 2)
      )
select  
    subq_3.c0 as c0, 
    ref_2.utinyint as c1
  from 
    (select  
            ref_1.time_tz as c0
          from 
            main.all_types as ref_1
          where EXISTS (
            select  
                ref_1.hugeint as c0, 
                sample_4.date_array as c1, 
                sample_4.interval as c2, 
                ref_1.fixed_struct_array as c3, 
                ref_1.int_array as c4, 
                sample_4.timestamp_array as c5, 
                sample_4.date_array as c6, 
                ref_1.int_array as c7, 
                33 as c8, 
                ref_1.dec_4_1 as c9, 
                25 as c10
              from 
                main.all_types as sample_4 tablesample system (3.4) 
              where ref_1.varchar ~~* ref_1.varchar)
          limit 137) as subq_3
      inner join main.all_types as ref_2
      on (case when 1 then ref_2.varchar else ref_2.varchar end
             !~~* ref_2.varchar)
  where 0
  limit 87;
WITH 
jennifer_0 AS (select  
    get_current_timestamp() as c0, 
    __internal_compress_integral_utinyint(
      cast(ref_0.hugeint as hugeint),
      cast(ref_0.hugeint as hugeint)) as c1, 
    subq_1.c1 as c2
  from 
    main.all_types as ref_0
      left join (select  
            ref_1.varchar as c0, 
            ref_1.varchar as c1
          from 
            main.all_types as ref_1
              left join main.all_types as ref_2
              on (cast(null as t[]) <@ cast(null as t[])),
            lateral (select  
                  ref_1.union as c0, 
                  ref_1.varchar as c1, 
                  ref_1.list_of_fixed_int_array as c2, 
                  ref_1.bit as c3, 
                  sample_0.fixed_varchar_array as c4, 
                  ref_2.ubigint as c5, 
                  sample_0.date as c6, 
                  ref_2.tinyint as c7, 
                  ref_2.timestamp_tz as c8
                from 
                  main.all_types as sample_0 tablesample system (3) 
                where ((EXISTS (
                      select  
                          ref_2.union as c0
                        from 
                          main.all_types as ref_3
                        where ref_1.varchar !~~* cast(null as varchar)
                        limit 109)) 
                    or ((select ubigint from main.all_types limit 1 offset 6)
                         is NULL)) 
                  or (sample_0.varchar ~~ ref_1.varchar)) as subq_0
          where 0) as subq_1
      on (ref_0.varchar = subq_1.c0 ),
    lateral (select  
          ref_5.bignum as c0
        from 
          main.all_types as ref_4
            inner join main.all_types as ref_5
            on (EXISTS (
                select  
                    ref_5.bigint as c0, 
                    subq_1.c1 as c1, 
                    ref_0.blob as c2, 
                    ref_5.timestamptz_array as c3
                  from 
                    main.all_types as sample_1 tablesample bernoulli (6.1) 
                  where 1
                  limit 184))
        where ref_0.varchar ~~ subq_1.c1) as subq_2
  where 1
  limit 176)
select  
    (select uint from main.all_types limit 1 offset 3)
       as c0, 
    subq_5.c3 as c1, 
    (select bit from main.all_types limit 1 offset 4)
       as c2, 
    subq_5.c2 as c3, 
    subq_5.c0 as c4, 
    subq_5.c0 as c5, 
    subq_5.c1 as c6, 
    subq_5.c1 as c7, 
    subq_5.c2 as c8
  from 
    (select  
          subq_4.c5 as c0, 
          sample_2.timestamp_ns as c1, 
          subq_4.c6 as c2, 
          (select dec_18_6 from main.all_types limit 1 offset 6)
             as c3, 
          sample_2.fixed_nested_int_array as c4, 
          subq_4.c1 as c5
        from 
          main.all_types as sample_2 tablesample bernoulli (3.6) ,
          lateral (select  
                subq_3.c5 as c0, 
                ref_6.bigint as c1, 
                subq_3.c7 as c2, 
                ref_6.smallint as c3, 
                92 as c4, 
                (select usmallint from main.all_types limit 1 offset 5)
                   as c5, 
                ref_6.bit as c6
              from 
                main.all_types as ref_6,
                lateral (select  
                      sample_2.array_of_structs as c0, 
                      ref_6.bigint as c1, 
                      ref_6.array_of_structs as c2, 
                      ref_6.fixed_array_of_int_list as c3, 
                      ref_7.nested_int_array as c4, 
                      sample_2.date_array as c5, 
                      ref_7.timestamp_ms as c6, 
                      sample_2.fixed_struct_array as c7
                    from 
                      main.all_types as ref_7
                    where 1) as subq_3
              where 1
              limit 133) as subq_4
        where case when sample_2.varchar ~~ sample_2.varchar then cast(null as t[]) else cast(null as t[]) end
             @> cast(null as t[])
        limit 98) as subq_5
  where current_schema() ~~ version()
  limit 121;
select  
  (select usmallint from main.all_types limit 1 offset 80)
     as c0, 
  subq_0.c0 as c1, 
  subq_0.c0 as c2, 
  subq_0.c0 as c3, 
  subq_0.c0 as c4, 
  subq_0.c0 as c5
from 
  (select  
        sample_0.time as c0
      from 
        main.all_types as sample_0 tablesample system (1.1) 
      where 0) as subq_0
where EXISTS (
  select  
      (select nested_int_array from main.all_types limit 1 offset 2)
         as c0, 
      subq_0.c0 as c1, 
      case when sample_1.varchar ~~ sample_1.varchar then (select hugeint from main.all_types limit 1 offset 5)
           else (select hugeint from main.all_types limit 1 offset 5)
           end
         as c2, 
      sample_1.time as c3, 
      sample_1.struct_of_fixed_array as c4, 
      subq_0.c0 as c5, 
      (select tinyint from main.all_types limit 1 offset 6)
         as c6, 
      subq_0.c0 as c7, 
      subq_0.c0 as c8, 
      subq_0.c0 as c9, 
      subq_0.c0 as c10, 
      cast(nullif(sample_1.hugeint,
        sample_1.hugeint) as hugeint) as c11
    from 
      main.all_types as sample_1 tablesample system (4.7) 
    where sample_1.varchar !~~ sample_1.varchar)
limit 110;
select  
  subq_0.c0 as c0, 
  subq_0.c2 as c1, 
  
    arg_min_null(
      cast(reduce(
        cast(cast(null as any[]) as any[]),
        cast(cast(null as any[]) as any[])) as any),
      cast(cast(null as any) as any)) over (partition by subq_0.c1 order by subq_0.c0) as c2, 
  
    arg_max_null(
      cast(cast(coalesce(case when (cast(null as varchar) !~~ (select varchar from main.all_types limit 1 offset 93)
                ) 
            or ((select varchar from main.all_types limit 1 offset 3)
                 ~~ (select varchar from main.all_types limit 1 offset 2)
                ) then add(
            cast((select date from main.all_types limit 1 offset 3)
               as date),
            cast((select date from main.all_types limit 1 offset 1)
               as date)) else add(
            cast((select date from main.all_types limit 1 offset 3)
               as date),
            cast((select date from main.all_types limit 1 offset 1)
               as date)) end
          ,
        (select date from main.all_types limit 1 offset 57)
          ) as date) as date),
      cast(cast(null as date) as date)) over (partition by subq_0.c1,subq_0.c2 order by subq_0.c3,subq_0.c1) as c3, 
  subq_0.c3 as c4
from 
  (select  
        sample_0.utinyint as c0, 
        case when sample_0.fixed_varchar_array is not NULL then sample_0.dec_18_6 else sample_0.dec_18_6 end
           as c1, 
        sample_0.bit as c2, 
        case when 0 then sample_0.uint else sample_0.uint end
           as c3
      from 
        main.all_types as sample_0 tablesample bernoulli (1.4) 
      where cast(nullif(list_where(
            cast(cast(null as t[]) as t[]),
            cast(cast(null as t[]) as t[])),
          cast(null as t[])) as t[]) @> case when (cast(null as geometry) && cast(null as geometry)) 
            and (sample_0.varchar ^@ sample_0.varchar) then cast(null as t[]) else cast(null as t[]) end
          
      limit 124) as subq_0
where current_database() !~~ cast(null as varchar)
limit 114;
update main.all_types set 
  tinyint = main.all_types.tinyint, 
  uhugeint = main.all_types.uhugeint, 
  utinyint = main.all_types.utinyint, 
  time = main.all_types.time, 
  timestamp_s = main.all_types.timestamp_s, 
  timestamp_ms = cast(null as timestamp_ms), 
  time_tz = get_current_time(), 
  timestamp_tz = main.all_types.timestamp_tz, 
  float = main.all_types.float, 
  double = main.all_types.double, 
  dec_9_4 = main.all_types.dec_9_4, 
  dec_18_6 = main.all_types.dec_18_6, 
  dec38_10 = main.all_types.dec38_10, 
  int_array = main.all_types.int_array, 
  timestamp_array = main.all_types.timestamp_array, 
  varchar_array = main.all_types.varchar_array, 
  struct = main.all_types.struct, 
  struct_of_arrays = case when array_distinct(
        cast(cast(null as t[]) as t[])) @> cast(null as t[]) then main.all_types.struct_of_arrays else main.all_types.struct_of_arrays end
    , 
  array_of_structs = main.all_types.array_of_structs, 
  map = (select map from main.all_types limit 1 offset 6)
    , 
  fixed_int_array = main.all_types.fixed_int_array, 
  fixed_varchar_array = main.all_types.fixed_varchar_array, 
  fixed_struct_array = main.all_types.fixed_struct_array, 
  fixed_array_of_int_list = main.all_types.fixed_array_of_int_list, 
  list_of_fixed_int_array = main.all_types.list_of_fixed_int_array
returning 
  (select int from main.all_types limit 1 offset 1)
     as c0;
select  
  subq_1.c0 as c0, 
  subq_1.c1 as c1, 
  subq_1.c0 as c2, 
  ref_0.utinyint as c3, 
  13 as c4, 
  subq_1.c1 as c5, 
  ref_0.uint as c6, 
  ref_0.struct as c7
from 
  main.all_types as ref_0,
  lateral (select  
        
          arg_min_nulls_last(
            cast(ref_0.blob as blob),
            cast(ref_0.blob as blob)) over (partition by ref_0.list_of_fixed_int_array order by subq_0.c1) as c0, 
        ref_0.uint as c1
      from 
        (select  
              ref_0.bignum as c0, 
              sample_0.varchar_array as c1, 
              ref_0.timestamp_s as c2, 
              ref_0.time_tz as c3
            from 
              main.all_types as sample_0 tablesample system (9.9) 
                inner join main.all_types as sample_1 tablesample bernoulli (9.1) 
                on (sample_0.bigint = sample_1.bigint )
            where (((select varchar from main.all_types limit 1 offset 5)
                     ~~ sample_1.varchar) 
                or (sample_1.int_array is NULL)) 
              and (cast(null as t[]) @> cast(null as t[]))) as subq_0
      where 0
      limit 57) as subq_1
where cast(null as t[]) @> cast(nullif(flatten(
      cast(cast(nullif(cast(null as t[][]),
        case when ref_0.varchar ^@ ref_0.varchar then case when (((ref_0.varchar !~~ ref_0.varchar) 
                  or (ref_0.varchar ~~~ ref_0.varchar)) 
                and (ref_0.varchar ~~ ref_0.varchar)) 
              and (1) then cast(null as t[][]) else cast(null as t[][]) end
             else case when (((ref_0.varchar !~~ ref_0.varchar) 
                  or (ref_0.varchar ~~~ ref_0.varchar)) 
                and (ref_0.varchar ~~ ref_0.varchar)) 
              and (1) then cast(null as t[][]) else cast(null as t[][]) end
             end
          ) as t[][]) as t[][])),
    case when cast(null as geometry) && case when 1 then cast(coalesce(cast(null as geometry),
            cast(null as geometry)) as geometry) else cast(coalesce(cast(null as geometry),
            cast(null as geometry)) as geometry) end
           then case when ((select varchar from main.all_types limit 1 offset 21)
               !~~ ref_0.varchar) 
          and (EXISTS (
            select  
                subq_1.c1 as c0, 
                ref_0.uhugeint as c1, 
                sample_2.bit as c2
              from 
                main.all_types as sample_2 tablesample system (6.4) 
              where (subq_1.c1 is NULL) 
                and (ref_0.timestamp is NULL)
              limit 96)) then case when ref_0.varchar !~~ ref_0.varchar then cast(null as t[]) else cast(null as t[]) end
           else case when ref_0.varchar !~~ ref_0.varchar then cast(null as t[]) else cast(null as t[]) end
           end
         else case when ((select varchar from main.all_types limit 1 offset 21)
               !~~ ref_0.varchar) 
          and (EXISTS (
            select  
                subq_1.c1 as c0, 
                ref_0.uhugeint as c1, 
                sample_2.bit as c2
              from 
                main.all_types as sample_2 tablesample system (6.4) 
              where (subq_1.c1 is NULL) 
                and (ref_0.timestamp is NULL)
              limit 96)) then case when ref_0.varchar !~~ ref_0.varchar then cast(null as t[]) else cast(null as t[]) end
           else case when ref_0.varchar !~~ ref_0.varchar then cast(null as t[]) else cast(null as t[]) end
           end
         end
      ) as t[])
limit 132;
select  
  sample_1.struct_of_arrays as c0, 
  ref_2.varchar_array as c1, 
  ref_1.date as c2, 
  ref_0.dec_9_4 as c3
from 
  main.all_types as ref_0
    right join main.all_types as ref_1
            inner join main.all_types as sample_0 tablesample system (3.2) 
              inner join main.all_types as sample_1 tablesample bernoulli (6.4) 
              on (0)
            on (sample_1.varchar ~~* ref_1.varchar)
          right join main.all_types as ref_2
            inner join main.all_types as ref_3
              right join main.all_types as ref_4
              on (ref_3.hugeint is NULL)
            on (1)
          on (ref_2.varchar !~~ ref_2.varchar)
        inner join main.all_types as sample_2 tablesample system (3.7) 
        on (sample_1.timestamp_tz = sample_2.timestamp_tz )
      left join main.all_types as sample_3 tablesample system (5.5) 
      on (sample_2.varchar ~~ cast(null as varchar))
    on (ref_0.ubigint = sample_3.ubigint )
where 0
limit 84;
insert into main.all_types values (
0, 
cast(null as tinyint), 
case when 36 is not NULL then cast(null as smallint) else cast(null as smallint) end
  , 
11, 
default, 
cast(null as hugeint), 
cast(null as uhugeint), 
default, 
cast(null as usmallint), 
cast(null as uinteger), 
case when 0 then hash(
    cast(case when 64 is not NULL then cast(null as any) else cast(null as any) end
       as any)) else hash(
    cast(case when 64 is not NULL then cast(null as any) else cast(null as any) end
       as any)) end
  , 
cast(null as bignum), 
default, 
cast(null as time), 
cast(null as timestamp), 
cast(null as timestamp_s), 
default, 
default, 
cast(null as time with time zone), 
get_current_timestamp(), 
cast(null as float), 
pi(), 
case when 0 then case when cast(null as t[]) && cast(null as t[]) then (select dec_4_1 from main.all_types limit 1 offset 4)
       else (select dec_4_1 from main.all_types limit 1 offset 4)
       end
     else case when cast(null as t[]) && cast(null as t[]) then (select dec_4_1 from main.all_types limit 1 offset 4)
       else (select dec_4_1 from main.all_types limit 1 offset 4)
       end
     end
  , 
default, 
case when ((95 is NULL) 
      or (cast(null as varchar) !~~* cast(null as varchar))) 
    or (3 is NULL) then cast(null as decimal(18,6)) else cast(null as decimal(18,6)) end
  , 
case when (46 is NULL) 
    and (cast(null as varchar) ^@ cast(null as varchar)) then cast(null as decimal(38,10)) else cast(null as decimal(38,10)) end
  , 
default, 
default, 
icu_collate_ru(
  cast(cast(null as varchar) as varchar)), 
cast(nullif(cast(null as blob),
  cast(null as blob)) as blob), 
cast(null as bit), 
default, 
default, 
cast(null as date[]), 
cast(null as timestamp[]), 
default, 
cast(null as varchar[]), 
default, 
(select struct from main.all_types limit 1 offset 5)
  , 
default, 
cast(null as struct(a integer, b varchar)[]), 
default, 
default, 
cast(null as integer[3]), 
cast(null as varchar[3]), 
default, 
default, 
cast(coalesce(case when cast(null as varchar) ~~~ cast(null as varchar) then cast(null as struct(a integer, b varchar)[3]) else cast(null as struct(a integer, b varchar)[3]) end
    ,
  cast(null as struct(a integer, b varchar)[3])) as struct(a integer, b varchar)[3]), 
cast(null as struct(a integer[3], b varchar[3])), 
default, 
case when 44 is not NULL then cast(null as integer[3][]) else cast(null as integer[3][]) end
  );
select  
  (select int from main.all_types limit 1 offset 4)
     as c0, 
  subq_0.c8 as c1, 
  subq_0.c4 as c2
from 
  (select  
        92 as c0, 
        (select list_of_fixed_int_array from main.all_types limit 1 offset 3)
           as c1, 
        sample_0.time_tz as c2, 
        sample_0.interval as c3, 
        8 as c4, 
        sample_0.fixed_nested_varchar_array as c5, 
        sample_0.time_tz as c6, 
        (select fixed_struct_array from main.all_types limit 1 offset 2)
           as c7, 
        sample_0.timestamp_ns as c8, 
        sample_0.ubigint as c9
      from 
        main.all_types as sample_0 tablesample bernoulli (4.2) 
      where case when sample_0.varchar ~~* sample_0.varchar then cast(null as geometry) else cast(null as geometry) end
           && st_geomfromwkb(
          cast(sample_0.blob as blob))) as subq_0
where subq_0.c5 is not NULL
limit 100;
select  
  ref_0.timestamp_tz as c0, 
  ref_0.fixed_nested_int_array as c1, 
  ref_0.fixed_array_of_int_list as c2
from 
  main.all_types as ref_0
where (st_geomfromwkb(
      cast(ref_0.blob as blob)) && case when ref_0.timestamp_ms is NULL then cast(null as geometry) else cast(null as geometry) end
      ) 
  and (cast(nullif(case when 73 is not NULL then case when (select varchar from main.all_types limit 1 offset 1)
               ^@ ref_0.varchar then cast(null as geometry) else cast(null as geometry) end
           else case when (select varchar from main.all_types limit 1 offset 1)
               ^@ ref_0.varchar then cast(null as geometry) else cast(null as geometry) end
           end
        ,
      st_geomfromwkb(
        cast(cast(null as blob) as blob))) as geometry) && st_geomfromwkb(
      cast(ref_0.blob as blob)))
limit 109;
select  
  ref_0.timestamp_ns as c0, 
  ref_0.bit as c1
from 
  main.all_types as ref_0
where (ref_0.varchar ^@ (select varchar from main.all_types limit 1 offset 3)
      ) 
  and (EXISTS (
    select  
        ref_0.time_tz as c0
      from 
        main.all_types as sample_0 tablesample bernoulli (7.3) 
          inner join main.all_types as sample_1 tablesample system (6.4) 
          on (sample_0.double_array is not NULL)
      where sample_0.varchar ~~* case when 0 then sample_0.varchar else sample_0.varchar end
          
      limit 100))
limit 40;

Error Message

Parser Error: Sample method Bernoulli cannot be used with a discrete sample count, either switch to reservoir sampling or use a sample_size

Stack Trace

Catalog Error: Type with name t does not exist!
Did you mean "text"?
Catalog Error: Type with name t does not exist!
Did you mean "text"?
Catalog Error: Type with name t does not exist!
Did you mean "text"?
Catalog Error: Type with name t does not exist!
Did you mean "text"?
Catalog Error: Type with name t does not exist!
Did you mean "text"?
Catalog Error: Type with name t does not exist!
Did you mean "text"?
ABORT THROWN BY INTERNAL EXCEPTION: Assertion triggered in file "/home/runner/work/duckdb-fuzzer-ci/duckdb-fuzzer-ci/src/common/types/hash.cpp" on line 143: h == Hash(val.GetData(), val.GetSize())

duckdb::StackTrace::GetStackTrace[abi:cxx11](unsigned long) 
duckdb::InternalException::InternalException(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) 
duckdb::InternalException::InternalException<char const*&, int&, char const*&>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*&, int&, char const*&) 
duckdb::DuckDBAssertInternal(bool, char const*, char const*, int) 
unsigned long duckdb::Hash<duckdb::string_t>(duckdb::string_t) 
 
 
 
duckdb::VectorOperations::Hash(duckdb::Vector&, duckdb::Vector&, unsigned long) 
duckdb::DistinctStatistics::UpdateInternal(duckdb::Vector&, unsigned long, duckdb::Vector&) 
duckdb::DistinctStatistics::UpdateSample(duckdb::Vector&, unsigned long, duckdb::Vector&) 
duckdb::ColumnStatistics::UpdateDistinctStatistics(duckdb::Vector&, unsigned long, duckdb::Vector&) 
duckdb::RowGroupCollection::Append(duckdb::DataChunk&, duckdb::TableAppendState&) 
duckdb::LocalStorage::Append(duckdb::LocalAppendState&, duckdb::DataChunk&, duckdb::DataTableInfo&) 
duckdb::DataTable::LocalAppend(duckdb::LocalAppendState&, duckdb::ClientContext&, duckdb::DataChunk&, bool) 
duckdb::DataTable::LocalAppend(duckdb::TableCatalogEntry&, duckdb::ClientContext&, duckdb::DataChunk&, duckdb::vector<duckdb::unique_ptr<duckdb::BoundConstraint, std::default_delete<duckdb::BoundConstraint>, true>, true, std::allocator<duckdb::unique_ptr<duckdb::BoundConstraint, std::default_delete<duckdb::BoundConstraint>, true> > > const&, duckdb::Vector&, duckdb::DataChunk&) 
duckdb::PhysicalUpdate::Sink(duckdb::ExecutionContext&, duckdb::DataChunk&, duckdb::OperatorSinkInput&) const 
duckdb::PipelineExecutor::Sink(duckdb::DataChunk&, duckdb::OperatorSinkInput&) 
duckdb::PipelineExecutor::ExecutePushInternal(duckdb::DataChunk&, duckdb::ExecutionBudget&, unsigned long) 
duckdb::PipelineExecutor::Execute(unsigned long) 
duckdb::PipelineTask::ExecuteTask(duckdb::TaskExecutionMode) 
duckdb::ExecutorTask::Execute(duckdb::TaskExecutionMode) 
duckdb::Executor::ExecuteTask(bool) 
duckdb::ClientContext::ExecuteTaskInternal(duckdb::ClientContextLock&, duckdb::BaseQueryResult&, bool) 
duckdb::PendingQueryResult::ExecuteTaskInternal(duckdb::ClientContextLock&) 
duckdb::PendingQueryResult::ExecuteInternal(duckdb::ClientContextLock&) 
duckdb::PendingQueryResult::Execute() 
duckdb::ClientContext::Query(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>, bool) 
duckdb::Connection::Query(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>) 
duckdb_shell::ShellState::ExecuteStatement(duckdb::unique_ptr<duckdb::SQLStatement, std::default_delete<duckdb::SQLStatement>, true>) 
duckdb_shell::ShellState::ExecuteSQL(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) 
duckdb_shell::ShellState::RunOneSqlLine(duckdb_shell::InputMode, char*) 
duckdb_shell::ShellState::ProcessInput(duckdb_shell::InputMode) 
main 
_start

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions