parquet.schema.Type.isPrimitive()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(97)

本文整理了Java中parquet.schema.Type.isPrimitive()方法的一些代码示例,展示了Type.isPrimitive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Type.isPrimitive()方法的具体详情如下:
包路径:parquet.schema.Type
类名称:Type
方法名:isPrimitive

Type.isPrimitive介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

if (type.isPrimitive()) {
  checkInspectorCategory(inspector, ObjectInspector.Category.PRIMITIVE);
  writePrimitive(value, (PrimitiveObjectInspector) inspector);

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * @return this if it's a group type
 * @throws ClassCastException if not
 */
public GroupType asGroupType() {
 if (isPrimitive()) {
  throw new ClassCastException(this + " is not a group");
 }
 return (GroupType)this;
}

代码示例来源:origin: julienledem/redelm

public GroupType asGroupType() {
 if (isPrimitive()) {
  throw new ClassCastException(this.getName() + " is not a group");
 }
 return (GroupType)this;
}

代码示例来源:origin: com.twitter/parquet-cascading

private Converter newConverter(Type type, int i) {
 if(!type.isPrimitive()) {
  throw new IllegalArgumentException("cascading can only build tuples from primitive types");
 } else {
  return new TuplePrimitiveConverter(this, i);
 }
}

代码示例来源:origin: julienledem/redelm

void membersDisplayString(StringBuilder sb, String indent) {
 for (Type field : fields) {
  field.writeToStringBuilder(sb, indent);
  if (field.isPrimitive()) {
   sb.append(";");
  }
  sb.append("\n");
 }
}

代码示例来源:origin: julienledem/redelm

public PrimitiveType asPrimitiveType() {
 if (!isPrimitive()) {
  throw new ClassCastException(this.getName() + " is not a primititve");
 }
 return (PrimitiveType)this;
}

代码示例来源:origin: org.apache.tajo/tajo-storage

private Column convertField(final Type fieldType) {
 if (fieldType.isPrimitive()) {
  return convertPrimitiveField(fieldType);
 } else {
  return convertComplexField(fieldType);
 }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-hive

private static BlockConverter createConverter(Type prestoType, String columnName, parquet.schema.Type parquetType, int fieldIndex)
{
  if (parquetType.isPrimitive()) {
    return new ParquetPrimitiveConverter(prestoType, fieldIndex);
  }
  return createGroupConverter(prestoType, columnName, parquetType, fieldIndex);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

/**
 * {@inheritDoc}
 */
@Override
protected boolean equals(Type otherType) {
 return
   !otherType.isPrimitive()
   && super.equals(otherType)
   && getFields().equals(otherType.asGroupType().getFields());
}

代码示例来源:origin: com.twitter/parquet-pig

private FieldSchema getFieldSchema(Type parquetType) throws FrontendException {
 final String fieldName = parquetType.getName();
 if (parquetType.isPrimitive()) {
  return getSimpleFieldSchema(fieldName, parquetType);
 } else {
  return getComplexFieldSchema(fieldName, parquetType);
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public void visit(PrimitiveType primitiveType) {
 if (!currentRequestedType.isPrimitive() || 
     (this.strictTypeChecking && currentRequestedType.asPrimitiveType().getPrimitiveTypeName() != primitiveType.getPrimitiveTypeName())) {
  incompatibleSchema(primitiveType, currentRequestedType);
 }
 PrimitiveColumnIO newIO = new PrimitiveColumnIO(primitiveType, current, currentRequestedIndex, leaves.size());
 current.add(newIO);
 leaves.add(newIO);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

protected static Converter getConverterFromDescription(Type type, int index, ConverterParent parent) {
 if (type == null) {
  return null;
 }
 if (type.isPrimitive()) {
  return getConverterFromDescription(type.asPrimitiveType(), index, parent);
 }
 return getConverterFromDescription(type.asGroupType(), index, parent);
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
void checkContains(Type subType) {
 super.checkContains(subType);
 if (!subType.isPrimitive()) {
  throw new InvalidRecordException(subType + " found: expected " + this);
 }
 PrimitiveType primitiveType = subType.asPrimitiveType();
 if (this.primitive != primitiveType.primitive) {
  throw new InvalidRecordException(subType + " found: expected " + this);
 }
}

代码示例来源:origin: julienledem/redelm

@Override
void checkContains(Type subType) {
 super.checkContains(subType);
 if (!subType.isPrimitive()) {
  throw new InvalidRecordException(subType + " found: expected " + this);
 }
 PrimitiveType primitiveType = subType.asPrimitiveType();
 if (this.primitive != primitiveType.primitive) {
  throw new InvalidRecordException(subType + " found: expected " + this);
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private boolean contains(GroupType group, String[] path, int index) {
 if (index == path.length) {
  return false;
 }
 if (group.containsField(path[index])) {
  Type type = group.getType(path[index]);
  if (type.isPrimitive()) {
   return index + 1 == path.length;
  } else {
   return contains(type.asGroupType(), path, index + 1);
  }
 }
 return false;
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
public void visit(GroupType groupType) {
 if (currentRequestedType.isPrimitive()) {
  incompatibleSchema(groupType, currentRequestedType);
 }
 GroupColumnIO newIO = new GroupColumnIO(groupType, current, currentRequestedIndex);
 current.add(newIO);
 visitChildren(newIO, groupType, currentRequestedType.asGroupType());
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

void checkGroupContains(Type subType) {
 if (subType.isPrimitive()) {
  throw new InvalidRecordException(subType + " found: expected " + this);
 }
 List<Type> fields = subType.asGroupType().getFields();
 for (Type otherType : fields) {
  Type thisType = this.getType(otherType.getName());
  thisType.checkContains(otherType);
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

@Override
protected Type union(Type toMerge, boolean strict) {
 if (toMerge.isPrimitive()) {
  throw new IncompatibleSchemaModificationException("can not merge primitive type " + toMerge + " into group type " + this);
 }
 return new GroupType(toMerge.getRepetition(), getName(), mergeFields(toMerge.asGroupType()));
}

代码示例来源:origin: julienledem/redelm

private void writeNull(ColumnIO undefinedField, int r, int d) {
 if (undefinedField.getType().isPrimitive()) {
  columnWriter[((PrimitiveColumnIO)undefinedField).getId()].writeNull(r, d);
 } else {
  GroupColumnIO groupColumnIO = (GroupColumnIO)undefinedField;
  int childrenCount = groupColumnIO.getChildrenCount();
  for (int i = 0; i < childrenCount; i++) {
   writeNull(groupColumnIO.getChild(i), r, d);
  }
 }
}

代码示例来源:origin: com.facebook.presto.hive/hive-apache

private void writeNull(ColumnIO undefinedField, int r, int d) {
 if (undefinedField.getType().isPrimitive()) {
  columnWriter[((PrimitiveColumnIO)undefinedField).getId()].writeNull(r, d);
 } else {
  GroupColumnIO groupColumnIO = (GroupColumnIO)undefinedField;
  int childrenCount = groupColumnIO.getChildrenCount();
  for (int i = 0; i < childrenCount; i++) {
   writeNull(groupColumnIO.getChild(i), r, d);
  }
 }
}

相关文章