use of org.apache.hive.service.rpc.thrift.TRow 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");
}
};
}
use of org.apache.hive.service.rpc.thrift.TRow in project hive by apache.
the class RowBasedSet method addRow.
@Override
public RowBasedSet addRow(Object[] fields) {
TRow tRow = new TRow();
for (int i = 0; i < fields.length; i++) {
tRow.addToColVals(ColumnValue.toTColumnValue(descriptors[i], fields[i]));
}
rows.add(tRow);
return this;
}
use of org.apache.hive.service.rpc.thrift.TRow in project hive by apache.
the class RowBasedSet method toTRowSet.
public TRowSet toTRowSet() {
TRowSet tRowSet = new TRowSet();
tRowSet.setStartRowOffset(startOffset);
tRowSet.setRows(new ArrayList<TRow>(rows));
return tRowSet;
}
use of org.apache.hive.service.rpc.thrift.TRow in project hive by apache.
the class ColumnBasedSet method toTRowSet.
public TRowSet toTRowSet() {
TRowSet tRowSet = new TRowSet(startOffset, new ArrayList<TRow>());
if (isBlobBased) {
tRowSet.setColumns(null);
tRowSet.setBinaryColumns(blob);
tRowSet.setColumnCount(numColumns());
} else {
for (int i = 0; i < columns.size(); i++) {
tRowSet.addToColumns(columns.get(i).toTColumn());
}
}
return tRowSet;
}
Aggregations