/** {@inheritDoc} */ @Override public DecodedCell<T> decodeCell(byte[] encodedBytes) throws IOException { return new DecodedCell(DecodedCell.NO_SCHEMA, encodedBytes); }
/** {@inheritDoc} */ @Override public DecodedCell<T> decodeCell(byte[] encodedBytes) throws IOException { try { return new DecodedCell<T>( DecodedCell.NO_SCHEMA, (T) mParseFromMethod.invoke(mProtoClass, encodedBytes)); } catch (InvocationTargetException ite) { throw new IOException(ite); } catch (IllegalAccessException iae) { throw new IOException(iae); } }
/** {@inheritDoc} */ @Override public DecodedCell<Long> decodeCell(byte[] bytes) throws IOException { return new DecodedCell<Long>(DecodedCell.NO_SCHEMA, Bytes.toLong(bytes)); }
switch(type) { case BOOLEAN: return new DecodedCell<Boolean>(type.getSchema(), Bytes.toBoolean(bytes)); case BYTES: return new DecodedCell<ByteBuffer>(type.getSchema(), ByteBuffer.wrap(bytes)); case DOUBLE: return new DecodedCell<Double>(type.getSchema(), Bytes.toDouble(bytes)); case FLOAT: return new DecodedCell<Float>(type.getSchema(), Bytes.toFloat(bytes)); case INT: return new DecodedCell<Integer>(type.getSchema(), Bytes.toInt(bytes)); case LONG: return new DecodedCell<Long>(type.getSchema(), Bytes.toLong(bytes)); case SHORT: return new DecodedCell<Integer>(type.getSchema(), (int) Bytes.toShort(bytes)); case STRING: return new DecodedCell<CharSequence>(type.getSchema(), Bytes.toString(bytes)); default: throw new IOException("Unsupported HBase encoding type: " + type.toString());
final T data = reader.read(null, decoder); return new DecodedCell<T>(schema, data);
/** * Decodes the serialized bytes into a FijiCell. If reuse is non-null, the implementation may fill * it and return it as the FijiCell data payload. * * @param bytes The bytes from an HBase table cell. * @param reuse If non-null, may be filled with the decoded data and used as the data payload in * the return value. * @return The decoded FijiCell. * @throws IOException If there is an error. */ private DecodedCell<T> decode(byte[] bytes, T reuse) throws IOException { final ByteStreamArray byteStream = new ByteStreamArray(bytes); final Schema writerSchema = mSchemaDecoder.decode(byteStream); final Schema readerSchema = (mReaderSchema != null) ? mReaderSchema : writerSchema; final ByteBuffer binaryData = ByteBuffer.wrap(bytes, byteStream.getOffset(), bytes.length - byteStream.getOffset()); final T data = decodeAvro(binaryData, writerSchema, readerSchema, reuse); return new DecodedCell<T>(writerSchema, readerSchema, data); }
final DecodedCell<Long> counter = new DecodedCell<Long>( DecodedCell.NO_SCHEMA, Bytes.toLong(counterEntry.getValue()));
/** {@inheritDoc} */ @Override public FijiRowFilter createFromJson(JsonNode root) { final String family = root.path(FAMILY_NODE).getTextValue(); final String qualifier = root.path(QUALIFIER_NODE).getTextValue(); final String schema = root.path(VALUE_NODE).path(SCHEMA_NODE).getTextValue(); final Schema writerSchema = (new Schema.Parser()).parse(schema); final String data = root.path(VALUE_NODE).path(DATA_NODE).getTextValue(); try { final DecodedCell<?> cell = new DecodedCell<Object>(writerSchema, FromJson.fromAvroJsonString(data, writerSchema)); return new ColumnValueEqualsRowFilter(family, qualifier, cell); } catch (IOException ioe) { throw new FijiIOException(ioe); } } }
cell.getColumn(), cell.getTimestamp(), new DecodedCell<Object>(cell.getWriterSchema(), null))); mLastQualifier = qualifier;
DecodedCell<String> decodedCell = new DecodedCell<String>(null, "Error loading cell: " + e.getMessage()); String qualifier = "";
/** {@inheritDoc} */ @Override public void produce(final FijiRowData row, final FijiTableContext context) throws IOException { final Iterable<FijiCell<Object>> cells; if (mColumn.isFullyQualified()) { cells = row.asIterable(mColumn.getFamily(), mColumn.getQualifier()); } else { cells = row.asIterable(mColumn.getFamily()); } for (FijiCell<Object> cell : cells) { context.incrementCounter(Counters.CELLS_PROCESSED); final DecodedCell<Object> original = new DecodedCell<Object>(cell.getWriterSchema(), cell.getData()); final DecodedCell<Object> rewritten = rewriteCell(original); if (rewritten != original) { context.put( row.getEntityId(), mColumn.getFamily(), mColumn.getQualifier(), cell.getTimestamp(), rewritten.getData()); context.incrementCounter(Counters.CELLS_REWRITTEN); } } }