public static TColumn doubleVal(TDoubleColumn value) { TColumn x = new TColumn(); x.setDoubleVal(value); return x; }
public static TColumn binaryVal(TBinaryColumn value) { TColumn x = new TColumn(); x.setBinaryVal(value); return x; }
public static TColumn boolVal(TBoolColumn value) { TColumn x = new TColumn(); x.setBoolVal(value); return x; }
public static TColumn byteVal(TByteColumn value) { TColumn x = new TColumn(); x.setByteVal(value); return x; }
public TColumn toTColumn() { TColumn value = new TColumn(); ByteBuffer nullMasks = ByteBuffer.wrap(toBinary(nulls)); switch (type) { case BOOLEAN_TYPE: value.setBoolVal(new TBoolColumn(Booleans.asList(Arrays.copyOfRange(boolVars, 0, size)), nullMasks)); break; case TINYINT_TYPE: value.setByteVal(new TByteColumn(Bytes.asList(Arrays.copyOfRange(byteVars, 0, size)), nullMasks)); break; case SMALLINT_TYPE: value.setI16Val(new TI16Column(Shorts.asList(Arrays.copyOfRange(shortVars, 0, size)), nullMasks)); break; case INT_TYPE: value.setI32Val(new TI32Column(Ints.asList(Arrays.copyOfRange(intVars, 0, size)), nullMasks)); break; case BIGINT_TYPE: value .setI64Val(new TI64Column(Longs.asList(Arrays.copyOfRange(longVars, 0, size)), nullMasks)); break; case FLOAT_TYPE: case DOUBLE_TYPE: value.setDoubleVal(new TDoubleColumn(Doubles.asList(Arrays.copyOfRange(doubleVars, 0, size)), nullMasks)); break; case STRING_TYPE: value.setStringVal(new TStringColumn(stringVars, nullMasks));
public ColumnBasedSet(TRowSet tRowSet) throws TException { descriptors = null; columns = new ArrayList<ColumnBuffer>(); // Use TCompactProtocol to read serialized TColumns if (tRowSet.isSetBinaryColumns()) { TProtocol protocol = new TCompactProtocol(new TIOStreamTransport(new ByteArrayInputStream( tRowSet.getBinaryColumns()))); // Read from the stream using the protocol for each column in final schema for (int i = 0; i < tRowSet.getColumnCount(); i++) { TColumn tvalue = new TColumn(); try { tvalue.read(protocol); } catch (TException e) { LOG.error(e.getMessage(), e); throw new TException("Error reading column value from the row set blob", e); } columns.add(new ColumnBuffer(tvalue)); } } else { if (tRowSet.getColumns() != null) { for (TColumn tvalue : tRowSet.getColumns()) { columns.add(new ColumnBuffer(tvalue)); } } } startOffset = tRowSet.getStartRowOffset(); }
public static TColumn stringVal(TStringColumn value) { TColumn x = new TColumn(); x.setStringVal(value); return x; }
public TColumn deepCopy() { return new TColumn(this); }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } }
public TColumn toTColumn() { TColumn value = new TColumn(); ByteBuffer nullMasks = ByteBuffer.wrap(toBinary(nulls)); switch (type) { case BOOLEAN_TYPE: value.setBoolVal(new TBoolColumn(Booleans.asList(Arrays.copyOfRange(boolVars, 0, size)), nullMasks)); break; case TINYINT_TYPE: value.setByteVal(new TByteColumn(Bytes.asList(Arrays.copyOfRange(byteVars, 0, size)), nullMasks)); break; case SMALLINT_TYPE: value.setI16Val(new TI16Column(Shorts.asList(Arrays.copyOfRange(shortVars, 0, size)), nullMasks)); break; case INT_TYPE: value.setI32Val(new TI32Column(Ints.asList(Arrays.copyOfRange(intVars, 0, size)), nullMasks)); break; case BIGINT_TYPE: value .setI64Val(new TI64Column(Longs.asList(Arrays.copyOfRange(longVars, 0, size)), nullMasks)); break; case FLOAT_TYPE: case DOUBLE_TYPE: value.setDoubleVal(new TDoubleColumn(Doubles.asList(Arrays.copyOfRange(doubleVars, 0, size)), nullMasks)); break; case STRING_TYPE: value.setStringVal(new TStringColumn(stringVars, nullMasks));
/** * Performs a deep copy on <i>other</i>. */ public TRowSet(TRowSet other) { __isset_bitfield = other.__isset_bitfield; this.startRowOffset = other.startRowOffset; if (other.isSetRows()) { List<TRow> __this__rows = new ArrayList<TRow>(other.rows.size()); for (TRow other_element : other.rows) { __this__rows.add(new TRow(other_element)); } this.rows = __this__rows; } if (other.isSetColumns()) { List<TColumn> __this__columns = new ArrayList<TColumn>(other.columns.size()); for (TColumn other_element : other.columns) { __this__columns.add(new TColumn(other_element)); } this.columns = __this__columns; } if (other.isSetBinaryColumns()) { this.binaryColumns = org.apache.thrift.TBaseHelper.copyBinary(other.binaryColumns); } this.columnCount = other.columnCount; }
public ColumnBasedSet(TRowSet tRowSet) throws TException { descriptors = null; columns = new ArrayList<ColumnBuffer>(); // Use TCompactProtocol to read serialized TColumns if (tRowSet.isSetBinaryColumns()) { TProtocol protocol = new TCompactProtocol(new TIOStreamTransport(new ByteArrayInputStream( tRowSet.getBinaryColumns()))); // Read from the stream using the protocol for each column in final schema for (int i = 0; i < tRowSet.getColumnCount(); i++) { TColumn tvalue = new TColumn(); try { tvalue.read(protocol); } catch (TException e) { LOG.error(e.getMessage(), e); throw new TException("Error reading column value from the row set blob", e); } columns.add(new ColumnBuffer(tvalue)); } } else { if (tRowSet.getColumns() != null) { for (TColumn tvalue : tRowSet.getColumns()) { columns.add(new ColumnBuffer(tvalue)); } } } startOffset = tRowSet.getStartRowOffset(); }