Examples of HBaseColumnName


Examples of org.kiji.schema.hbase.HBaseColumnName

    for (NavigableMap.Entry<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> familyEntry
             : map.entrySet()) {
      // Loop over the columns in the family.
      for (NavigableMap.Entry<byte[], NavigableMap<Long, byte[]>> columnEntry
               : familyEntry.getValue().entrySet()) {
        final HBaseColumnName hbaseColumnName =
            new HBaseColumnName(familyEntry.getKey(), columnEntry.getKey());

        // Translate the HBase column name to a Kiji column name.
        KijiColumnName kijiColumnName;
        try {
          kijiColumnName = columnNameTranslator.toKijiColumnName(
              new HBaseColumnName(familyEntry.getKey(), columnEntry.getKey()));
        } catch (NoSuchColumnException e) {
          LOG.info("Ignoring HBase column '{}:{}' because it doesn't contain Kiji data.",
              Bytes.toStringBinary(hbaseColumnName.getFamily()),
              Bytes.toStringBinary(hbaseColumnName.getQualifier()));
          continue;
        }
        LOG.debug("Adding family [{}] to getMap() result.", kijiColumnName.getName());

        // First check if all columns were requested.
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

     *
     * @return the start index of the configured column in the KeyValues of this Iterator.
     * @throws NoSuchColumnException in case the column does not exist in the table.
     */
    private int findStartIndex() throws NoSuchColumnException {
      final HBaseColumnName hBaseColumnName = mColumnNameTranslator.toHBaseColumnName(mColumn);
      final KeyValue kv = new KeyValue(
          mEntityId.getHBaseRowKey(),
          hBaseColumnName.getFamily(),
          hBaseColumnName.getQualifier(),
          Long.MAX_VALUE,
          new byte[0]);
      return findInsertionPoint(mKeyValues, kv);
    }
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

      if (mNextIndex >= mKeyValues.length) {
        return null;
      }

      final KeyValue next = mKeyValues[mNextIndex];
      final HBaseColumnName hbaseColumn = new HBaseColumnName(
          next.getFamily(),
          next.getQualifier());
      final KijiColumnName column = mColumnNameTranslator.toKijiColumnName(hbaseColumn);

      // Validates that the column of the next KeyValue should be included in the iterator.
      if (mColumn.isFullyQualified()) {
        if (!Objects.equal(mColumn, column)) {
          // The column of the next cell is not the requested column, do not return it.
          return null;
        }
      } else {
        if (!Objects.equal(column.getFamily(), mColumn.getFamily())) {
          // The column of the next cell is not in the requested family, do not return it.
          return null;
        }
      }

      if ((null != mNextCell) && !Objects.equal(mNextCell.getColumn(), column)) {
        // We've hit the next qualifier before the max versions; reset the current version count.
        mCurrentVersions = 0;
      }

      if (mCurrentVersions < mMaxVersions) {
        // decode the cell and return it.
        mCurrentVersions++;
        mNextIndex++;
        return KijiCell.create(column, next.getTimestamp(), mDecoder.decodeCell(next.getValue()));
      } else {
        // Reset the current versions and try the next qualifier.
        mCurrentVersions = 0;
        final KeyValue nextQualifierKV = new KeyValue(
            mEntityId.getHBaseRowKey(),
            hbaseColumn.getFamily(),
            Arrays.copyOf(hbaseColumn.getQualifier(), hbaseColumn.getQualifier().length + 1),
            Long.MAX_VALUE,
            new byte[0]);
        mNextIndex = findInsertionPoint(mKeyValues, nextQualifierKV);
        return getNextCell();
      }
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

      if (!Arrays.equals(mLastQualifier, keyValue.getQualifier())) {
        mLastQualifier = keyValue.getQualifier();
        try {
          mLastColumn =
              mColumnTranslator.toKijiColumnName(
                  new HBaseColumnName(keyValue.getFamily(), keyValue.getQualifier()));
        } catch (NoSuchColumnException e) {
          mLastQualifier = null;
          mLastColumn = null;
          throw new InternalKijiError(e);
        }
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

      if (!Arrays.equals(mLastQualifier, keyValue.getQualifier())) {
        try {
          mLastQualifier = keyValue.getQualifier();
          mLastColumn =
              mColumnTranslator.toKijiColumnName(
                  new HBaseColumnName(keyValue.getFamily(), keyValue.getQualifier()));

          mLastDecoder = mDecoderProvider.getDecoder(mLastColumn);
        } catch (NoSuchColumnException e) {
          // TODO(SCHEMA-962): Critical! Handle this. Will happen when reading a deleted column
          mLastDecoder = null;
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

    // Everything before the first ':'.
    final String hbaseFamily = hbaseColumnString.substring(0, hbaseColumnString.indexOf(':'));
    // Everything after the first ':'. The +1 excludes the ':' itself.
    final String hbaseQualifier = hbaseColumnString.substring(hbaseColumnString.indexOf(':') + 1);

    final HBaseColumnName hbaseColumn = new HBaseColumnName(hbaseFamily, hbaseQualifier);
    return translator.toKijiColumnName(hbaseColumn);
  }
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

    final State state = mState.get();
    Preconditions.checkState(state == State.OPEN,
        "Cannot checkAndCommit a transaction on 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 byte[] encoded;

    // If passed value is null, then let encoded value be null.
    // HBase will check for non-existence of cell.
    if (null == value) {
      encoded = null;
    } else {
      final KijiCellEncoder cellEncoder =
          capsule.getCellEncoderProvider().getEncoder(family, qualifier);
      encoded = cellEncoder.encode(value);
    }

    SchemaPlatformBridge bridge = SchemaPlatformBridge.get();
    for (KeyValue kv : mHopper) {
      bridge.addKVToPut(mPut, kv);
    }

    boolean retVal = mHTable.checkAndPut(
        mId, columnName.getFamily(), columnName.getQualifier(), encoded, mPut);
    if (retVal) {
      if (!mHTable.isAutoFlush()) {
        mHTable.flushCommits();
      }
      reset();
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

    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);
    final byte[] encoded = cellEncoder.encode(value);

    mHopper.add(new KeyValue(
        mId, columnName.getFamily(), columnName.getQualifier(), timestamp, encoded));
  }
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

      LOG.debug("Got {} cells over {} requested", result.size(), pageSize);

      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.
View Full Code Here

Examples of org.kiji.schema.hbase.HBaseColumnName

      // Make sure we can translate correctly between kiji objects and their HBase counterparts.
      assertArrayEquals("Row key not translated correctly by KijiRowFilter.Context",
          Bytes.toBytes("foo"), context.getHBaseRowKey("foo"));

      final KijiColumnName column = KijiColumnName.create("family", "new");
      final HBaseColumnName hbaseColumn = context.getHBaseColumnName(column);
      final HBaseColumnName expected = mColumnNameTranslator.toHBaseColumnName(column);
      assertArrayEquals("Family name not translated correctly by KijiRowFilter.Context",
          expected.getFamily(), hbaseColumn.getFamily());
      assertArrayEquals("Qualifier name not translated correctly by KijiRowFilter.Context",
          expected.getQualifier(), hbaseColumn.getQualifier());
      final DecodedCell<Integer> kijiCell =
          new DecodedCell<Integer>(Schema.create(Schema.Type.INT), Integer.valueOf(42));
      assertArrayEquals("Cell value not translated correctly by KijiRowFilter.Context",
          mCellEncoder.encode(kijiCell),
          context.getHBaseCellValue(column, kijiCell));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.