• Andrew Kimball's avatar
    opt: Fix panic in SQLSmith query · 039a2df2
    Andrew Kimball authored
    A SQLSmith query exposed a bug in the expression interner. This bug caused
    the interner to consider empty literal arrays to be equal, even if their
    static types are different. For example:
    
      ARRAY[]:::string[]
      ARRAY[]:::int[]
    
    An empty string array should not be treated as the same as an empty int
    array. The fix is to consult the static type of the array in addition to the
    types of its elements (but only when there are zero elements or one of the
    elements is null).
    
    In addition, I took the opportunity to make the existing Tuple interner code
    faster, by only comparing static types when lables or nulls are present. I
    also fixed the bytes reuse code by storing back resized byte arrays.
    
    Fixes #34439
    
    Release note: None
    039a2df2
interner.go 23.5 KB