hongyu guo created CALCITE-6292:
-----------------------------------

             Summary: Support more arrow type
                 Key: CALCITE-6292
                 URL: https://issues.apache.org/jira/browse/CALCITE-6292
             Project: Calcite
          Issue Type: Sub-task
            Reporter: hongyu guo


All arrow type:
{code:java}
public static enum ArrowTypeID {
    Null(Type.Null),
    Struct(Type.Struct_),
    List(Type.List),
    LargeList(Type.LargeList),
    FixedSizeList(Type.FixedSizeList),
    Union(Type.Union),
    Map(Type.Map),
    Int(Type.Int),
    FloatingPoint(Type.FloatingPoint),
    Utf8(Type.Utf8),
    LargeUtf8(Type.LargeUtf8),
    Binary(Type.Binary),
    LargeBinary(Type.LargeBinary),
    FixedSizeBinary(Type.FixedSizeBinary),
    Bool(Type.Bool),
    Decimal(Type.Decimal),
    Date(Type.Date),
    Time(Type.Time),
    Timestamp(Type.Timestamp),
    Interval(Type.Interval),
    Duration(Type.Duration),
    NONE(Type.NONE);
}
{code}
we support now:
{code:java}
  public static ArrowFieldType of(ArrowType arrowType) {
    switch (arrowType.getTypeID()) {
    case Int:
      int bitWidth = ((ArrowType.Int) arrowType).getBitWidth();
      switch (bitWidth) {
      case 64:
        return LONG;
      case 32:
        return INT;
      case 16:
        return SHORT;
      case 8:
        return BYTE;
      default:
        throw new IllegalArgumentException("Unsupported Int bit width: " + 
bitWidth);
      }
    case Bool:
      return BOOLEAN;
    case Utf8:
      return STRING;
    case FloatingPoint:
      FloatingPointPrecision precision = ((ArrowType.FloatingPoint) 
arrowType).getPrecision();
      switch (precision) {
      case SINGLE:
        return FLOAT;
      case DOUBLE:
        return DOUBLE;
      default:
        throw new IllegalArgumentException("Unsupported Floating point 
precision: " + precision);
      }
    case Date:
      return DATE;
    case Decimal:
      return DECIMAL;
    default:
      throw new IllegalArgumentException("Unsupported type: " + arrowType);
    }
  }
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to