Java Code Examples for org.apache.arrow.vector.types.pojo.ArrowType#List

The following examples show how to use org.apache.arrow.vector.types.pojo.ArrowType#List . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlattenPrel.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public Field visit(ArrowType.List type) {
  if(field.getName().equals(column.getAsUnescapedPath())){
    Field child = field.getChildren().get(0);
    return new Field(field.getName(), child.isNullable(), child.getType(), child.getChildren());
  }
  return field;
}
 
Example 2
Source File: SchemaConverter.java    From parquet-mr with Apache License 2.0 5 votes vote down vote up
/**
 * @param type parquet type
 * @param name overrides parquet.getName)
 * @param repetition overrides parquet.getRepetition()
 * @return a type mapping from the Parquet type to an Arrow type
 */
private TypeMapping fromParquet(Type type, String name, Repetition repetition) {
  if (repetition == REPEATED) {
    // case where we have a repeated field that is not in a List/Map
    TypeMapping child = fromParquet(type, null, REQUIRED);
    Field arrowField = new Field(name, false, new ArrowType.List(), asList(child.getArrowField()));
    return new RepeatedTypeMapping(arrowField, type, child);
  }
  if (type.isPrimitive()) {
    return fromParquetPrimitive(type.asPrimitiveType(), name);
  } else {
    return fromParquetGroup(type.asGroupType(), name);
  }
}
 
Example 3
Source File: ArrowTypeSerDe.java    From aws-athena-query-federation with Apache License 2.0 4 votes vote down vote up
private Serializer()
{
    super(ArrowType.class, ArrowType.List.class);
}
 
Example 4
Source File: ArrowTypeSerDe.java    From aws-athena-query-federation with Apache License 2.0 4 votes vote down vote up
private Deserializer()
{
    super(ArrowType.class, ArrowType.List.class);
}
 
Example 5
Source File: ArrowTypeSerDe.java    From aws-athena-query-federation with Apache License 2.0 4 votes vote down vote up
@Override
protected ArrowType doTypedDeserialize(JsonParser jparser, DeserializationContext ctxt)
        throws IOException
{
    return new ArrowType.List();
}
 
Example 6
Source File: SqlTypeNameToArrowType.java    From dremio-flight-connector with Apache License 2.0 4 votes vote down vote up
public static ArrowType toArrowType(UserProtos.ResultColumnMetadata type) {
  String typeName = type.getDataType();
  switch (typeName) {
    case "NULL":
      return new Null();
    case "MAP":
      return new ArrowType.Map(false); //todo inner type?
    case "ARRAY":
      return new ArrowType.List(); //todo inner type?
    case "UNION":
      throw new UnsupportedOperationException("have not implemented unions");
      //return new Union(); //todo inner type?
    case "TINYINT":
      return new Int(8, true);
    case "SMALLINT":
      return new Int(16, true);
    case "INTEGER":
      return new Int(32, true);
    case "BIGINT":
      return new Int(64, true);
    case "FLOAT":
      return new FloatingPoint(FloatingPointPrecision.SINGLE);
    case "DOUBLE":
      return new FloatingPoint(FloatingPointPrecision.DOUBLE);
    case "CHARACTER VARYING":
      return new Utf8();
    case "BINARY VARYING":
      return new Binary();
    case "BOOLEAN":
      return new Bool();
    case "DECIMAL":
      return new Decimal(type.getPrecision(), type.getScale());
    case "DATE":
      return new Date(DateUnit.MILLISECOND);
    case "TIME":
      return new Time(TimeUnit.MICROSECOND, 64);
    case "TIMESTAMP":
      return new Timestamp(TimeUnit.MICROSECOND, "UTC");
    case "INTERVAL DAY TO SECOND":
      return new Interval(IntervalUnit.DAY_TIME);
    case "INTERVAL YEAR TO MONTH":
      return new Interval(IntervalUnit.YEAR_MONTH);
    case "BINARY":
      return new ArrowType.FixedSizeBinary(50);
    default:
      throw new IllegalStateException("unable to find arrow type for " + typeName);
  }
}
 
Example 7
Source File: ComplexToJsonPrel.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Field visit(ArrowType.List type) {
  return asVarchar();
}
 
Example 8
Source File: APIFieldDescriber.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Void visit(ArrowType.List list) {
  return writeString("LIST");
}