Skip to content

Incorrect parsing of complex types (Arrays and Tuples) #103

Closed
@Aivean

Description

Here are some cases that I've found (rs is a ResultSet instance):

  1. Tuple:

    select ('1', 2) as a;
    

    can only be extracted as String:

    rs.getMetaData.getColumnTypeName(1) = "Tuple(String, UInt8)"
    rs.getObject(1) = "('1',2)"
    
  2. Nested arrays:

    select [[1,2], [3,4]] as a;
    

    cannot be extracted as Array:

    rs.getMetaData.getColumnTypeName(1) = "Array(Array(UInt8))"
    rs.getObject(1) // Method threw 'java.lang.RuntimeException' exception.
                               // Parse exception: ByteFragment{[[[1,2],[3,4]]], start=0, len=13}
    rs.getArray(1) // Method threw 'java.lang.IllegalStateException' exception.
    
  3. Tuples nested in Array:

    select [('a',1), ('b', 2)] as a;
    

    strange parsing behavior when parsed as Array:

    rs.getMetaData.getColumnTypeName(1) = Array(Tuple(String, UInt8))
    rs.getArray(1)={ru.yandex.clickhouse.ClickHouseArray}:
           array = {java.lang.String[4]@3644} 
           0 = "('a'"
           1 = "1)"
           2 = "('b'"
           3 = "2)"
    

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions