Skip to content

[Bug] JDBC Query Returns Wrong Data - Column Mapping Issue #17317

@sym233

Description

@sym233

Search before asking

  • I searched in the issues and found nothing similar.

Version

IoTDB: 2.0.7-SNAPSHOT
JDBC Driver: iotdb-jdbc 2.0.7-SNAPSHOT

IoTDB Database: 1.3.6-standalone

I found this issue may be related to 2.0.7 driver connecting to 1.3.6 database. It looks fine when connecting to 2.0.7 database.

Describe the bug and provide the minimal reproduce step

  1. Create a time series with BOOLEAN and FLOAT columns:
CREATE TIMESERIES root.ln.wf01.wt01.status BOOLEAN
CREATE TIMESERIES root.ln.wf01.wt01.temperature FLOAT
  1. Insert some test data:
INSERT INTO root.ln.wf01.wt01 (Time, status, temperature) VALUES (1, true, 25.5)
  1. Query the data using JDBC:
ResultSet rs = stmt.executeQuery("select status, temperature from root.ln.wf01.wt01 limit 1");
ResultSetMetaData meta = rs.getMetaData();
while (rs.next()) {
    for (int i = 1; i <= meta.getColumnCount(); i++) {
        System.out.println(meta.getColumnName(i) + " = " + rs.getObject(i));
    }
}

What did you expect to see?

=== Column Metadata ===
Column 1: Time, Type: 93 (TIMESTAMP)
Column 2: root.ln.wf01.wt01.status, Type: 16 (BOOLEAN)
Column 3: root.ln.wf01.wt01.temperature, Type: 6 (FLOAT)

=== Query Result ===
root.ln.wf01.wt01.status = true (class: java.lang.Boolean)
root.ln.wf01.wt01.temperature = 25.5 (class: java.lang.Float)

What did you see instead?

=== Column Metadata ===
Column 1: Time, Type: 93 (TIMESTAMP)
Column 2: root.ln.wf01.wt01.status, Type: 16 (BOOLEAN)
Column 3: root.ln.wf01.wt01.temperature, Type: 6 (FLOAT)

=== Query Result ===
root.ln.wf01.wt01.status = 10.0 (class: java.lang.Float)
root.ln.wf01.wt01.temperature = true (class: java.lang.Boolean)

The BOOLEAN and FLOAT column values are completely swapped!

Anything else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions