/** * Makes a copy of an existing CellSpec. * * @param spec Existing CellSpec to copy. * @return a copy of the specified CellSpec. */ public static CellSpec copy(final CellSpec spec) { final CellSpec copy = new CellSpec(); copy.mColumnURI = spec.mColumnURI; copy.mCellSchema = CellSchema.newBuilder(spec.mCellSchema).build(); // deep copy copy.mAvroReaderSchema = spec.mAvroReaderSchema; copy.mReaderSchema = spec.mReaderSchema; copy.mSchemaTable = spec.mSchemaTable; copy.mAvroSchemaResolver = spec.mAvroSchemaResolver; copy.mDecoderFactory = spec.mDecoderFactory; copy.mEncoderFactory = spec.mEncoderFactory; return copy; }
/** * Reports the raw specification record for the specified column. * * <p> Note: in most cases, you should use {@link #getCellSpec(FijiColumnName)}. </p> * * @param columnName Column to reports the raw specification record of. * @return the raw specification record for the specified column. * @throws NoSuchColumnException if the column does not exist. */ public CellSchema getCellSchema(FijiColumnName columnName) throws NoSuchColumnException { final FamilyLayout fLayout = mFamilyMap.get(columnName.getFamily()); if (fLayout == null) { throw new NoSuchColumnException(String.format( "Table '%s' has no family '%s'.", getName(), columnName.getFamily())); } if (fLayout.isMapType()) { return CellSchema.newBuilder(fLayout.getDesc().getMapSchema()).build(); } // Group-type family: Preconditions.checkArgument(columnName.isFullyQualified(), String.format("Cannot get CellFormat for entire group-type family: '%s'.", columnName)); final FamilyLayout.ColumnLayout cLayout = fLayout.getColumnMap().get(columnName.getQualifier()); if (cLayout == null) { throw new NoSuchColumnException(String.format( "Table '%s' has no column '%s'.", getName(), columnName)); } return CellSchema.newBuilder(cLayout.getDesc().getColumnSchema()).build(); }
mCellSchema = CellSchema.newBuilder(cellSchema).build(); // deep copy if (isAvro()) { switch (mCellSchema.getType()) {