Package org.kiji.schema

Examples of org.kiji.schema.KijiColumnName


        + "commit(), checkAndCommit(), or rollback()");
    final State state = mState.get();
    Preconditions.checkState(state == State.OPEN,
        "Cannot put cell to an AtomicKijiPutter instance in state %s.", state);
    final WriterLayoutCapsule capsule = getWriterLayoutCapsule();
    final KijiColumnName kijiColumnName = KijiColumnName.create(family, qualifier);
    final HBaseColumnName columnName =
        capsule.getColumnNameTranslator().toHBaseColumnName(kijiColumnName);

    final KijiCellEncoder cellEncoder =
        capsule.getCellEncoderProvider().getEncoder(family, qualifier);
View Full Code Here


      final KeyValue[] kvs = result.raw();
      final String[] qualifiers = new String[kvs.length];
      for (int i = 0; i < kvs.length; ++i) {
        final HBaseColumnName hbaseColumn =
            new HBaseColumnName(kvs[i].getFamily(), kvs[i].getQualifier());
        final KijiColumnName kijiColumn = translator.toKijiColumnName(hbaseColumn);
        qualifiers[i] = kijiColumn.getQualifier();
      }

      // There is an HBase bug that leads to less KeyValue being returned than expected.
      // An empty result appears to be a reliable way to detect the end of the iteration.
      if (result.isEmpty()) {
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public <T> void put(EntityId entityId, String family, String qualifier, long timestamp, T value)
      throws IOException {
    final KijiColumnName columnName = KijiColumnName.create(family, qualifier);
    final HBaseKijiTableWriter.WriterLayoutCapsule capsule = mWriterLayoutCapsule;
    final HBaseColumnName hbaseColumnName =
        capsule.getColumnNameTranslator().toHBaseColumnName(columnName);

    final KijiCellEncoder cellEncoder =
View Full Code Here

    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 KijiColumnName column = KijiColumnName.create(familyName, qualifier);
      final HBaseColumnName hbaseColumnName =
          mWriterLayoutCapsule.getColumnNameTranslator().toHBaseColumnName(column);
      delete.deleteColumns(
          hbaseColumnName.getFamily(), hbaseColumnName.getQualifier(), upToTimestamp);
    }
View Full Code Here

    // ordered so that we can use binary search.

    final List<Map.Entry<KijiColumnName, List<KijiCell<T>>>> groupFamilyEntries =
        Lists.newArrayListWithCapacity(columns.size());
    for (Map.Entry<KijiColumnName, List<KijiCell<T>>> entry : columns.entrySet()) {
      final KijiColumnName column = entry.getKey();
      if (!column.isFullyQualified()
          && layout.getFamilyMap().get(column.getFamily()).isGroupType()) {
        groupFamilyEntries.add(entry);
      }
    }

    if (groupFamilyEntries.isEmpty()) {
      return new MaterializedKijiResult<T>(entityId, dataRequest, columns);
    }

    for (Map.Entry<KijiColumnName, List<KijiCell<T>>> entry : groupFamilyEntries) {
      final KijiColumnName groupFamily = entry.getKey();
      final List<KijiCell<T>> sortedColumn = entry.getValue();
      Collections.sort(sortedColumn, KijiCell.getKeyComparator());
      columns.put(groupFamily, sortedColumn);
    }
View Full Code Here

    final ImmutableSortedMap.Builder<KijiColumnName, List<KijiCell<U>>> narrowedColumns =
        ImmutableSortedMap.naturalOrder();

    for (Column columnRequest : narrowRequest.getColumns()) {
      final KijiColumnName requestedColumn = columnRequest.getColumnName();

      // (Object) cast is necessary. Might be: http://bugs.java.com/view_bug.do?bug_id=6548436
      final List<KijiCell<U>> exactColumn =
          (List<KijiCell<U>>) (Object) mColumns.get(requestedColumn);
      if (exactColumn != null) {

        // We get here IF

        // `column` is a family, and `mDataRequest` contains a column request for the entire family.

        // OR

        // `column` is a family, and `mDataRequest` contains a column request for a qualified column
        // in the family.

        // OR

        // `column` is a qualified-column, and `mDataRequest` contains a request for the qualified
        // column.

        narrowedColumns.put(requestedColumn, exactColumn);
      } else {

        // `column` is a qualified-column, and `mDataRequest` contains a column request for the
        // column's family.

        final List<KijiCell<T>> familyCells =
            mColumns.get(KijiColumnName.create(requestedColumn.getFamily(), null));
        final List<KijiCell<T>> qualifierCells = getQualifierCells(requestedColumn, familyCells);
        narrowedColumns.put(requestedColumn, (List<KijiCell<U>>) (Object) qualifierCells);
      }
    }
View Full Code Here

  /** {@inheritDoc} */
  @Override
  public Filter toHBaseFilter(Context context) throws IOException {
    // Create a filter that accepts a cell from mFamily and mQualifier only if it is
    // equals to the specified value.
    final KijiColumnName column = KijiColumnName.create(mFamily, mQualifier);
    HBaseColumnName hbaseColumnName = context.getHBaseColumnName(column);
    SingleColumnValueFilter filter = new SingleColumnValueFilter(
        hbaseColumnName.getFamily(),
        hbaseColumnName.getQualifier(),
        CompareOp.EQUAL,
View Full Code Here

  public HasColumnDataRowFilter(String columnName) {
    if (null == columnName) {
      throw new IllegalArgumentException("columnName is required");
    }

    KijiColumnName kijiColName = KijiColumnName.create(columnName);
    if (!kijiColName.isFullyQualified()) {
      throw new IllegalArgumentException("Cannot use an unqualified column family.");
    }

    mFamily = kijiColName.getFamily();
    mQualifier = kijiColName.getQualifier();
  }
View Full Code Here

   */
  private static void registerWriterSchema(final KijiURI columnURI, final Schema writerSchema)
      throws IOException {
    Preconditions.checkArgument(columnURI.getColumns().size() == 1,
        "Expecting exactly one column in URI, got: %s", columnURI);
    final KijiColumnName column = columnURI.getColumns().get(0);

    // TODO(???) the layout updater interface is currently HBase specific.
    //     We should make a backend agnostic API for layout updates.
    final HBaseKiji kiji = (HBaseKiji) Kiji.Factory.open(columnURI);
    try {
View Full Code Here

    final KijiTableLayout layout = mTable.getLayout();
    final Set<KijiColumnName> layoutColumns = layout.getColumnNames();
    final Map<KijiColumnName, BoundColumnReaderSpec> boundOverrides = Maps.newHashMap();
    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

TOP

Related Classes of org.kiji.schema.KijiColumnName

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.