I think you are generating code for a RelNode in Enumerable convention, so you need to adhere to that convention -- an Enumerable that contains arrays for 2 or more columns, singleton values for 1 column, or possibly a synthetic class if you specify an element type. So it's an Enumerable<Object> rather than an Enumerable<Object[]>.
Other people who are just implementing a provider for Avatica should provide an Iterable<Object[]>. Rows will be arrays even if they only have one column. Julian > On Apr 3, 2015, at 12:39 PM, Maryann Xue <[email protected]> wrote: > > 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
