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

The following examples show how to use org.apache.arrow.vector.types.pojo.ArrowType#FixedSizeBinary . 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: ArrowTypeSerDe.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
@Override
protected void doTypedSerialize(ArrowType arrowType, JsonGenerator jgen, SerializerProvider provider)
        throws IOException
{
    ArrowType.FixedSizeBinary fixedSizeBinary = (ArrowType.FixedSizeBinary) arrowType;
    jgen.writeNumberField(BYTE_WIDTH_FIELD, fixedSizeBinary.getByteWidth());
}
 
Example 2
Source File: ArrowTypeSerDe.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
@Override
protected ArrowType doTypedDeserialize(JsonParser jparser, DeserializationContext ctxt)
        throws IOException
{
    int byteWidth = getNextIntField(jparser, BYTE_WIDTH_FIELD);
    return new ArrowType.FixedSizeBinary(byteWidth);
}
 
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.FixedSizeBinary.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.FixedSizeBinary.class);
}
 
Example 5
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 6
Source File: APIFieldDescriber.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Void visit(ArrowType.FixedSizeBinary fixedSizeBinary) {
  return writeString("BINARY");
}