Package org.kiji.schema.avro

Examples of org.kiji.schema.avro.LocalityGroupDesc


    final Map<KijiColumnName, ColumnLayout> columnMap = Maps.newHashMap();

    final Iterator<LocalityGroupDesc> itLGDesc = mDesc.getLocalityGroups().iterator();
    while (itLGDesc.hasNext()) {
      final LocalityGroupDesc lgDesc = itLGDesc.next();
      final boolean isRename = (lgDesc.getRenamedFrom() != null);
      final String refLGName = isRename ? lgDesc.getRenamedFrom() : lgDesc.getName();
      lgDesc.setRenamedFrom(null);
      if (isRename && (reference == null)) {
        throw new InvalidLayoutException(String.format(
            "Invalid rename: no reference table layout for locality group '%s'.", refLGName));
      }
      final LocalityGroupLayout refLGLayout =
          (reference != null) ? reference.mLocalityGroupMap.get(refLGName) : null;
      if (isRename && (refLGLayout == null)) {
        throw new InvalidLayoutException(String.format(
            "Invalid rename: cannot find reference locality group '%s'.", refLGName));
      }

      final ColumnId refLGId = refLGIdMap.remove(refLGName);

      if (lgDesc.getDelete()) {
        // This locality group is deleted:
        if (refLGId == null) {
          throw new InvalidLayoutException(String.format(
              "Attempting to delete locality group '%s' unknown in reference layout.",
              refLGName));
        }
        itLGDesc.remove();
        continue;
      }

      // BloomType, block_size were introduced in version 1.2.
      if (Versions.BLOCK_SIZE_LAYOUT_VERSION.compareTo(mLayoutVersion) > 0) {
        if (lgDesc.getBlockSize() != null) {
          // Cannot use max_filesize if this is the case.
          throw new InvalidLayoutException(
            "Support for specifying block_size begins with layout version "
              + Versions.BLOCK_SIZE_LAYOUT_VERSION);
        }
        if (lgDesc.getBloomType() != null) {
          // Cannot use bloom_type if this is the case.
          throw new InvalidLayoutException(
            "Support for specifying bloom_type begins with layout version "
              + Versions.BLOCK_SIZE_LAYOUT_VERSION);
        }
      } else {
        if (lgDesc.getBlockSize() != null && lgDesc.getBlockSize() <= 0) {
          throw new InvalidLayoutException("block_size must be greater than 0");
        }
      }

      final LocalityGroupLayout lgLayout = new LocalityGroupLayout(lgDesc, refLGLayout);
View Full Code Here


      final LocalityGroupLayout localityGroup,
      final HBaseColumnNameTranslator hbaseColumnNameTranslator
  ) {
    byte[] hbaseFamilyName = hbaseColumnNameTranslator.toHBaseFamilyName(localityGroup);

    LocalityGroupDesc groupDesc = localityGroup.getDesc();
    return new HColumnDescriptor(
        hbaseFamilyName,
        groupDesc.getMaxVersions(),
        groupDesc.getCompressionType().toString(),
        groupDesc.getInMemory(),
        true,  // block cache
        groupDesc.getBlockSize() != null ? groupDesc.getBlockSize()
          : HColumnDescriptor.DEFAULT_BLOCKSIZE,
        groupDesc.getTtlSeconds(),
        groupDesc.getBloomType() != null ? groupDesc.getBloomType().toString()
          : HColumnDescriptor.DEFAULT_BLOOMFILTER,
        HColumnDescriptor.DEFAULT_REPLICATION_SCOPE);
  }
View Full Code Here

TOP

Related Classes of org.kiji.schema.avro.LocalityGroupDesc

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.