Skip to content

Fix Java client time column access throwing ArrayIndexOutOfBoundsException for non-long typed getters #17407

@PDGGK

Description

@PDGGK

Search before asking

  • I searched in the issues and found nothing similar.

Version

Master

Describe the bug and provide the minimal reproduce step

In IoTDBRpcDataSet.java, several ByTsBlockColumnIndex getter methods do not handle the tsBlockColumnIndex < 0 case (time pseudo-column in tree model). Only getLongByTsBlockColumnIndex and getStringByTsBlockColumnIndex correctly handle this case.

When tree model is used, column index 1 maps to tsBlockColumnIndex = -1 (time column). Accessing it through typed getters other than getLong or getString causes ArrayIndexOutOfBoundsException from TsBlock.getColumn(-1).

Affected methods:

  • getBooleanByTsBlockColumnIndex
  • getIntByTsBlockColumnIndex
  • getFloatByTsBlockColumnIndex
  • getDoubleByTsBlockColumnIndex
  • getBinaryByTsBlockColumnIndex
  • getObjectByTsBlockColumnIndex

This is the Java equivalent of the C++ client bug fixed in #17400.

What did you expect to see?

A clear StatementExecutionException with message like "Cannot read boolean from time column" instead of an opaque ArrayIndexOutOfBoundsException.

What did you see instead?

ArrayIndexOutOfBoundsException with index -1.

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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions