Package org.kiji.schema

Examples of org.kiji.schema.NoSuchColumnException


  public void deleteFamily(EntityId entityId, String family, long upToTimestamp)
      throws IOException {
    final HBaseKijiTableWriter.WriterLayoutCapsule capsule = mWriterLayoutCapsule;
    final FamilyLayout familyLayout = capsule.getLayout().getFamilyMap().get(family);
    if (null == familyLayout) {
      throw new NoSuchColumnException(String.format("Family '%s' not found.", family));
    }

    if (familyLayout.getLocalityGroup().getFamilyMap().size() > 1) {
      // There are multiple families within the locality group, so we need to be clever.
      if (familyLayout.isGroupType()) {
View Full Code Here


    for (Map.Entry<KijiColumnName, ColumnReaderSpec> override
        : overrides.entrySet()) {
      final KijiColumnName column = override.getKey();
      if (!layoutColumns.contains(column)
          && !layoutColumns.contains(new KijiColumnName(column.getFamily()))) {
        throw new NoSuchColumnException(String.format(
            "KijiTableLayout: %s does not contain column: %s", layout, column));
      } else {
        boundOverrides.put(column,
            BoundColumnReaderSpec.create(override.getValue(), column));
      }
    }
    mOverrides = boundOverrides;
    final Collection<BoundColumnReaderSpec> boundAlternatives = Sets.newHashSet();
    for (Map.Entry<KijiColumnName, ColumnReaderSpec> altsEntry
        : alternatives.entries()) {
      final KijiColumnName column = altsEntry.getKey();
      if (!layoutColumns.contains(column)
          && !layoutColumns.contains(KijiColumnName.create(column.getFamily()))) {
        throw new NoSuchColumnException(String.format(
            "KijiTableLayout: %s does not contain column: %s", layout, column));
      } else {
        boundAlternatives.add(
            BoundColumnReaderSpec.create(altsEntry.getValue(), altsEntry.getKey()));
      }
View Full Code Here

   * @throws NoSuchColumnException if the column does not exist.
   */
  public CellSchema getCellSchema(KijiColumnName 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();
  }
View Full Code Here

          }
        }
      }
    }

    throw new NoSuchColumnException(String.format(
        "Table '%s' has no family '%s'.", mDescBuilder.getName(), family.getFamily()));
  }
View Full Code Here

          }
        }
      }
    }

    throw new NoSuchColumnException(String.format(
        "Table '%s' has no column '%s'.", mDescBuilder.getName(), columnName));
  }
View Full Code Here

    final String localityGroupName =
        mLayout.getLocalityGroupIdNameMap().get(localityGroupTable.getLocalityGroupId());
    final LocalityGroupLayout localityGroup = mLayout.getLocalityGroupMap().get(localityGroupName);
        mLayout.getLocalityGroupIdNameMap().get(localityGroupTable.getLocalityGroupId());
    if (localityGroup == null) {
      throw new NoSuchColumnException(
          String.format("No locality group for Cassandra table %s in Kiji table %s.",
              localityGroupTable, mLayout.getName()));
    }

    final ColumnId familyID = ColumnId.fromByteArray(cassandraColumnName.getFamily());
    final FamilyLayout family =
        localityGroup.getFamilyMap().get(localityGroup.getFamilyIdNameMap().get(familyID));
    if (family == null) {
      throw new NoSuchColumnException(String.format(
          "No family with ID %s in locality group %s of table %s.",
          familyID.getId(), localityGroup.getName(), mLayout.getName()));
    }

    final KijiColumnName kijiColumnName;
    if (family.isGroupType()) {
      // Group type family.
      final ColumnId qualifierID = ColumnId.fromByteArray(cassandraColumnName.getQualifier());
      final ColumnLayout qualifier =
          family.getColumnMap().get(family.getColumnIdNameMap().get(qualifierID));
      if (qualifier == null) {
        throw new NoSuchColumnException(String.format(
            "No column with ID %s in family %s of table %s.",
            qualifierID.getId(), family.getName(), mLayout.getName()));
      }
      kijiColumnName = KijiColumnName.create(family.getName(), qualifier.getName());
    } else {
View Full Code Here

    final String familyName = kijiColumnName.getFamily();
    final String qualifierName = kijiColumnName.getQualifier();

    final FamilyLayout family = mLayout.getFamilyMap().get(familyName);
    if (family == null) {
      throw new NoSuchColumnException(kijiColumnName.toString());
    }

    final ColumnId familyID = family.getId();

    final byte[] familyBytes = familyID.toByteArray();
View Full Code Here

    for (Map.Entry<KijiColumnName, ColumnReaderSpec> override
        : overrides.entrySet()) {
      final KijiColumnName column = override.getKey();
      if (!layoutColumns.contains(column)
          && !layoutColumns.contains(KijiColumnName.create(column.getFamily()))) {
        throw new NoSuchColumnException(String.format(
            "KijiTableLayout: %s does not contain column: %s", layout, column));
      } else {
        boundOverrides.put(column,
            BoundColumnReaderSpec.create(override.getValue(), column));
      }
    }
    mOverrides = boundOverrides;
    final Collection<BoundColumnReaderSpec> boundAlternatives = Sets.newHashSet();
    for (Map.Entry<KijiColumnName, ColumnReaderSpec> altsEntry
        : alternatives.entries()) {
      final KijiColumnName column = altsEntry.getKey();
      if (!layoutColumns.contains(column)
          && !layoutColumns.contains(KijiColumnName.create(column.getFamily()))) {
        throw new NoSuchColumnException(String.format(
            "KijiTableLayout: %s does not contain column: %s", layout, column));
      } else {
        boundAlternatives.add(
            BoundColumnReaderSpec.create(altsEntry.getValue(), altsEntry.getKey()));
      }
View Full Code Here

    LOG.debug("Translating HBase column name '{}' to Kiji column name...", hbaseColumnName);
    final ColumnId localityGroupID = ColumnId.fromByteArray(hbaseColumnName.getFamily());
    final LocalityGroupLayout localityGroup =
        mLayout.getLocalityGroupMap().get(mLayout.getLocalityGroupIdNameMap().get(localityGroupID));
    if (localityGroup == null) {
      throw new NoSuchColumnException(String.format("No locality group with ID %s in table %s.",
          localityGroupID.getId(), mLayout.getName()));
    }

    // Parse the HBase qualifier as a byte[] in order to save a String instantiation
    final byte[] hbaseQualifier = hbaseColumnName.getQualifier();
    final int index = ArrayUtils.indexOf(hbaseQualifier, SEPARATOR);
    if (index == -1) {
      throw new NoSuchColumnException(String.format(
          "Missing separator in HBase column %s.", hbaseColumnName));
    }
    final ColumnId familyID = ColumnId.fromString(Bytes.toString(hbaseQualifier, 0, index));
    final String rawQualifier =
        Bytes.toString(hbaseQualifier, index + 1, hbaseQualifier.length - index - 1);

    final FamilyLayout family =
        localityGroup.getFamilyMap().get(localityGroup.getFamilyIdNameMap().get(familyID));
    if (family == null) {
      throw new NoSuchColumnException(String.format(
          "No family with ID %s in locality group %s of table %s.",
          familyID.getId(), localityGroup.getName(), mLayout.getName()));
    }

    if (family.isGroupType()) {
      // Group type family.
      final ColumnId qualifierID = ColumnId.fromString(rawQualifier);
      final ColumnLayout qualifier =
          family.getColumnMap().get(family.getColumnIdNameMap().get(qualifierID));
      if (qualifier == null) {
        throw new NoSuchColumnException(String.format(
            "No column with ID %s in family %s of table %s.",
            qualifierID.getId(), family.getName(), mLayout.getName()));
      }
      final KijiColumnName kijiColumnName =
          new KijiColumnName(family.getName(), qualifier.getName());
View Full Code Here

    final String familyName = kijiColumnName.getFamily();
    final String qualifierName = kijiColumnName.getQualifier();

    final FamilyLayout family = mLayout.getFamilyMap().get(familyName);
    if (family == null) {
      throw new NoSuchColumnException(kijiColumnName.toString());
    }

    final ColumnId localityGroupID = family.getLocalityGroup().getId();
    final ColumnId familyID = family.getId();
View Full Code Here

TOP

Related Classes of org.kiji.schema.NoSuchColumnException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.