siddharthteotia commented on code in PR #9389:
URL: https://github.com/apache/pinot/pull/9389#discussion_r972568072


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/LiteralTransformFunction.java:
##########
@@ -58,21 +61,24 @@ public class LiteralTransformFunction implements 
TransformFunction {
   private String[] _stringResult;
   private byte[][] _bytesResult;
 
-  public LiteralTransformFunction(String literal) {
-    _literal = literal;
-    _dataType = inferLiteralDataType(literal);
-    if (_dataType.isNumeric()) {
-      _bigDecimalLiteral = new BigDecimal(_literal);
-    } else if (_dataType == DataType.BOOLEAN) {
-      _bigDecimalLiteral = 
PinotDataType.BOOLEAN.toBigDecimal(Boolean.valueOf(literal));
-    } else if (_dataType == DataType.TIMESTAMP) {
-      // inferLiteralDataType successfully interpreted the literal as 
TIMESTAMP. _bigDecimalLiteral is populated and
-      // assigned to _longLiteral.
-      _bigDecimalLiteral = 
PinotDataType.TIMESTAMP.toBigDecimal(Timestamp.valueOf(literal));
+  public LiteralTransformFunction(LiteralContext literalContext) {
+    Preconditions.checkNotNull(literalContext);
+    _literal = literalContext.getValue() == null ? "" : 
literalContext.getValue().toString();
+    if (literalContext.getType() == DataType.BOOLEAN) {
+      _bigDecimalLiteral = 
PinotDataType.BOOLEAN.toBigDecimal(literalContext.getValue());
+      _dataType = DataType.BOOLEAN;
     } else {
-      _bigDecimalLiteral = BigDecimal.ZERO;
+      _dataType = inferLiteralDataType(_literal);

Review Comment:
   Do we still need to infer the type here given that `LiteralContext` now has 
the Pinot DataType



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to