Hi,

We implemented a sub-class of Enumerator<Object[]> to convert a Phoenix
ResultIterator to an Enumerator, but hit a problem when selecting only one
column in the query. While calling resultSet.getObject(1), the entire
object array is returned instead of the first element in the array.
Debugged and found that the below method of CalciteResultSet was the cause.
So does this look like a bug, or should we implement the enumerator
differently?

  private Cursor createCursor(ColumnMetaData.AvaticaType elementType,

      Iterable iterable) {

    final Enumerator enumerator = Linq4j.iterableEnumerator(iterable);

    //noinspection unchecked

    return !(elementType instanceof ColumnMetaData.StructType)

        || ((ColumnMetaData.StructType) elementType).columns.size() == 1

        ? new ObjectEnumeratorCursor(enumerator)

        : new ArrayEnumeratorCursor(enumerator);

  }



Thanks,

Maryann

Reply via email to