for (ColumnLayout c : groupColMap.values()) { FijiColumnName fullyQualifiedGroupCol = new FijiColumnName(fijiColumn.getFamily(), c.getName()); columnsDef.add(fullyQualifiedGroupCol); returnCols.add(fullyQualifiedGroupCol);
final ColumnLayout cLayout = new ColumnLayout(columnDesc, refCLayout); columns.add(cLayout); for (String columnName : cLayout.getNames()) { if (null != columnMap.put(columnName, cLayout)) { throw new InvalidLayoutException(String.format( if (cLayout.getId() != null) { final String previous = idMap.put(cLayout.getId(), cLayout.getName()); Preconditions.checkState(previous == null, String.format("Duplicate column ID '%s' associated to '%s' and '%s'.", cLayout.getId(), cLayout.getName(), previous)); } else { unassigned.add(cLayout); Preconditions.checkState(column.getId() == null); while (true) { final ColumnId columnId = new ColumnId(nextColumnId); if (!idMap.containsKey(columnId)) { column.setId(columnId); idMap.put(columnId, column.getName()); break;
final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema(); refFamilyLayout.getColumnIdNameMap().get(columnLayout.getId()); ColumnLayout refColumnLayout = null; if (refColumnName != null) { (refColumnLayout == null) ? null : refColumnLayout.getDesc().getColumnSchema(); columnLayout.getName(), validateCellSchema(refCellSchema, cellSchema))); final CellSchema cellSchema = columnLayout.getDesc().getColumnSchema(); incompatabilityMessages.addAll(addColumnNamestoIncompatibilityMessages( flayout.getName(), columnLayout.getName(), validateCellSchema(null, cellSchema)));
String familyName = entry.getKey().getName(); 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());
new FijiColumnName(family.getName(), qualifier.getName()); LOG.debug("Translated to Fiji group column {}.", fijiColumnName); return fijiColumnName;
for (ColumnLayout column : family.getColumns()) { getPrintStream().println(FijiURI.newBuilder(table.getURI()) .addColumnName(FijiColumnName.create(family.getName(), column.getName())) .build());
qualifierID.getId(), family.getName(), mLayout.getName())); fijiColumnName = FijiColumnName.create(family.getName(), qualifier.getName()); } else {
if ((mId != null) && !mId.equals(reference.getId())) { throw new InvalidLayoutException(String.format( "Descriptor for column '%s' has ID %s but reference ID is %s.", getName(), mId, reference.getId())); mId = reference.getId(); desc.setId(mId.getId()); (null != reference) ? reference.getDesc().getColumnSchema() : null; validateCellSchema(mLayoutVersion, mDesc.getColumnSchema(), referenceSchema);
} else if (fLayout.isGroupType()) { for (ColumnLayout cLayout : fLayout.getColumns()) { columns.add(FijiColumnName.create(fLayout.getName(), cLayout.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(); }
/** * Deletes all cells from a group-type family with a timestamp less than or equal to a * specified timestamp. * * @param entityId The entity (row) to delete from. * @param familyLayout The family layout. * @param upToTimestamp A timestamp. * @throws IOException If there is an IO error. */ private void deleteGroupFamily( EntityId entityId, FamilyLayout familyLayout, long upToTimestamp) throws IOException { final String familyName = Preconditions.checkNotNull(familyLayout.getName()); // Delete each column in the group according to the layout. final Delete delete = new Delete(entityId.getHBaseRowKey()); for (ColumnLayout columnLayout : familyLayout.getColumnMap().values()) { final String qualifier = columnLayout.getName(); final FijiColumnName column = FijiColumnName.create(familyName, qualifier); final HBaseColumnName hbaseColumnName = mWriterLayoutCapsule.getColumnNameTranslator().toHBaseColumnName(column); delete.deleteColumns( hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), upToTimestamp); } // Buffer the delete. updateBuffer(delete); }
/** * Retrieves a list of FijiColumnNames from a FijiTableLayout including both fully qualified * columns as well as map-type families. * * @param fijiTableLayout to retrieve all of the FijiColumnNames from. * @return collection of FijiColumnNames in the specified Layout. */ private static Collection<FijiColumnName> getFijiColumns(FijiTableLayout fijiTableLayout) { // We need to do this because getColumnNames doesn't seem to get all of the columns names; List<FijiColumnName> fijiColumnNames = Lists.newArrayList(); for (FamilyLayout family : fijiTableLayout.getFamilies()) { String familyName = family.getName(); if (family.isMapType()) { // Map type column family FijiColumnName fijiColumnName = new FijiColumnName(familyName); fijiColumnNames.add(fijiColumnName); } else { for (FamilyLayout.ColumnLayout column : family.getColumns()) { String columnName = column.getName(); FijiColumnName fijiColumnName = new FijiColumnName(familyName, columnName); fijiColumnNames.add(fijiColumnName); } } } return fijiColumnNames; }
final String qualifier = columnLayout.getName(); final FijiColumnName column = FijiColumnName.create(familyName, qualifier); final HBaseColumnName hbaseColumnName =
/** * Deletes all cells from a group-type family with a timestamp less than or equal to a * specified timestamp. * * @param entityId The entity (row) to delete from. * @param familyLayout The family layout. * @param upToTimestamp A timestamp. * @throws IOException If there is an IO error. */ private void deleteGroupFamily( EntityId entityId, FamilyLayout familyLayout, long upToTimestamp) throws IOException { final String familyName = Preconditions.checkNotNull(familyLayout.getName()); // Delete each column in the group according to the layout. for (ColumnLayout columnLayout : familyLayout.getColumnMap().values()) { final String qualifier = columnLayout.getName(); deleteColumn(entityId, familyName, qualifier, upToTimestamp); } }