Search in sources :

Example 1 with TColumnValue

use of org.apache.hive.service.rpc.thrift.TColumnValue in project hive by apache.

the class RowBasedSet method iterator.

@Override
public Iterator<Object[]> iterator() {
    return new Iterator<Object[]>() {

        final Iterator<TRow> iterator = rows.iterator();

        final Object[] convey = new Object[numColumns()];

        @Override
        public boolean hasNext() {
            return iterator.hasNext();
        }

        @Override
        public Object[] next() {
            TRow row = iterator.next();
            List<TColumnValue> values = row.getColVals();
            for (int i = 0; i < values.size(); i++) {
                convey[i] = ColumnValue.toColumnValue(values.get(i));
            }
            return convey;
        }

        @Override
        public void remove() {
            throw new UnsupportedOperationException("remove");
        }
    };
}
Also used : TRow(org.apache.hive.service.rpc.thrift.TRow) Iterator(java.util.Iterator) TColumnValue(org.apache.hive.service.rpc.thrift.TColumnValue)

Aggregations

Iterator (java.util.Iterator)1 TColumnValue (org.apache.hive.service.rpc.thrift.TColumnValue)1 TRow (org.apache.hive.service.rpc.thrift.TRow)1