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

The following examples show how to use org.apache.arrow.vector.types.pojo.ArrowType.Time. 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: Describer.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public String visit(Time type) {
  String name = "time";
  TimeUnit unit = type.getUnit();
  if (unit == TimeUnit.MILLISECOND) {
    return name;
  }
  return String.format("%s(%s)", name, unit);
}
 
Example #2
Source File: CompleteType.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public boolean isTemporal() {
  switch(type.getTypeID()){
    case Date:
    case Time:
    case Timestamp:
      return true;
    default:
      return false;
  }
}
 
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(Time type) {
  return visitGeneric(type);
}
 
Example #5
Source File: SqlDisplaySizeVisitor.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public Integer visit(Time paramTime) {
  return 8; // hh-mm-ss
}
 
Example #6
Source File: SqlTypeNameVisitor.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
@Override
public String visit(Time paramTime) {
  return "TIME";
}