org.apache.arrow.vector.types.pojo.ArrowType.Null Java Examples

The following examples show how to use org.apache.arrow.vector.types.pojo.ArrowType.Null. 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: ParquetRecordWriter.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public FieldConverter getNewListConverter(int fieldId, String fieldName, FieldReader reader) {
  if (reader.getField().getChildren().get(0).getFieldType().getType().equals(Null.INSTANCE)) {
    return null;
  }
  return new ListParquetConverter(fieldId, fieldName, reader);
}
 
Example #2
Source File: SchemaMerger.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
private MergeField mergeUnion(SchemaPath parent, ElasticField declaredField, CompleteType observedType){
  List<Field> fields = observedType.getChildren();

  if(fields.size() != 2){
    // fall back to default merging, same as below
    return new MergeField(parent, declaredField, observedType);
  }

  Field f1 = fields.get(0);
  Field f2 = fields.get(1);
  CompleteType t1 = CompleteType.fromField(f1);
  CompleteType t2 = CompleteType.fromField(f2);

  if( !(t1.isList() && !t2.isList()) &&  !(!t1.isList() && t2.isList())){
    // one of the two types has to be a list type.
    return new MergeField(parent, declaredField, observedType);
  }


  CompleteType listType = t1.isList() ? t1 : t2;
  CompleteType nonListType = t1.isList() ? t2 : t1;

  Field listChild = listType.getOnlyChild();

  // check that the basic list types are the same. We don't compare full types here because it could be that the two different structs (only a subset of fields showed up in one or both structs).
  if(!listChild.getType().equals(nonListType.getType()) && !listChild.getType().equals(Null.INSTANCE)){
    return new MergeField(parent, declaredField, observedType);
  }

  CompleteType combined = nonListType.merge(CompleteType.fromField(listChild));

  return mergeField(parent, declaredField, combined).asList();

}
 
Example #3
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 #4
Source File: AbstractArrowTypeVisitor.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public T visit(Null type) {
  return visitGeneric(type);
}
 
Example #5
Source File: Describer.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public String visit(Null type) {
  return "null";
}
 
Example #6
Source File: CompleteType.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
public boolean isNull() {
  return type == ArrowType.Null.INSTANCE;
}
 
Example #7
Source File: SqlDisplaySizeVisitor.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Integer visit(Null paramNull) {
  return 0;
}
 
Example #8
Source File: SqlTypeNameVisitor.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public String visit(Null paramNull) {
  return "NULL";
}
 
Example #9
Source File: ComplexToJsonPrel.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Field visit(Null type) {
  return asVarchar();
}