Package org.kiji.schema

Examples of org.kiji.schema.KijiColumnName


  ) throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, String> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column = columnFromMetaTableKey(metaTableKey);
        if (null != column
            && Objects.equal(family, column.getFamily())
            && Objects.equal(exactKey, keyFromMetaTableKey(metaTableKey))) {
          collectedAnnotations.put(column, getKV(metaTableKey));
        }
      }
    }
View Full Code Here


  ) throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, Map<String, String>> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column =
            columnFromMetaTableKey(metaTableKey);
        if (Objects.equal(family, column.getFamily())) {
          final String annotationKey = keyFromMetaTableKey(metaTableKey);
          if (annotationKey.startsWith(prefix)) {
            final Map<String, String> existingAnnotations = collectedAnnotations.get(column);
            if (null != existingAnnotations) {
              existingAnnotations.put(annotationKey, getKV(metaTableKey));
View Full Code Here

  ) throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, Map<String, String>> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column = columnFromMetaTableKey(metaTableKey);
        if (null != column && Objects.equal(family, column.getFamily())) {
          final String annotationKey = keyFromMetaTableKey(metaTableKey);
          if (annotationKey.contains(substring)) {
            final Map<String, String> existingAnnotations = collectedAnnotations.get(column);
            if (null != existingAnnotations) {
              existingAnnotations.put(annotationKey, getKV(metaTableKey));
View Full Code Here

  ) throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, Map<String, String>> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column = columnFromMetaTableKey(metaTableKey);
        if (null != column && Objects.equal(family, column.getFamily())) {
          final String annotationKey = keyFromMetaTableKey(metaTableKey);
          if (annotationKey.matches(pattern)) {
            final Map<String, String> existingAnnotations = collectedAnnotations.get(column);
            if (null != existingAnnotations) {
              existingAnnotations.put(annotationKey, getKV(metaTableKey));
View Full Code Here

  ) throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, Map<String, String>> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column = columnFromMetaTableKey(metaTableKey);
        if (null != column && Objects.equal(family, column.getFamily())) {
          final String annotationKey = keyFromMetaTableKey(metaTableKey);
          final Map<String, String> existingAnnotations = collectedAnnotations.get(column);
          if (null != existingAnnotations) {
            existingAnnotations.put(annotationKey, getKV(metaTableKey));
          } else {
View Full Code Here

  public Map<KijiColumnName, Map<String, String>> getAllColumnAnnotations() throws IOException {
    requireState(State.OPEN, "get annotation");
    final Map<KijiColumnName, Map<String, String>> collectedAnnotations = Maps.newHashMap();
    for (String metaTableKey : keySet()) {
      if (isKCAColumnMetaTableKey(metaTableKey)) {
        final KijiColumnName column = columnFromMetaTableKey(metaTableKey);
        if (null != column) {
          final String annotationKey = keyFromMetaTableKey(metaTableKey);
          final Map<String, String> existingAnnotations = collectedAnnotations.get(column);
          if (null != existingAnnotations) {
            existingAnnotations.put(annotationKey, getKV(metaTableKey));
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  protected int run(List<String> nonFlagArgs) throws Exception {
    final KijiColumnName column = mColumnURI.getColumns().get(0);
    final KijiTableLayout layout = mTable.getLayout();
    final CellSchema cellSchema = layout.getCellSchema(column);

    final EntityId entityId =
        ToolUtils.createEntityIdFromUserInputs(mEntityId, layout);

    final KijiTableWriter writer = mTable.openTableWriter();
    try {
      if (cellSchema.getType() == SchemaType.COUNTER) {
        if (-1 == mTimestamp) {
          try {
            long value = Long.parseLong(mJsonValue);
            writer.put(entityId, column.getFamily(), column.getQualifier(), value);
          } catch (NumberFormatException nfe) {
            LOG.error("Could not parse value flag to a long: " + nfe.getMessage());
            return FAILURE;
          }
        } else {
          LOG.error("Counters do not support writing to a specific timestamp."
              + "  Remove the \"timestamp\" flag.");
          return FAILURE;
        }
      } else {
        // Get writer schema.
        // Otherwise, set writer Schema in mSchema in preparation to write an Avro record.
        if (null != mSchemaFlag) {
          try {
            LOG.debug("Schema is " + mSchemaFlag);
            mSchema = new Schema.Parser().parse(mSchemaFlag);
          } catch (AvroRuntimeException are) {
            LOG.error("Could not parse writer schema: " + are.toString());
            return FAILURE;
          }
        } else {
          try {
            mSchema = layout.getSchema(column);
          } catch (Exception e) {
            LOG.error(e.getMessage());
            return FAILURE;
          }
        }
        Preconditions.checkNotNull(mSchema);

        // Create the Avro record to write.
        GenericDatumReader<Object> reader = new GenericDatumReader<Object>(mSchema);
        Object datum = reader.read(null, new DecoderFactory().jsonDecoder(mSchema, mJsonValue));

        // Write the put.
        if (-1 == mTimestamp) {
          writer.put(entityId, column.getFamily(), column.getQualifier(), datum);
        } else {
          writer.put(entityId, column.getFamily(), column.getQualifier(), mTimestamp, datum);
        }
      }

    } finally {
      ResourceUtils.closeOrLog(writer);
View Full Code Here

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

        version = timestamp;
      }

      int ttl = familyLayout.getLocalityGroup().getDesc().getTtlSeconds();

      final KijiColumnName columnName = KijiColumnName.create(family, qualifier);
      final CassandraColumnName cassandraColumn =
          mCapsule.getColumnNameTranslator().toCassandraColumnName(columnName);

      final ByteBuffer valueBuffer =
          ByteBuffer.wrap(
View Full Code Here

  @Override
  public KijiRowData next(final int pageSize) {
    if (!hasNext()) {
      throw new NoSuchElementException("Kiji qualifier pager is exhausted.");
    }
    final KijiColumnName column = mColumnRequest.getColumnName();
    final ColumnsDef columnDef = ColumnsDef
        .create()
        .withFilter(mColumnRequest.getFilter())
        .withPageSize(KijiDataRequest.PAGING_DISABLED)
        .withMaxVersions(mColumnRequest.getMaxVersions())
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.