[bugfix] fix floating point and integral type backward incompatible issue (#10650)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java b/pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
index a350216..3436e82 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/context/LiteralContext.java
@@ -42,13 +42,12 @@
  */
 public class LiteralContext {
   // TODO: Support all of the types for sql.
-  private FieldSpec.DataType _type;
-  private Object _value;
-
-  private BigDecimal _bigDecimalValue;
+  private final FieldSpec.DataType _type;
+  private final Object _value;
+  private final BigDecimal _bigDecimalValue;
 
   private static BigDecimal getBigDecimalValue(FieldSpec.DataType type, Object value) {
-    switch (type){
+    switch (type) {
       case BIG_DECIMAL:
         return (BigDecimal) value;
       case BOOLEAN:
@@ -56,7 +55,7 @@
       case TIMESTAMP:
         return PinotDataType.TIMESTAMP.toBigDecimal(Timestamp.valueOf(value.toString()));
       default:
-        if(type.isNumeric()){
+        if (type.isNumeric()) {
           return new BigDecimal(value.toString());
         }
         return BigDecimal.ZERO;
@@ -68,7 +67,7 @@
     // Try to interpret the literal as number
     try {
       Number number = NumberUtils.createNumber(literal);
-      if  (number instanceof BigDecimal || number instanceof BigInteger) {
+      if (number instanceof BigDecimal || number instanceof BigInteger) {
         return ImmutablePair.of(FieldSpec.DataType.BIG_DECIMAL, new BigDecimal(literal));
       } else {
         return ImmutablePair.of(FieldSpec.DataType.STRING, literal);
@@ -90,43 +89,67 @@
   public LiteralContext(Literal literal) {
     Preconditions.checkState(literal.getFieldValue() != null,
         "Field value cannot be null for field:" + literal.getSetField());
-    switch (literal.getSetField()){
+    switch (literal.getSetField()) {
       case BOOL_VALUE:
         _type = FieldSpec.DataType.BOOLEAN;
         _value = literal.getFieldValue();
-        break;
-      case DOUBLE_VALUE:
-        _type = FieldSpec.DataType.DOUBLE;
-        _value = literal.getFieldValue();
+        _bigDecimalValue = PinotDataType.BOOLEAN.toBigDecimal(_value);
         break;
       case LONG_VALUE:
-        _type = FieldSpec.DataType.LONG;
-        _value = literal.getFieldValue();
+        long longValue = literal.getLongValue();
+        if (longValue == (int) longValue) {
+          _type = FieldSpec.DataType.INT;
+          _value = (int) longValue;
+        } else {
+          _type = FieldSpec.DataType.LONG;
+          _value = longValue;
+        }
+        _bigDecimalValue = new BigDecimal(longValue);
+        break;
+      case DOUBLE_VALUE:
+        String stringValue = literal.getFieldValue().toString();
+        Number floatingNumber = NumberUtils.createNumber(stringValue);
+        if (floatingNumber instanceof Float) {
+          _type = FieldSpec.DataType.FLOAT;
+          _value = floatingNumber;
+        } else {
+          _type = FieldSpec.DataType.DOUBLE;
+          _value = literal.getDoubleValue();
+        }
+        _bigDecimalValue = new BigDecimal(stringValue);
+        break;
+      case STRING_VALUE:
+        Pair<FieldSpec.DataType, Object> typeAndValue =
+            inferLiteralDataTypeAndValue(literal.getFieldValue().toString());
+        _type = typeAndValue.getLeft();
+        _value = typeAndValue.getRight();
+        if (_type == FieldSpec.DataType.BIG_DECIMAL) {
+          _bigDecimalValue = (BigDecimal) _value;
+        } else if (_type == FieldSpec.DataType.TIMESTAMP) {
+          _bigDecimalValue = PinotDataType.TIMESTAMP.toBigDecimal(Timestamp.valueOf(_value.toString()));
+        } else {
+          _bigDecimalValue = BigDecimal.ZERO;
+        }
         break;
       case NULL_VALUE:
         _type = FieldSpec.DataType.UNKNOWN;
         _value = null;
-        break;
-      case STRING_VALUE:
-        Pair<FieldSpec.DataType, Object> typeAndValue = inferLiteralDataTypeAndValue(literal.getFieldValue().toString());
-        _type = typeAndValue.getLeft();
-        _value = typeAndValue.getRight();
+        _bigDecimalValue = BigDecimal.ZERO;
         break;
       default:
         throw new UnsupportedOperationException("Unsupported data type:" + literal.getSetField());
     }
-    _bigDecimalValue = getBigDecimalValue(_type, _value);
   }
 
   public FieldSpec.DataType getType() {
     return _type;
   }
 
-  public int getIntValue(){
+  public int getIntValue() {
     return _bigDecimalValue.intValue();
   }
 
-  public double getDoubleValue(){
+  public double getDoubleValue() {
     return _bigDecimalValue.doubleValue();
   }
 
@@ -146,7 +169,7 @@
   // This ctor is only used for special handling in subquery.
   public LiteralContext(FieldSpec.DataType type, Object value) {
     _type = type;
-    if(type == FieldSpec.DataType.UNKNOWN){
+    if (type == FieldSpec.DataType.UNKNOWN) {
       _value = null;
     } else {
       _value = value;
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
index bd33dfc..ec9f010 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java
@@ -82,6 +82,10 @@
     return _longLiteral;
   }
 
+  public float getFloatLiteral() {
+    return _floatLiteral;
+  }
+
   public double getDoubleLiteral() {
     return _doubleLiteral;
   }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ScalarTransformFunctionWrapper.java b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ScalarTransformFunctionWrapper.java
index 7fa64d9..bf3444a 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ScalarTransformFunctionWrapper.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/ScalarTransformFunctionWrapper.java
@@ -102,10 +102,18 @@
             _scalarArguments[i] =
                 parameterTypes[i].convert(literalTransformFunction.getBooleanLiteral(), PinotDataType.BOOLEAN);
             break;
+          case INT:
+            _scalarArguments[i] =
+                parameterTypes[i].convert(literalTransformFunction.getIntLiteral(), PinotDataType.INTEGER);
+            break;
           case LONG:
             _scalarArguments[i] =
                 parameterTypes[i].convert(literalTransformFunction.getLongLiteral(), PinotDataType.LONG);
             break;
+          case FLOAT:
+            _scalarArguments[i] =
+                parameterTypes[i].convert(literalTransformFunction.getFloatLiteral(), PinotDataType.FLOAT);
+            break;
           case DOUBLE:
             _scalarArguments[i] =
                 parameterTypes[i].convert(literalTransformFunction.getDoubleLiteral(), PinotDataType.DOUBLE);
diff --git a/pinot-core/src/test/java/org/apache/pinot/common/request/context/LiteralContextTest.java b/pinot-core/src/test/java/org/apache/pinot/common/request/context/LiteralContextTest.java
index 5a00736..003ea4f 100644
--- a/pinot-core/src/test/java/org/apache/pinot/common/request/context/LiteralContextTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/common/request/context/LiteralContextTest.java
@@ -59,4 +59,40 @@
     Assert.assertEquals(LiteralContext.inferLiteralDataTypeAndValue("2020-02-02 20:20:20.20").getLeft(),
         FieldSpec.DataType.TIMESTAMP);
   }
+
+  @Test
+  public void testInferFloatDataType() {
+    Literal literalFloat = new Literal();
+    literalFloat.setDoubleValue(1.23);
+    LiteralContext floatContext = new LiteralContext(literalFloat);
+    Assert.assertEquals(floatContext.getType(), FieldSpec.DataType.FLOAT);
+    Assert.assertEquals(floatContext.getValue(), (float) literalFloat.getDoubleValue());
+  }
+
+  @Test
+  public void testInferDoubleDataType() {
+    Literal literalFloat = new Literal();
+    literalFloat.setDoubleValue(1.234567891011);
+    LiteralContext doubleContext = new LiteralContext(literalFloat);
+    Assert.assertEquals(doubleContext.getType(), FieldSpec.DataType.DOUBLE);
+    Assert.assertEquals(doubleContext.getValue(), literalFloat.getDoubleValue());
+  }
+
+  @Test
+  public void testInferIntDataType() {
+    Literal literalInt = new Literal();
+    literalInt.setLongValue(123);
+    LiteralContext floatContext = new LiteralContext(literalInt);
+    Assert.assertEquals(floatContext.getType(), FieldSpec.DataType.INT);
+    Assert.assertEquals(floatContext.getValue(), (int) literalInt.getLongValue());
+  }
+
+  @Test
+  public void testInferLongDataType() {
+    Literal literalLong = new Literal();
+    literalLong.setLongValue(Integer.MAX_VALUE + 1L);
+    LiteralContext longContext = new LiteralContext(literalLong);
+    Assert.assertEquals(longContext.getType(), FieldSpec.DataType.LONG);
+    Assert.assertEquals(longContext.getValue(), literalLong.getLongValue());
+  }
 }
diff --git a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunctionTest.java b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunctionTest.java
index 27529d8..329d662 100644
--- a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunctionTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/CaseTransformFunctionTest.java
@@ -26,7 +26,6 @@
 import org.apache.pinot.common.request.context.ExpressionContext;
 import org.apache.pinot.common.request.context.RequestContextUtils;
 import org.apache.pinot.spi.data.FieldSpec.DataType;
-import org.roaringbitmap.RoaringBitmap;
 import org.testng.Assert;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -56,8 +55,7 @@
   }
 
   @Test(dataProvider = "params")
-  public void testCasePriorityObserved(String column, int threshold1, int threshold2, int threshold3)
-      throws Exception {
+  public void testCasePriorityObserved(String column, int threshold1, int threshold2, int threshold3) {
     String statement =
         String.format("CASE WHEN %s > %d THEN 3 WHEN %s > %d THEN 2 WHEN %s > %d THEN 1 ELSE -1 END", column,
             threshold1, column, threshold2, column, threshold3);
@@ -83,7 +81,6 @@
               : _doubleSVValues[i] > threshold2 ? 2 : _doubleSVValues[i] > threshold3 ? 1 : -1;
           break;
         default:
-          throw new Exception("Unsupported column type:" + column);
       }
     }
     int[] intValues = transformFunction.transformToIntValuesSV(_projectionBlock);
@@ -91,82 +88,54 @@
   }
 
   @Test
-  public void testCaseTransformFunctionWithLongResults() {
-    long[] expectedLongResults = new long[NUM_ROWS];
-    Arrays.fill(expectedLongResults, 100);
-    testCaseQueryWithLongResults("true", expectedLongResults);
-    Arrays.fill(expectedLongResults, 10);
-    testCaseQueryWithLongResults("false", expectedLongResults);
+  public void testCaseTransformFunctionWithIntResults() {
+    int[] expectedIntResults = new int[NUM_ROWS];
+    Arrays.fill(expectedIntResults, 100);
+    testCaseQueryWithIntResults("true", expectedIntResults);
+    Arrays.fill(expectedIntResults, 10);
+    testCaseQueryWithIntResults("false", expectedIntResults);
+
     for (TransformFunctionType functionType : BINARY_OPERATOR_TRANSFORM_FUNCTIONS) {
-      testCaseQueryWithLongResults(String.format("%s(%s, %s)", functionType.getName(), INT_SV_COLUMN,
-          String.format("%d", _intSVValues[INDEX_TO_COMPARE])), getExpectedLongResults(INT_SV_COLUMN, functionType));
-      testCaseQueryWithLongResults(String.format("%s(%s, %s)", functionType.getName(), LONG_SV_COLUMN,
-          String.format("%d", _longSVValues[INDEX_TO_COMPARE])), getExpectedLongResults(LONG_SV_COLUMN, functionType));
-      testCaseQueryWithLongResults(String.format("%s(%s, %s)", functionType.getName(), FLOAT_SV_COLUMN,
+      testCaseQueryWithIntResults(String.format("%s(%s, %s)", functionType.getName(), INT_SV_COLUMN,
+          String.format("%d", _intSVValues[INDEX_TO_COMPARE])), getExpectedIntResults(INT_SV_COLUMN, functionType));
+      testCaseQueryWithIntResults(String.format("%s(%s, %s)", functionType.getName(), LONG_SV_COLUMN,
+          String.format("%d", _longSVValues[INDEX_TO_COMPARE])), getExpectedIntResults(LONG_SV_COLUMN, functionType));
+      testCaseQueryWithIntResults(String.format("%s(%s, %s)", functionType.getName(), FLOAT_SV_COLUMN,
               String.format("%f", _floatSVValues[INDEX_TO_COMPARE])),
-          getExpectedLongResults(FLOAT_SV_COLUMN, functionType));
-      testCaseQueryWithLongResults(String.format("%s(%s, %s)", functionType.getName(), DOUBLE_SV_COLUMN,
+          getExpectedIntResults(FLOAT_SV_COLUMN, functionType));
+      testCaseQueryWithIntResults(String.format("%s(%s, %s)", functionType.getName(), DOUBLE_SV_COLUMN,
               String.format("%.20f", _doubleSVValues[INDEX_TO_COMPARE])),
-          getExpectedLongResults(DOUBLE_SV_COLUMN, functionType));
-      testCaseQueryWithLongResults(String.format("%s(%s, %s)", functionType.getName(), STRING_SV_COLUMN,
+          getExpectedIntResults(DOUBLE_SV_COLUMN, functionType));
+      testCaseQueryWithIntResults(String.format("%s(%s, %s)", functionType.getName(), STRING_SV_COLUMN,
               String.format("'%s'", _stringSVValues[INDEX_TO_COMPARE])),
-          getExpectedLongResults(STRING_SV_COLUMN, functionType));
+          getExpectedIntResults(STRING_SV_COLUMN, functionType));
     }
-    RoaringBitmap bitmap = new RoaringBitmap();
-    for (int i = 0; i < NUM_ROWS; i++) {
-      if (i % 2 == 0 && _intSVValues[i] > 0) {
-        expectedLongResults[i] = 100;
-      } else {
-        bitmap.add(i);
-      }
-    }
-    testCaseQueryWithLongResultsNull(String.format("greater_than(%s, 0)", INT_SV_NULL_COLUMN), expectedLongResults,
-        bitmap);
   }
 
   @Test
-  public void testCaseTransformFunctionWithNullLiterals() {
-    long[] expectedValues = new long[NUM_ROWS];
-    RoaringBitmap bitmap = new RoaringBitmap();
-    bitmap.add(0L, NUM_ROWS);
-    testCaseQueryWithLongResultsAllNull(String.format("greater_than(%s, 0)", INT_SV_NULL_COLUMN), expectedValues,
-        bitmap);
-  }
-
-  @Test
-  public void testCaseTransformFunctionWithDoubleResults() {
-    double[] expectedFloatResults = new double[NUM_ROWS];
+  public void testCaseTransformFunctionWithFloatResults() {
+    float[] expectedFloatResults = new float[NUM_ROWS];
     Arrays.fill(expectedFloatResults, 100);
-    testCaseQueryWithDoubleResults("true", expectedFloatResults);
+    testCaseQueryWithFloatResults("true", expectedFloatResults);
     Arrays.fill(expectedFloatResults, 10);
-    testCaseQueryWithDoubleResults("false", expectedFloatResults);
+    testCaseQueryWithFloatResults("false", expectedFloatResults);
 
     for (TransformFunctionType functionType : BINARY_OPERATOR_TRANSFORM_FUNCTIONS) {
-      testCaseQueryWithDoubleResults(String.format("%s(%s, %s)", functionType.getName(), INT_SV_COLUMN,
-          String.format("%d", _intSVValues[INDEX_TO_COMPARE])), getExpectedDoubleResults(INT_SV_COLUMN, functionType));
-      testCaseQueryWithDoubleResults(String.format("%s(%s, %s)", functionType.getName(), LONG_SV_COLUMN,
+      testCaseQueryWithFloatResults(String.format("%s(%s, %s)", functionType.getName(), INT_SV_COLUMN,
+          String.format("%d", _intSVValues[INDEX_TO_COMPARE])), getExpectedFloatResults(INT_SV_COLUMN, functionType));
+      testCaseQueryWithFloatResults(String.format("%s(%s, %s)", functionType.getName(), LONG_SV_COLUMN,
               String.format("%d", _longSVValues[INDEX_TO_COMPARE])),
-          getExpectedDoubleResults(LONG_SV_COLUMN, functionType));
-      testCaseQueryWithDoubleResults(String.format("%s(%s, %s)", functionType.getName(), FLOAT_SV_COLUMN,
+          getExpectedFloatResults(LONG_SV_COLUMN, functionType));
+      testCaseQueryWithFloatResults(String.format("%s(%s, %s)", functionType.getName(), FLOAT_SV_COLUMN,
               String.format("%f", _floatSVValues[INDEX_TO_COMPARE])),
-          getExpectedDoubleResults(FLOAT_SV_COLUMN, functionType));
-      testCaseQueryWithDoubleResults(String.format("%s(%s, %s)", functionType.getName(), DOUBLE_SV_COLUMN,
+          getExpectedFloatResults(FLOAT_SV_COLUMN, functionType));
+      testCaseQueryWithFloatResults(String.format("%s(%s, %s)", functionType.getName(), DOUBLE_SV_COLUMN,
               String.format("%.20f", _doubleSVValues[INDEX_TO_COMPARE])),
-          getExpectedDoubleResults(DOUBLE_SV_COLUMN, functionType));
-      testCaseQueryWithDoubleResults(String.format("%s(%s, %s)", functionType.getName(), STRING_SV_COLUMN,
+          getExpectedFloatResults(DOUBLE_SV_COLUMN, functionType));
+      testCaseQueryWithFloatResults(String.format("%s(%s, %s)", functionType.getName(), STRING_SV_COLUMN,
               String.format("'%s'", _stringSVValues[INDEX_TO_COMPARE])),
-          getExpectedDoubleResults(STRING_SV_COLUMN, functionType));
+          getExpectedFloatResults(STRING_SV_COLUMN, functionType));
     }
-    RoaringBitmap bitmap = new RoaringBitmap();
-    for (int i = 0; i < NUM_ROWS; i++) {
-      if (i % 2 == 0 && _intSVValues[i] > 0) {
-        expectedFloatResults[i] = 100;
-      } else {
-        bitmap.add(i);
-      }
-    }
-    testCaseQueryWithDoubleResultsNull(String.format("greater_than(%s, 0)", INT_SV_NULL_COLUMN), expectedFloatResults,
-        bitmap);
   }
 
   @Test
@@ -227,56 +196,26 @@
     }
   }
 
-  private void testCaseQueryWithLongResults(String predicate, long[] expectedValues) {
+  private void testCaseQueryWithIntResults(String predicate, int[] expectedValues) {
     ExpressionContext expression =
         RequestContextUtils.getExpression(String.format("CASE WHEN %s THEN 100 ELSE 10 END", predicate));
     TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
     Assert.assertTrue(transformFunction instanceof CaseTransformFunction);
     assertEquals(transformFunction.getName(), CaseTransformFunction.FUNCTION_NAME);
-    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.LONG);
+    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.INT);
     testTransformFunction(transformFunction, expectedValues);
   }
 
-  private void testCaseQueryWithLongResultsNull(String predicate, long[] expectedValues, RoaringBitmap bitmap) {
-    ExpressionContext expression =
-        RequestContextUtils.getExpression(String.format("CASE WHEN %s THEN 100 END", predicate));
-    TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
-    Assert.assertTrue(transformFunction instanceof CaseTransformFunction);
-    assertEquals(transformFunction.getName(), CaseTransformFunction.FUNCTION_NAME);
-    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.LONG);
-    testTransformFunctionWithNull(transformFunction, expectedValues, bitmap);
-  }
-
-  private void testCaseQueryWithLongResultsAllNull(String predicate, long[] expectedValues, RoaringBitmap bitmap) {
-    ExpressionContext expression =
-        RequestContextUtils.getExpression(String.format("CASE WHEN %s THEN NULL END", predicate));
-    TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
-    Assert.assertTrue(transformFunction instanceof CaseTransformFunction);
-    assertEquals(transformFunction.getName(), CaseTransformFunction.FUNCTION_NAME);
-    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.UNKNOWN);
-    testTransformFunctionWithNull(transformFunction, expectedValues, bitmap);
-  }
-
-  private void testCaseQueryWithDoubleResults(String predicate, double[] expectedValues) {
+  private void testCaseQueryWithFloatResults(String predicate, float[] expectedValues) {
     ExpressionContext expression =
         RequestContextUtils.getExpression(String.format("CASE WHEN %s THEN 100.0 ELSE 10.0 END", predicate));
     TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
     Assert.assertTrue(transformFunction instanceof CaseTransformFunction);
     assertEquals(transformFunction.getName(), CaseTransformFunction.FUNCTION_NAME);
-    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.DOUBLE);
+    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.FLOAT);
     testTransformFunction(transformFunction, expectedValues);
   }
 
-  private void testCaseQueryWithDoubleResultsNull(String predicate, double[] expectedValues, RoaringBitmap bitmap) {
-    ExpressionContext expression =
-        RequestContextUtils.getExpression(String.format("CASE WHEN %s THEN 100.0 END", predicate));
-    TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
-    Assert.assertTrue(transformFunction instanceof CaseTransformFunction);
-    assertEquals(transformFunction.getName(), CaseTransformFunction.FUNCTION_NAME);
-    assertEquals(transformFunction.getResultMetadata().getDataType(), DataType.DOUBLE);
-    testTransformFunctionWithNull(transformFunction, expectedValues, bitmap);
-  }
-
   private void testCaseQueryWithBigDecimalResults(String predicate, BigDecimal[] expectedValues) {
     // Note: defining decimal literals within quotes preserves precision.
     ExpressionContext expression = RequestContextUtils.getExpression(
@@ -298,8 +237,8 @@
     testTransformFunction(transformFunction, expectedValues);
   }
 
-  private long[] getExpectedLongResults(String column, TransformFunctionType type) {
-    long[] result = new long[NUM_ROWS];
+  private int[] getExpectedIntResults(String column, TransformFunctionType type) {
+    int[] result = new int[NUM_ROWS];
     for (int i = 0; i < NUM_ROWS; i++) {
       switch (column) {
         case INT_SV_COLUMN:
@@ -429,8 +368,8 @@
     return result;
   }
 
-  private double[] getExpectedDoubleResults(String column, TransformFunctionType type) {
-    double[] result = new double[NUM_ROWS];
+  private float[] getExpectedFloatResults(String column, TransformFunctionType type) {
+    float[] result = new float[NUM_ROWS];
     for (int i = 0; i < NUM_ROWS; i++) {
       switch (column) {
         case INT_SV_COLUMN:
diff --git a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/InTransformFunctionTest.java b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/InTransformFunctionTest.java
index 508c7c7..dcc0f6e 100644
--- a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/InTransformFunctionTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/InTransformFunctionTest.java
@@ -137,7 +137,6 @@
     TransformFunction transformFunction = TransformFunctionFactory.get(expression, _dataSourceMap);
     assertTrue(transformFunction instanceof InTransformFunction);
     assertEquals(transformFunction.getName(), TransformFunctionType.IN.getName());
-
     Set<Long> inValues = Sets.newHashSet(_longSVValues[2], _longSVValues[7], _longSVValues[11]);
     int[] intValues = transformFunction.transformToIntValuesSV(_projectionBlock);
     for (int i = 0; i < NUM_ROWS; i++) {
diff --git a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/TupleSelectionTransformFunctionsTest.java b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/TupleSelectionTransformFunctionsTest.java
index 0ad118d..ffd131d 100644
--- a/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/TupleSelectionTransformFunctionsTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/core/operator/transform/function/TupleSelectionTransformFunctionsTest.java
@@ -67,7 +67,7 @@
     // -1 will be passed in as a long.
     TransformFunction transformFunction =
         testLeastPreconditions(String.format("least(%s, %d, cast(%s as INT))", INT_SV_COLUMN, -1, FLOAT_SV_COLUMN));
-    assertEquals(transformFunction.getResultMetadata().getDataType(), FieldSpec.DataType.LONG);
+    assertEquals(transformFunction.getResultMetadata().getDataType(), FieldSpec.DataType.INT);
     int[] intValues = transformFunction.transformToIntValuesSV(_projectionBlock);
     for (int i = 0; i < NUM_ROWS; i++) {
       assertEquals(intValues[i], Math.min(Math.min(_intSVValues[i], -1), (int) _floatSVValues[i]));
@@ -284,7 +284,7 @@
   public void testGreatestTransformFunctionInt() {
     TransformFunction transformFunction = testGreatestPreconditions(
         String.format("greatest(%s, %d, cast(%s as INT))", INT_SV_COLUMN, -1, FLOAT_SV_COLUMN));
-    assertEquals(transformFunction.getResultMetadata().getDataType(), FieldSpec.DataType.LONG);
+    assertEquals(transformFunction.getResultMetadata().getDataType(), FieldSpec.DataType.INT);
     int[] intValues = transformFunction.transformToIntValuesSV(_projectionBlock);
     for (int i = 0; i < NUM_ROWS; i++) {
       assertEquals(intValues[i], Math.max(Math.max(_intSVValues[i], -1), (int) _floatSVValues[i]));
diff --git a/pinot-core/src/test/java/org/apache/pinot/core/query/request/context/utils/BrokerRequestToQueryContextConverterTest.java b/pinot-core/src/test/java/org/apache/pinot/core/query/request/context/utils/BrokerRequestToQueryContextConverterTest.java
index ca67b1f..8f4b9d5 100644
--- a/pinot-core/src/test/java/org/apache/pinot/core/query/request/context/utils/BrokerRequestToQueryContextConverterTest.java
+++ b/pinot-core/src/test/java/org/apache/pinot/core/query/request/context/utils/BrokerRequestToQueryContextConverterTest.java
@@ -179,7 +179,7 @@
               Arrays.asList(ExpressionContext.forIdentifier("foo"), ExpressionContext.forFunction(
                   new FunctionContext(FunctionContext.Type.TRANSFORM, "add",
                       Arrays.asList(ExpressionContext.forIdentifier("bar"),
-                          ExpressionContext.forLiteralContext(FieldSpec.DataType.LONG, Long.valueOf(123)))))))));
+                          ExpressionContext.forLiteralContext(FieldSpec.DataType.INT, Integer.valueOf(123)))))))));
       assertEquals(selectExpressions.get(0).toString(), "add(foo,add(bar,'123'))");
       assertEquals(selectExpressions.get(1), ExpressionContext.forFunction(
           new FunctionContext(FunctionContext.Type.TRANSFORM, "sub",
@@ -194,7 +194,7 @@
       assertEquals(orderByExpressions.size(), 1);
       assertEquals(orderByExpressions.get(0), new OrderByExpressionContext(ExpressionContext.forFunction(
           new FunctionContext(FunctionContext.Type.TRANSFORM, "sub",
-              Arrays.asList(ExpressionContext.forLiteralContext(FieldSpec.DataType.LONG, Long.valueOf(456)),
+              Arrays.asList(ExpressionContext.forLiteralContext(FieldSpec.DataType.INT, Integer.valueOf(456)),
                   ExpressionContext.forIdentifier("foobar")))), true));
       assertEquals(orderByExpressions.get(0).toString(), "sub('456',foobar) ASC");
       assertNull(queryContext.getHavingFilter());