61yao commented on code in PR #9389:
URL: https://github.com/apache/pinot/pull/9389#discussion_r973330647
##########
pinot-common/src/main/java/org/apache/pinot/common/request/context/ExpressionContext.java:
##########
@@ -31,41 +33,58 @@
*/
public class ExpressionContext {
public enum Type {
- LITERAL, IDENTIFIER, FUNCTION
+ LITERAL, IDENTIFIER, FUNCTION,
}
private final Type _type;
- private final String _value;
+ private final String _identifier;
private final FunctionContext _function;
+ // Only set when the _type is LITERAL
+ private final LiteralContext _literal;
- public static ExpressionContext forLiteral(String literal) {
- return new ExpressionContext(Type.LITERAL, literal, null);
+ public static ExpressionContext forLiteralContext(Literal literal){
+ return new ExpressionContext(Type.LITERAL, null, null, new
LiteralContext(literal));
+ }
+
+ public static ExpressionContext forLiteralContext(FieldSpec.DataType type,
Object val){
+ return new ExpressionContext(Type.LITERAL, null, null, new
LiteralContext(type, val));
}
public static ExpressionContext forIdentifier(String identifier) {
- return new ExpressionContext(Type.IDENTIFIER, identifier, null);
+ return new ExpressionContext(Type.IDENTIFIER, identifier, null, null);
}
public static ExpressionContext forFunction(FunctionContext function) {
- return new ExpressionContext(Type.FUNCTION, null, function);
+ return new ExpressionContext(Type.FUNCTION, null, function, null);
}
- private ExpressionContext(Type type, String value, FunctionContext function)
{
+ private ExpressionContext(Type type, String value, FunctionContext function,
LiteralContext literal) {
_type = type;
- _value = value;
+ _identifier = value;
_function = function;
+ _literal = literal;
+ }
+
+ // TODO: Refactor all of the usage for getLiteralString.
+ @Deprecated
+ public String getLiteralString() {
Review Comment:
We still need this for now since a lot of places still take a string. This
PR only focuses on boolean support in the literal context.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]