names.add(desc.getName()); names.addAll(desc.getAliases()); mNames = ImmutableSet.copyOf(names); if (!isValidName(desc.getName())) { throw new InvalidLayoutException(String.format( "Invalid column name: '%s'.", desc.getName())); if (desc.getId() > 0) { mId = new ColumnId(desc.getId()); desc.setId(mId.getId()); (null != reference) ? reference.getDesc().getColumnSchema() : null; validateCellSchema(mLayoutVersion, mDesc.getColumnSchema(), referenceSchema);
/** @return A copy of the Avro descriptor for this column. */ public ColumnDesc getDesc() { return ColumnDesc.newBuilder(mDesc).build(); }
if (cd.getName().equals(columnName.getQualifier())) { return cd.getColumnSchema(); } else { for (String alias : cd.getAliases()) { if (alias.equals(columnName.getQualifier())) { return cd.getColumnSchema();
while (itColumnDesc.hasNext()) { final ColumnDesc columnDesc = itColumnDesc.next(); final boolean isRename = (columnDesc.getRenamedFrom() != null); final String refCName = isRename ? columnDesc.getRenamedFrom() : columnDesc.getName(); columnDesc.setRenamedFrom(null); if (isRename && (reference == null)) { throw new InvalidLayoutException(String.format( if (columnDesc.getDelete()) { if (refCId == null) { throw new InvalidLayoutException(String.format(
if (column.getColumnSchema().getType() == SchemaType.COUNTER) { throw new IllegalArgumentException(String.format( "Fiji Cassandra does not support counter columns." + " Table: %s, family: %s, column: %s.", layout.getName(), family.getName(), column.getName()));
/** * 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(); }
/** @return the primary name for the column. */ public String getName() { return mDesc.getName(); }
/** * Assigns the ID of this column. * * @param cid the ID of the column. * @return this column. */ private ColumnLayout setId(ColumnId cid) { Preconditions.checkArgument(cid.getId() >= 1); Preconditions.checkState(null == mId); mId = cid; mDesc.setId(cid.getId()); return this; }
/** * Normalizes the table layout descriptor to use schema UIDs only. * * @param descBuilder Builder for the table layout descriptor to normalize. * @param options Options describing the normalization to apply. * @throws IOException on I/O error. */ private void normalizeTableLayoutDesc(TableLayoutDesc.Builder descBuilder, LayoutOptions options) throws IOException { for (LocalityGroupDesc lgdesc : descBuilder.getLocalityGroups()) { for (FamilyDesc fdesc : lgdesc.getFamilies()) { if (fdesc.getMapSchema() != null) { normalizeCellSchema(fdesc.getMapSchema(), options); } else { for (ColumnDesc cdesc : fdesc.getColumns()) { normalizeCellSchema(cdesc.getColumnSchema(), options); } } } } }
for (ColumnLayout column : entry.getValue()) { final FijiColumnName colName = FijiColumnName.create(familyName, column.getName()); if (column.getDesc().getColumnSchema().getType() == SchemaType.COUNTER) { final FijiCell<Long> counter = row.getMostRecentCell(colName.getFamily(), colName.getQualifier());
final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema(); (refColumnLayout == null) ? null : refColumnLayout.getDesc().getColumnSchema(); final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema(); incompatabilityMessages.addAll(addColumnNamestoIncompatibilityMessages( flayout.getName(), columnLayout.getName(), validateCellSchema(null, cellSchema)));