@ScalarFunction
  public static Object cast(Object value, String targetTypeLiteral) {
    try {
      Class<?> clazz = value.getClass();
      // TODO: Support cast for MV
      Preconditions.checkArgument(!clazz.isArray() | clazz == byte[].class, "%s must not be an array type", clazz);
      PinotDataType sourceType = PinotDataType.getSingleValueType(clazz);
      String transformed = targetTypeLiteral.toUpperCase();
      PinotDataType targetDataType;
      if ("INT".equals(transformed)) {
        targetDataType = INTEGER;
      } else if ("VARCHAR".equals(transformed)) {
        targetDataType = STRING;
      } else {
        targetDataType = PinotDataType.valueOf(transformed);
      }
      if (sourceType == STRING && (targetDataType == INTEGER || targetDataType == LONG)) {
        if (String.valueOf(value).contains(".")) {
          // convert integers via double to avoid parse errors
          return targetDataType.convert(DOUBLE.convert(value, sourceType), DOUBLE);
        }
      }
      return targetDataType.convert(value, sourceType);
    } catch (IllegalArgumentException e) {
      throw new IllegalArgumentException("Unknown data type: " + targetTypeLiteral);
    }
  }
@Test(dataProvider = "testCases")
  public void test(Object value, String type, Object expected) {
    assertEquals(DataTypeConversionFunctions.cast(value, type), expected);
  }