当前位置: 首页>>代码示例>>Java>>正文


Java PrimitiveTypeName.BINARY属性代码示例

本文整理汇总了Java中org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BINARY属性的典型用法代码示例。如果您正苦于以下问题:Java PrimitiveTypeName.BINARY属性的具体用法?Java PrimitiveTypeName.BINARY怎么用?Java PrimitiveTypeName.BINARY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName的用法示例。


在下文中一共展示了PrimitiveTypeName.BINARY属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: serialize

@Override
public void serialize(ColumnMetadata_v2 value, JsonGenerator jgen, SerializerProvider provider)
    throws IOException, JsonProcessingException {
  jgen.writeStartObject();
  jgen.writeArrayFieldStart("name");
  for (String n : value.name) {
    jgen.writeString(n);
  }
  jgen.writeEndArray();
  if (value.mxValue != null) {
    Object val;
    if (value.primitiveType == PrimitiveTypeName.BINARY && value.mxValue != null) {
      val = new String(((Binary) value.mxValue).getBytes());
    } else {
      val = value.mxValue;
    }
    jgen.writeObjectField("mxValue", val);
  }
  if (value.nulls != null) {
    jgen.writeObjectField("nulls", value.nulls);
  }
  jgen.writeEndObject();
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:23,代码来源:Metadata.java

示例2: getPrimitive

public PrimitiveTypeName getPrimitive(Type type) {
  switch (type) {
    case BYTE_ARRAY: // TODO: rename BINARY and remove this switch
      return PrimitiveTypeName.BINARY;
    case INT64:
      return PrimitiveTypeName.INT64;
    case INT32:
      return PrimitiveTypeName.INT32;
    case BOOLEAN:
      return PrimitiveTypeName.BOOLEAN;
    case FLOAT:
      return PrimitiveTypeName.FLOAT;
    case DOUBLE:
      return PrimitiveTypeName.DOUBLE;
    case INT96:
      return PrimitiveTypeName.INT96;
    case FIXED_LEN_BYTE_ARRAY:
      return PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY;
    default:
      throw new RuntimeException("Unknown type " + type);
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:22,代码来源:ParquetMetadataConverter.java

示例3: getMin

@JsonProperty(value = "min")
public Object getMin() {
  if (primitiveType == PrimitiveTypeName.BINARY && min != null) {
    return new String(((Binary) min).getBytes());
  }
  return min;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:7,代码来源:Metadata.java

示例4: getMax

@JsonProperty(value = "max")
public Object getMax() {
  if (primitiveType == PrimitiveTypeName.BINARY && max != null) {
    return new String(((Binary) max).getBytes());
  }
  return max;
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:7,代码来源:Metadata.java

示例5: correctBinaryInMetadataCache

/**
 * Checks assigns byte arrays to min/max values obtained from the deserialized string
 * for BINARY.
 *
 * @param parquetTableMetadata table metadata that should be corrected
 */
public static void correctBinaryInMetadataCache(Metadata.ParquetTableMetadataBase parquetTableMetadata) {
  // Looking for the names of the columns with BINARY data type
  // in the metadata cache file for V2 and all v3 versions
  Set<List<String>> columnsNames = getBinaryColumnsNames(parquetTableMetadata);

  for (Metadata.ParquetFileMetadata file : parquetTableMetadata.getFiles()) {
    for (Metadata.RowGroupMetadata rowGroupMetadata : file.getRowGroups()) {
      Long rowCount = rowGroupMetadata.getRowCount();
      for (Metadata.ColumnMetadata columnMetadata : rowGroupMetadata.getColumns()) {
        // Setting Min/Max values for ParquetTableMetadata_v1
        if (new MetadataVersion(1, 0).equals(new MetadataVersion(parquetTableMetadata.getMetadataVersion()))) {
          if (columnMetadata.getPrimitiveType() == PrimitiveTypeName.BINARY
              || columnMetadata.getPrimitiveType() == PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY) {
            setMinMaxValues(columnMetadata, rowCount);
          }
        }
        // Setting Min/Max values for V2 and all V3 versions before V3_3
        else if (new MetadataVersion(parquetTableMetadata.getMetadataVersion()).compareTo(new MetadataVersion(3, 3)) < 0
                  && columnsNames.contains(Arrays.asList(columnMetadata.getName()))) {
          setMinMaxValues(columnMetadata, rowCount);
        }
        // Setting Min/Max values for V3_3 and all younger versions
        else if (new MetadataVersion(parquetTableMetadata.getMetadataVersion()).compareTo(new MetadataVersion(3, 3)) >= 0
                    && columnsNames.contains(Arrays.asList(columnMetadata.getName()))) {
          convertMinMaxValues(columnMetadata, rowCount);
        }
      }
    }
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:36,代码来源:ParquetReaderUtility.java

示例6: createColumnChunkMetaData

private ColumnChunkMetaData createColumnChunkMetaData() {
  Set<org.apache.parquet.column.Encoding> e = new HashSet<org.apache.parquet.column.Encoding>();
  PrimitiveTypeName t = PrimitiveTypeName.BINARY;
  ColumnPath p = ColumnPath.get("foo");
  CompressionCodecName c = CompressionCodecName.GZIP;
  BinaryStatistics s = new BinaryStatistics();
  ColumnChunkMetaData md = ColumnChunkMetaData.get(p, t, c, e, s,
          0, 0, 0, 0, 0);
  return md;
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:10,代码来源:TestParquetMetadataConverter.java

示例7: convertType

private static Type convertType(final String name, final TypeInfo typeInfo, final Repetition repetition) {
  if (typeInfo.getCategory().equals(Category.PRIMITIVE)) {
    if (typeInfo.equals(TypeInfoFactory.stringTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.BINARY, name);
    } else if (typeInfo.equals(TypeInfoFactory.intTypeInfo) ||
        typeInfo.equals(TypeInfoFactory.shortTypeInfo) ||
        typeInfo.equals(TypeInfoFactory.byteTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.INT32, name);
    } else if (typeInfo.equals(TypeInfoFactory.longTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.INT64, name);
    } else if (typeInfo.equals(TypeInfoFactory.doubleTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.DOUBLE, name);
    } else if (typeInfo.equals(TypeInfoFactory.floatTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.FLOAT, name);
    } else if (typeInfo.equals(TypeInfoFactory.booleanTypeInfo)) {
      return new PrimitiveType(repetition, PrimitiveTypeName.BOOLEAN, name);
    } else if (typeInfo.equals(TypeInfoFactory.binaryTypeInfo)) {
      // TODO : binaryTypeInfo is a byte array. Need to map it
      throw new UnsupportedOperationException("Binary type not implemented");
    } else if (typeInfo.equals(TypeInfoFactory.timestampTypeInfo)) {
      throw new UnsupportedOperationException("Timestamp type not implemented");
    } else if (typeInfo.equals(TypeInfoFactory.voidTypeInfo)) {
      throw new UnsupportedOperationException("Void type not implemented");
    } else if (typeInfo.equals(TypeInfoFactory.unknownTypeInfo)) {
      throw new UnsupportedOperationException("Unknown type not implemented");
    } else {
      throw new IllegalArgumentException("Unknown type: " + typeInfo);
    }
  } else if (typeInfo.getCategory().equals(Category.LIST)) {
    return convertArrayType(name, (ListTypeInfo) typeInfo);
  } else if (typeInfo.getCategory().equals(Category.STRUCT)) {
    return convertStructType(name, (StructTypeInfo) typeInfo);
  } else if (typeInfo.getCategory().equals(Category.MAP)) {
    return convertMapType(name, (MapTypeInfo) typeInfo);
  } else if (typeInfo.getCategory().equals(Category.UNION)) {
    throw new UnsupportedOperationException("Union type not implemented");
  } else {
    throw new IllegalArgumentException("Unknown type: " + typeInfo);
  }
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:40,代码来源:HiveSchemaConverter.java

示例8: isBinaryType

private static boolean isBinaryType(PrimitiveTypeName type) {
  return (PrimitiveTypeName.BINARY == type || PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY == type);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:3,代码来源:LocalDictionariesReader.java

示例9: overrideSortOrderToSigned

/**
 * Returns whether to use signed order min and max with a type. It is safe to
 * use signed min and max when the type is a string type and contains only
 * ASCII characters (where the sign bit was 0). This checks whether the type
 * is a string type and uses {@code useSignedStringMinMax} to determine if
 * only ASCII characters were written.
 *
 * @param type a primitive type with a logical type annotation
 * @return true if signed order min/max can be used with this type
 */
private boolean overrideSortOrderToSigned(PrimitiveType type) {
  // even if the override is set, only return stats for string-ish types
  // a null type annotation is considered string-ish because some writers
  // failed to use the UTF8 annotation.
  OriginalType annotation = type.getOriginalType();
  return useSignedStringMinMax &&
      PrimitiveTypeName.BINARY == type.getPrimitiveTypeName() &&
      (annotation == null || STRING_TYPES.contains(annotation));
}
 
开发者ID:apache,项目名称:parquet-mr,代码行数:19,代码来源:ParquetMetadataConverter.java


注:本文中的org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.BINARY属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。