List of usage examples for org.apache.hadoop.io Text set
public void set(Text other)
From source file:com.facebook.presto.accumulo.io.AccumuloRecordCursor.java
License:Apache License
public AccumuloRecordCursor(AccumuloRowSerializer serializer, BatchScanner scanner, String rowIdName, List<AccumuloColumnHandle> columnHandles, List<AccumuloColumnConstraint> constraints) { this.columnHandles = requireNonNull(columnHandles, "columnHandles is null"); this.scanner = requireNonNull(scanner, "scanner is null"); this.serializer = requireNonNull(serializer, "serializer is null"); this.serializer.setRowIdName(requireNonNull(rowIdName, "rowIdName is null")); requireNonNull(columnHandles, "columnHandles is null"); requireNonNull(constraints, "constraints is null"); if (retrieveOnlyRowIds(rowIdName)) { this.scanner.addScanIterator(new IteratorSetting(1, "firstentryiter", FirstEntryInRowIterator.class)); fieldToColumnName = new String[1]; fieldToColumnName[0] = rowIdName; // Set a flag on the serializer saying we are only going to be retrieving the row ID this.serializer.setRowOnly(true); } else {/*from w w w . j a v a 2 s.c o m*/ // Else, we will be scanning some more columns here this.serializer.setRowOnly(false); // Fetch the reserved row ID column this.scanner.fetchColumn(ROW_ID_COLUMN, ROW_ID_COLUMN); Text family = new Text(); Text qualifier = new Text(); // Create an array which maps the column ordinal to the name of the column fieldToColumnName = new String[columnHandles.size()]; for (int i = 0; i < columnHandles.size(); ++i) { AccumuloColumnHandle columnHandle = columnHandles.get(i); fieldToColumnName[i] = columnHandle.getName(); // Make sure to skip the row ID! if (!columnHandle.getName().equals(rowIdName)) { // Set the mapping of presto column name to the family/qualifier this.serializer.setMapping(columnHandle.getName(), columnHandle.getFamily().get(), columnHandle.getQualifier().get()); // Set our scanner to fetch this family/qualifier column // This will help us prune which data we receive from Accumulo family.set(columnHandle.getFamily().get()); qualifier.set(columnHandle.getQualifier().get()); this.scanner.fetchColumn(family, qualifier); } } } iterator = this.scanner.iterator(); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setArray(Text text, Type type, Block block) { text.set(encode(type, block)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setBoolean(Text text, Boolean value) { text.set(encode(BOOLEAN, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setByte(Text text, Byte value) { text.set(encode(TINYINT, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setDate(Text text, Date value) { text.set(encode(DATE, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setDouble(Text text, Double value) { text.set(encode(DOUBLE, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setFloat(Text text, Float value) { text.set(encode(REAL, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setInt(Text text, Integer value) { text.set(encode(INTEGER, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setLong(Text text, Long value) { text.set(encode(BIGINT, value)); }
From source file:com.facebook.presto.accumulo.serializers.LexicoderRowSerializer.java
License:Apache License
@Override public void setMap(Text text, Type type, Block block) { text.set(encode(type, block)); }