Java Code Examples for org.apache.arrow.vector.types.Types.MinorType#DATEMILLI

The following examples show how to use org.apache.arrow.vector.types.Types.MinorType#DATEMILLI . 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: MajorTypeHelper.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
public static MinorType getArrowMinorType(TypeProtos.MinorType minorType) {
  switch (minorType) {
  case LATE:
    return MinorType.NULL;
  case TIMESTAMP:
    return MinorType.TIMESTAMPMILLI;
  case TIME:
    return MinorType.TIMEMILLI;
  case DATE:
    return MinorType.DATEMILLI;
  default:
    return MinorType.valueOf(minorType.name());
  }
}
 
Example 2
Source File: BasicTypeHelper.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
public static MinorType getValueHolderType(ValueHolder holder) {

    if (0 == 1) {
      return null;
    } else if (holder instanceof TinyIntHolder) {
      return MinorType.TINYINT;
    } else if (holder instanceof NullableTinyIntHolder) {
      return MinorType.TINYINT;
    } else if (holder instanceof UInt1Holder) {
      return MinorType.UINT1;
    } else if (holder instanceof NullableUInt1Holder) {
      return MinorType.UINT1;
    } else if (holder instanceof UInt2Holder) {
      return MinorType.UINT2;
    } else if (holder instanceof NullableUInt2Holder) {
      return MinorType.UINT2;
    } else if (holder instanceof SmallIntHolder) {
      return MinorType.SMALLINT;
    } else if (holder instanceof NullableSmallIntHolder) {
      return MinorType.SMALLINT;
    } else if (holder instanceof IntHolder) {
      return MinorType.INT;
    } else if (holder instanceof NullableIntHolder) {
      return MinorType.INT;
    } else if (holder instanceof UInt4Holder) {
      return MinorType.UINT4;
    } else if (holder instanceof NullableUInt4Holder) {
      return MinorType.UINT4;
    } else if (holder instanceof Float4Holder) {
      return MinorType.FLOAT4;
    } else if (holder instanceof NullableFloat4Holder) {
      return MinorType.FLOAT4;
    } else if (holder instanceof IntervalYearHolder) {
      return MinorType.INTERVALYEAR;
    } else if (holder instanceof NullableIntervalYearHolder) {
      return MinorType.INTERVALYEAR;
    } else if (holder instanceof TimeMilliHolder) {
      return MinorType.TIMEMILLI;
    } else if (holder instanceof NullableTimeMilliHolder) {
      return MinorType.TIMEMILLI;
    } else if (holder instanceof BigIntHolder) {
      return MinorType.BIGINT;
    } else if (holder instanceof NullableBigIntHolder) {
      return MinorType.BIGINT;
    } else if (holder instanceof UInt8Holder) {
      return MinorType.UINT8;
    } else if (holder instanceof NullableUInt8Holder) {
      return MinorType.UINT8;
    } else if (holder instanceof Float8Holder) {
      return MinorType.FLOAT8;
    } else if (holder instanceof NullableFloat8Holder) {
      return MinorType.FLOAT8;
    } else if (holder instanceof DateMilliHolder) {
      return MinorType.DATEMILLI;
    } else if (holder instanceof NullableDateMilliHolder) {
      return MinorType.DATEMILLI;
    } else if (holder instanceof TimeStampMilliHolder) {
      return MinorType.TIMESTAMPMILLI;
    } else if (holder instanceof NullableTimeStampMilliHolder) {
      return MinorType.TIMESTAMPMILLI;
    } else if (holder instanceof IntervalDayHolder) {
      return MinorType.INTERVALDAY;
    } else if (holder instanceof NullableIntervalDayHolder) {
      return MinorType.INTERVALDAY;
    } else if (holder instanceof DecimalHolder) {
      return MinorType.DECIMAL;
    } else if (holder instanceof NullableDecimalHolder) {
      return MinorType.DECIMAL;
    } else if (holder instanceof FixedSizeBinaryHolder) {
      return MinorType.FIXEDSIZEBINARY;
    } else if (holder instanceof NullableFixedSizeBinaryHolder) {
      return MinorType.FIXEDSIZEBINARY;
    } else if (holder instanceof VarBinaryHolder) {
      return MinorType.VARBINARY;
    } else if (holder instanceof NullableVarBinaryHolder) {
      return MinorType.VARBINARY;
    } else if (holder instanceof VarCharHolder) {
      return MinorType.VARCHAR;
    } else if (holder instanceof NullableVarCharHolder) {
      return MinorType.VARCHAR;
    } else if (holder instanceof BitHolder) {
      return MinorType.BIT;
    } else if (holder instanceof NullableBitHolder) {
      return MinorType.BIT;
    }

    throw new UnsupportedOperationException("ValueHolder is not supported for 'getValueHolderType' method.");

  }
 
Example 3
Source File: HiveUtilities.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method which converts Hive primitive type to Dremio primitive type
 * @param primitiveTypeInfo
 * @param options
 * @return
 */
private static final MinorType getMinorTypeFromHivePrimitiveTypeInfo(PrimitiveTypeInfo primitiveTypeInfo,
    OptionManager options) {
  switch(primitiveTypeInfo.getPrimitiveCategory()) {
    case BINARY:
      return MinorType.VARBINARY;
    case BOOLEAN:
      return MinorType.BIT;
    case DECIMAL: {

      if (options.getOption(PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY).getBoolVal() == false) {
        throw UserException.unsupportedError()
            .message(ExecErrorConstants.DECIMAL_DISABLE_ERR_MSG)
            .build(logger);
      }
      return MinorType.DECIMAL;
    }
    case DOUBLE:
      return MinorType.FLOAT8;
    case FLOAT:
      return MinorType.FLOAT4;
    // TODO (DRILL-2470)
    // Byte and short (tinyint and smallint in SQL types) are currently read as integers
    // as these smaller integer types are not fully supported in Dremio today.
    case SHORT:
    case BYTE:
    case INT:
      return MinorType.INT;
    case LONG:
      return MinorType.BIGINT;
    case STRING:
    case VARCHAR:
    case CHAR:
      return MinorType.VARCHAR;
    case TIMESTAMP:
      return MinorType.TIMESTAMPMILLI;
    case DATE:
      return MinorType.DATEMILLI;
  }
  throwUnsupportedHiveDataTypeError(primitiveTypeInfo.getPrimitiveCategory().toString());
  return null;
}
 
Example 4
Source File: HiveUtilities.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method which converts Hive primitive type to Dremio primitive type
 * @param primitiveTypeInfo
 * @param options
 * @return
 */
private static final MinorType getMinorTypeFromHivePrimitiveTypeInfo(PrimitiveTypeInfo primitiveTypeInfo,
    OptionManager options) {
  switch(primitiveTypeInfo.getPrimitiveCategory()) {
    case BINARY:
      return MinorType.VARBINARY;
    case BOOLEAN:
      return MinorType.BIT;
    case DECIMAL: {

      if (options.getOption(PlannerSettings.ENABLE_DECIMAL_DATA_TYPE_KEY).getBoolVal() == false) {
        throw UserException.unsupportedError()
            .message(ExecErrorConstants.DECIMAL_DISABLE_ERR_MSG)
            .build(logger);
      }
      return MinorType.DECIMAL;
    }
    case DOUBLE:
      return MinorType.FLOAT8;
    case FLOAT:
      return MinorType.FLOAT4;
    // TODO (DRILL-2470)
    // Byte and short (tinyint and smallint in SQL types) are currently read as integers
    // as these smaller integer types are not fully supported in Dremio today.
    case SHORT:
    case BYTE:
    case INT:
      return MinorType.INT;
    case LONG:
      return MinorType.BIGINT;
    case STRING:
    case VARCHAR:
    case CHAR:
      return MinorType.VARCHAR;
    case TIMESTAMP:
      return MinorType.TIMESTAMPMILLI;
    case DATE:
      return MinorType.DATEMILLI;
  }
  throwUnsupportedHiveDataTypeError(primitiveTypeInfo.getPrimitiveCategory().toString());
  return null;
}