/** * Reports the cell format for the specified column. * * @param column Column name. * @return the cell format for the column. * @throws NoSuchColumnException if the column does not exist. * @deprecated Use {@link #getCellSpec(FijiColumnName)} to obtain further details about a column. */ @Deprecated public SchemaStorage getCellFormat(FijiColumnName column) throws NoSuchColumnException { return getCellSchema(column).getStorage(); }
/** * Creates a schema encoder for the specified cell encoding. * * @param cellSpec Specification of the cell to encode. * @return a schema encoder for the specified cell encoding. * @throws IOException on I/O error. */ private SchemaEncoder createSchemaEncoder(final CellSpec cellSpec) throws IOException { switch (cellSpec.getCellSchema().getStorage()) { case HASH: return new SchemaHashEncoder(); case UID: return new SchemaIdEncoder(); case FINAL: return new FinalSchemaEncoder(); default: throw new RuntimeException( "Unexpected cell format: " + cellSpec.getCellSchema().getStorage()); } }
/** * Returns a mutable list of registered schemas (READER, WRITER, WRITTEN) of the provided column. * * <p> * The list of schemas comes from a deeply nested record within the mutable table layout * descriptor. Therefore, mutating this list effectively mutates the table layout descriptor. * </p> * * @param columnName whose schema ids to list * @param schemaRegistrationType of the schemas to list: (READER, WRITER, WRITTEN). * @return The list of schema ids. * Returns empty list if schema validation was not previously enabled. * @throws NoSuchColumnException when column not found * @throws InvalidLayoutException if the column is final or non-AVRO */ private List<AvroSchema> getMutableRegisteredSchemaList( final FijiColumnName columnName, final SchemaRegistrationType schemaRegistrationType) throws NoSuchColumnException, InvalidLayoutException { Preconditions.checkNotNull(columnName); Preconditions.checkNotNull(schemaRegistrationType); final CellSchema cellSchema = getColumnSchema(columnName); // Avoid tracking schemas final or non-AVRO cells. if ((SchemaType.AVRO != cellSchema.getType()) || (SchemaStorage.FINAL == cellSchema.getStorage())) { throw new InvalidLayoutException("Final or non-AVRO column schema cannot be modified."); } final String fieldName = schemaRegistrationType.getCellSchemaFieldName(); return (List<AvroSchema>) Preconditions.checkNotNull(cellSchema.get(fieldName)); }
if (mCellSpec.getCellSchema().getStorage() == SchemaStorage.FINAL && !writerSchema.equals(mReaderSchema)) { throw new FijiEncodingException(
if (schema.getStorage() == SchemaStorage.FINAL) { switch (schema.getType()) { case INLINE: if (schema.getStorage() != SchemaStorage.FINAL) { throw new InvalidLayoutException(String.format( "Invalid counter schema, storage must be final: %s.", schema)); if (schema.getStorage() != reference.getStorage()) { throw new InvalidLayoutException(String.format( "Cell schema storage cannot be modified from %s to %s.", if ((reference.getStorage() == SchemaStorage.FINAL) && !Objects.equal(schema.getValue(), reference.getValue())) { throw new InvalidLayoutException(String.format(
/** * Creates a schema decoder. * * @param cellSpec Specification of the cell encoding. * @return a new schema decoder. * @throws IOException on I/O error. */ private static SchemaDecoder createSchemaDecoder(CellSpec cellSpec) throws IOException { switch (cellSpec.getCellSchema().getStorage()) { case HASH: return new SchemaHashDecoder(cellSpec.getSchemaTable()); case UID: return new SchemaIdDecoder(cellSpec.getSchemaTable()); case FINAL: return new FinalSchemaDecoder(cellSpec.getAvroSchema()); default: throw new InternalFijiError( "Unexpected cell storage in cell schema: " + cellSpec.getCellSchema()); } }
final CellSchema cellSchema = layout.getCellSchema(spec.getColumn()); switch (cellSchema.getStorage()) { case HASH: { return new SchemaHashDecoder(layout.getSchemaTable());