/** * Constructs a CellSpec instance from a CellSchema descriptor. * * @param cellSchema CellSchema record to initialize the CellSpec from. * @param schemaTable Schema table to resolve schema hashes or UIDs. * @return a new CellSpec initialized from a CellSchema descriptor. * @throws InvalidLayoutException if the cell specification is invalid. */ public static CellSpec fromCellSchema( final CellSchema cellSchema, final FijiSchemaTable schemaTable) throws InvalidLayoutException { return fromCellSchema(cellSchema) .setSchemaTable(schemaTable); }
/** * Reports the specification of the specified column. * * @param column Column to report the specification of. * @return the specification for the specified column. * @throws IOException on I/O error. */ public CellSpec getCellSpec(FijiColumnName column) throws IOException { return CellSpec.fromCellSchema(getCellSchema(column)) .setSchemaTable(mSchemaTable); }
/** {@inheritDoc} */ @Override public byte[] getHBaseCellValue(FijiColumnName column, DecodedCell<?> fijiCell) throws IOException { final CellSpec cellSpec = mColumnNameTranslator.getTableLayout().getCellSpec(column) .setSchemaTable(mSchemaTable); final FijiCellEncoder encoder = DefaultFijiCellEncoderFactory.get().create(cellSpec); return encoder.encode(fijiCell); } }
cellSpec.setSchemaTable(schemaTable);
.setColumnURI( FijiURI.newBuilder(tableURI).withColumnNames(ImmutableList.of(column)).build()) .setSchemaTable(schemaTable) .setEncoderFactory(factory);
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public <T> void put(EntityId entityId, String family, String qualifier, long timestamp, T value) throws IOException { final FijiColumnName fijiColumn = new FijiColumnName(family, qualifier); final HBaseColumnName hbaseColumn = mColumnNameTranslator.toHBaseColumnName(fijiColumn); final CellSpec cellSpec = mTable.getLayout().getCellSpec(fijiColumn) .setSchemaTable(mFiji.getSchemaTable()); final FijiCellEncoder encoder = DefaultFijiCellEncoderFactory.get().create(cellSpec); final HFileKeyValue mrKey = new HFileKeyValue( entityId.getHBaseRowKey(), hbaseColumn.getFamily(), hbaseColumn.getQualifier(), timestamp, encoder.encode(value)); write(mrKey); }