Skip to content

ClickHouseRowMetadata index should start at 0 #1378

@murzart

Description

@murzart

Describe the bug

ClickHouseRowMetadata is starting the index at 1, but the index should be starting at 0, according to the spec.

Expected behaviour

Should work according to spec. Index should start at 0.

Code example

    for (int i = 0; i < rowMetadata.getColumnMetadatas().size(); i++) {
      String name = rowMetadata.getColumnMetadata(i).getName(); // failing at 0.. i + 1 works
      Object value = row.get(i); // works fine

      map.put(name, value);
    }

Error log

java.lang.IllegalArgumentException: -1
        at java.util.stream.ReferencePipeline.skip(ReferencePipeline.java:575) ~[?:?]
        at com.clickhouse.r2dbc.ClickHouseRowMetadata.getColumnMetadata(ClickHouseRowMetadata.java:24) ~[clickhouse-r2dbc-0.4.6.jar:clickhouse-r2dbc 0.4.6 (revision: dd91e17)]
        ...

Configuration

Environment

  • clickhouse-jdbc version: 0.4.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions