Ejemplo n.º 1
0
 @Override
 public Object get(int ordinal, DataType dataType) {
   if (isNullAt(ordinal) || dataType instanceof NullType) {
     return null;
   } else if (dataType instanceof BooleanType) {
     return getBoolean(ordinal);
   } else if (dataType instanceof ByteType) {
     return getByte(ordinal);
   } else if (dataType instanceof ShortType) {
     return getShort(ordinal);
   } else if (dataType instanceof IntegerType) {
     return getInt(ordinal);
   } else if (dataType instanceof LongType) {
     return getLong(ordinal);
   } else if (dataType instanceof FloatType) {
     return getFloat(ordinal);
   } else if (dataType instanceof DoubleType) {
     return getDouble(ordinal);
   } else if (dataType instanceof DecimalType) {
     DecimalType dt = (DecimalType) dataType;
     return getDecimal(ordinal, dt.precision(), dt.scale());
   } else if (dataType instanceof DateType) {
     return getInt(ordinal);
   } else if (dataType instanceof TimestampType) {
     return getLong(ordinal);
   } else if (dataType instanceof BinaryType) {
     return getBinary(ordinal);
   } else if (dataType instanceof StringType) {
     return getUTF8String(ordinal);
   } else if (dataType instanceof CalendarIntervalType) {
     return getInterval(ordinal);
   } else if (dataType instanceof StructType) {
     return getStruct(ordinal, ((StructType) dataType).size());
   } else if (dataType instanceof ArrayType) {
     return getArray(ordinal);
   } else if (dataType instanceof MapType) {
     return getMap(ordinal);
   } else if (dataType instanceof UserDefinedType) {
     return get(ordinal, ((UserDefinedType) dataType).sqlType());
   } else {
     throw new UnsupportedOperationException("Unsupported data type " + dataType.simpleString());
   }
 }