You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by xi...@apache.org on 2023/09/02 11:54:25 UTC

[pinot] branch master updated: [multistage] Evaluate literal expression during query parsing (#11438)

This is an automated email from the ASF dual-hosted git repository.

xiangfu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new a485778a8e [multistage] Evaluate literal expression during query parsing (#11438)
a485778a8e is described below

commit a485778a8ebf684bb38b8c596c60bd6df4598c73
Author: Xiang Fu <xi...@gmail.com>
AuthorDate: Sat Sep 2 04:54:18 2023 -0700

    [multistage] Evaluate literal expression during query parsing (#11438)
    
    * Evaluate literal expression during query parsing
    
    * make string/bytes literal working with cast
    
    * simplify EvaluateLiteralRule
    
    * Support decimal as a literal in thrift
    
    * address comments
---
 .../apache/pinot/common/request/BrokerRequest.java |  14 +-
 .../apache/pinot/common/request/DataSource.java    | 245 +++++------
 .../apache/pinot/common/request/Expression.java    | 182 ++++----
 .../pinot/common/request/ExpressionType.java       |   7 +-
 .../org/apache/pinot/common/request/Function.java  |  92 ++--
 .../apache/pinot/common/request/Identifier.java    |  59 +--
 .../pinot/common/request/InstanceRequest.java      |  42 +-
 .../java/org/apache/pinot/common/request/Join.java | 307 ++++++--------
 .../org/apache/pinot/common/request/JoinType.java  |   4 +-
 .../org/apache/pinot/common/request/Literal.java   | 102 ++++-
 .../apache/pinot/common/request/PinotQuery.java    | 471 ++++++++++-----------
 .../apache/pinot/common/request/QuerySource.java   |   9 +-
 .../common/request/context/LiteralContext.java     |  11 +
 .../pinot/common/response/ProcessingException.java |   2 +-
 .../pinot/common/utils/request/RequestUtils.java   |  20 +
 .../apache/pinot/sql/parsers/CalciteSqlParser.java |   2 +-
 .../sql/parsers/rewriter/ExprMinMaxRewriter.java   |  18 +-
 pinot-common/src/main/proto/plan.proto             |  20 +-
 .../pinot/sql/parsers/CalciteSqlCompilerTest.java  |  54 +--
 pinot-common/src/thrift/query.thrift               |   1 +
 .../function/BaseBinaryGeoTransformFunction.java   |   7 +-
 .../transform/function/ScalarFunctions.java        |  28 ++
 .../transform/function/StDistanceFunction.java     |   2 +-
 .../function/LiteralTransformFunction.java         |   8 +-
 .../tests/MultiStageEngineIntegrationTest.java     |   2 +-
 .../rel/rules/PinotEvaluateLiteralRule.java        | 225 ++++++++++
 .../calcite/rel/rules/PinotQueryRuleSets.java      |   2 +
 .../apache/calcite/rel/rules/PinotRuleUtils.java   |   7 +
 .../query/planner/logical/LiteralHintUtils.java    |   3 +
 .../query/planner/logical/RexExpressionUtils.java  |   3 +
 .../planner/serde/ProtoSerializationUtils.java     |  12 +
 .../resources/queries/LiteralEvaluationPlans.json  | 161 +++++++
 32 files changed, 1218 insertions(+), 904 deletions(-)

diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java b/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java
index 0767fb1c18..cda2f3db9d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/BrokerRequest.java
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2022-05-02")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, BrokerRequest._Fields>, java.io.Serializable, Cloneable, Comparable<BrokerRequest> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("BrokerRequest");
 
@@ -35,8 +35,8 @@ public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, Bro
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new BrokerRequestStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new BrokerRequestTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable QuerySource querySource; // optional
-  public @org.apache.thrift.annotation.Nullable org.apache.pinot.common.request.PinotQuery pinotQuery; // optional
+  private @org.apache.thrift.annotation.Nullable QuerySource querySource; // optional
+  private @org.apache.thrift.annotation.Nullable org.apache.pinot.common.request.PinotQuery pinotQuery; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -144,9 +144,8 @@ public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, Bro
     return this.querySource;
   }
 
-  public BrokerRequest setQuerySource(@org.apache.thrift.annotation.Nullable QuerySource querySource) {
+  public void setQuerySource(@org.apache.thrift.annotation.Nullable QuerySource querySource) {
     this.querySource = querySource;
-    return this;
   }
 
   public void unsetQuerySource() {
@@ -169,9 +168,8 @@ public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, Bro
     return this.pinotQuery;
   }
 
-  public BrokerRequest setPinotQuery(@org.apache.thrift.annotation.Nullable org.apache.pinot.common.request.PinotQuery pinotQuery) {
+  public void setPinotQuery(@org.apache.thrift.annotation.Nullable org.apache.pinot.common.request.PinotQuery pinotQuery) {
     this.pinotQuery = pinotQuery;
-    return this;
   }
 
   public void unsetPinotQuery() {
@@ -428,8 +426,6 @@ public class BrokerRequest implements org.apache.thrift.TBase<BrokerRequest, Bro
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java b/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java
index c6f4864ccb..7b9c20eea2 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/DataSource.java
@@ -25,34 +25,28 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-03-14")
-public class DataSource
-    implements org.apache.thrift.TBase<DataSource, DataSource._Fields>, java.io.Serializable, Cloneable,
-               Comparable<DataSource> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC =
-      new org.apache.thrift.protocol.TStruct("DataSource");
-
-  private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short) 1);
-  private static final org.apache.thrift.protocol.TField SUBQUERY_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("subquery", org.apache.thrift.protocol.TType.STRUCT, (short) 2);
-  private static final org.apache.thrift.protocol.TField JOIN_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("join", org.apache.thrift.protocol.TType.STRUCT, (short) 3);
-
-  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY =
-      new DataSourceStandardSchemeFactory();
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
+public class DataSource implements org.apache.thrift.TBase<DataSource, DataSource._Fields>, java.io.Serializable, Cloneable, Comparable<DataSource> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("DataSource");
+
+  private static final org.apache.thrift.protocol.TField TABLE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tableName", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField SUBQUERY_FIELD_DESC = new org.apache.thrift.protocol.TField("subquery", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+  private static final org.apache.thrift.protocol.TField JOIN_FIELD_DESC = new org.apache.thrift.protocol.TField("join", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+
+  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new DataSourceStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new DataSourceTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable java.lang.String tableName; // optional
-  public @org.apache.thrift.annotation.Nullable PinotQuery subquery; // optional
-  public @org.apache.thrift.annotation.Nullable Join join; // optional
+  private @org.apache.thrift.annotation.Nullable java.lang.String tableName; // optional
+  private @org.apache.thrift.annotation.Nullable PinotQuery subquery; // optional
+  private @org.apache.thrift.annotation.Nullable Join join; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    TABLE_NAME((short) 1, "tableName"), SUBQUERY((short) 2, "subquery"), JOIN((short) 3, "join");
+    TABLE_NAME((short)1, "tableName"),
+    SUBQUERY((short)2, "subquery"),
+    JOIN((short)3, "join");
 
-    private static final java.util.Map<java.lang.String, _Fields> byName =
-        new java.util.HashMap<java.lang.String, _Fields>();
+    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
 
     static {
       for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
@@ -65,7 +59,7 @@ public class DataSource
      */
     @org.apache.thrift.annotation.Nullable
     public static _Fields findByThriftId(int fieldId) {
-      switch (fieldId) {
+      switch(fieldId) {
         case 1: // TABLE_NAME
           return TABLE_NAME;
         case 2: // SUBQUERY
@@ -83,9 +77,7 @@ public class DataSource
      */
     public static _Fields findByThriftIdOrThrow(int fieldId) {
       _Fields fields = findByThriftId(fieldId);
-      if (fields == null) {
-        throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      }
+      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
       return fields;
     }
 
@@ -105,33 +97,26 @@ public class DataSource
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
   }
 
   // isset id assignments
-  private static final _Fields optionals[] = {_Fields.TABLE_NAME, _Fields.SUBQUERY, _Fields.JOIN};
+  private static final _Fields optionals[] = {_Fields.TABLE_NAME,_Fields.SUBQUERY,_Fields.JOIN};
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-
   static {
-    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
-        new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.TABLE_NAME,
-        new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.SUBQUERY,
-        new org.apache.thrift.meta_data.FieldMetaData("subquery", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PinotQuery.class)));
-    tmpMap.put(_Fields.JOIN,
-        new org.apache.thrift.meta_data.FieldMetaData("join", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT, "Join")));
+    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.TABLE_NAME, new org.apache.thrift.meta_data.FieldMetaData("tableName", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.SUBQUERY, new org.apache.thrift.meta_data.FieldMetaData("subquery", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, PinotQuery.class)));
+    tmpMap.put(_Fields.JOIN, new org.apache.thrift.meta_data.FieldMetaData("join", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Join")));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DataSource.class, metaDataMap);
   }
@@ -154,7 +139,6 @@ public class DataSource
     }
   }
 
-  @Override
   public DataSource deepCopy() {
     return new DataSource(this);
   }
@@ -171,9 +155,8 @@ public class DataSource
     return this.tableName;
   }
 
-  public DataSource setTableName(@org.apache.thrift.annotation.Nullable java.lang.String tableName) {
+  public void setTableName(@org.apache.thrift.annotation.Nullable java.lang.String tableName) {
     this.tableName = tableName;
-    return this;
   }
 
   public void unsetTableName() {
@@ -196,9 +179,8 @@ public class DataSource
     return this.subquery;
   }
 
-  public DataSource setSubquery(@org.apache.thrift.annotation.Nullable PinotQuery subquery) {
+  public void setSubquery(@org.apache.thrift.annotation.Nullable PinotQuery subquery) {
     this.subquery = subquery;
-    return this;
   }
 
   public void unsetSubquery() {
@@ -221,9 +203,8 @@ public class DataSource
     return this.join;
   }
 
-  public DataSource setJoin(@org.apache.thrift.annotation.Nullable Join join) {
+  public void setJoin(@org.apache.thrift.annotation.Nullable Join join) {
     this.join = join;
-    return this;
   }
 
   public void unsetJoin() {
@@ -241,116 +222,106 @@ public class DataSource
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case TABLE_NAME:
-        if (value == null) {
-          unsetTableName();
-        } else {
-          setTableName((java.lang.String) value);
-        }
-        break;
+    case TABLE_NAME:
+      if (value == null) {
+        unsetTableName();
+      } else {
+        setTableName((java.lang.String)value);
+      }
+      break;
 
-      case SUBQUERY:
-        if (value == null) {
-          unsetSubquery();
-        } else {
-          setSubquery((PinotQuery) value);
-        }
-        break;
+    case SUBQUERY:
+      if (value == null) {
+        unsetSubquery();
+      } else {
+        setSubquery((PinotQuery)value);
+      }
+      break;
+
+    case JOIN:
+      if (value == null) {
+        unsetJoin();
+      } else {
+        setJoin((Join)value);
+      }
+      break;
 
-      case JOIN:
-        if (value == null) {
-          unsetJoin();
-        } else {
-          setJoin((Join) value);
-        }
-        break;
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case TABLE_NAME:
-        return getTableName();
+    case TABLE_NAME:
+      return getTableName();
+
+    case SUBQUERY:
+      return getSubquery();
 
-      case SUBQUERY:
-        return getSubquery();
+    case JOIN:
+      return getJoin();
 
-      case JOIN:
-        return getJoin();
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case TABLE_NAME:
-        return isSetTableName();
-      case SUBQUERY:
-        return isSetSubquery();
-      case JOIN:
-        return isSetJoin();
+    case TABLE_NAME:
+      return isSetTableName();
+    case SUBQUERY:
+      return isSetSubquery();
+    case JOIN:
+      return isSetJoin();
     }
     throw new java.lang.IllegalStateException();
   }
 
   @Override
   public boolean equals(java.lang.Object that) {
-    if (that instanceof DataSource) {
-      return this.equals((DataSource) that);
-    }
+    if (that instanceof DataSource)
+      return this.equals((DataSource)that);
     return false;
   }
 
   public boolean equals(DataSource that) {
-    if (that == null) {
+    if (that == null)
       return false;
-    }
-    if (this == that) {
+    if (this == that)
       return true;
-    }
 
     boolean this_present_tableName = true && this.isSetTableName();
     boolean that_present_tableName = true && that.isSetTableName();
     if (this_present_tableName || that_present_tableName) {
-      if (!(this_present_tableName && that_present_tableName)) {
+      if (!(this_present_tableName && that_present_tableName))
         return false;
-      }
-      if (!this.tableName.equals(that.tableName)) {
+      if (!this.tableName.equals(that.tableName))
         return false;
-      }
     }
 
     boolean this_present_subquery = true && this.isSetSubquery();
     boolean that_present_subquery = true && that.isSetSubquery();
     if (this_present_subquery || that_present_subquery) {
-      if (!(this_present_subquery && that_present_subquery)) {
+      if (!(this_present_subquery && that_present_subquery))
         return false;
-      }
-      if (!this.subquery.equals(that.subquery)) {
+      if (!this.subquery.equals(that.subquery))
         return false;
-      }
     }
 
     boolean this_present_join = true && this.isSetJoin();
     boolean that_present_join = true && that.isSetJoin();
     if (this_present_join || that_present_join) {
-      if (!(this_present_join && that_present_join)) {
+      if (!(this_present_join && that_present_join))
         return false;
-      }
-      if (!this.join.equals(that.join)) {
+      if (!this.join.equals(that.join))
         return false;
-      }
     }
 
     return true;
@@ -361,19 +332,16 @@ public class DataSource
     int hashCode = 1;
 
     hashCode = hashCode * 8191 + ((isSetTableName()) ? 131071 : 524287);
-    if (isSetTableName()) {
+    if (isSetTableName())
       hashCode = hashCode * 8191 + tableName.hashCode();
-    }
 
     hashCode = hashCode * 8191 + ((isSetSubquery()) ? 131071 : 524287);
-    if (isSetSubquery()) {
+    if (isSetSubquery())
       hashCode = hashCode * 8191 + subquery.hashCode();
-    }
 
     hashCode = hashCode * 8191 + ((isSetJoin()) ? 131071 : 524287);
-    if (isSetJoin()) {
+    if (isSetJoin())
       hashCode = hashCode * 8191 + join.hashCode();
-    }
 
     return hashCode;
   }
@@ -420,20 +388,15 @@ public class DataSource
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
-  public void read(org.apache.thrift.protocol.TProtocol iprot)
-      throws org.apache.thrift.TException {
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
-  public void write(org.apache.thrift.protocol.TProtocol oprot)
-      throws org.apache.thrift.TException {
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
 
@@ -452,9 +415,7 @@ public class DataSource
       first = false;
     }
     if (isSetSubquery()) {
-      if (!first) {
-        sb.append(", ");
-      }
+      if (!first) sb.append(", ");
       sb.append("subquery:");
       if (this.subquery == null) {
         sb.append("null");
@@ -464,9 +425,7 @@ public class DataSource
       first = false;
     }
     if (isSetJoin()) {
-      if (!first) {
-        sb.append(", ");
-      }
+      if (!first) sb.append(", ");
       sb.append("join:");
       if (this.join == null) {
         sb.append("null");
@@ -479,8 +438,7 @@ public class DataSource
     return sb.toString();
   }
 
-  public void validate()
-      throws org.apache.thrift.TException {
+  public void validate() throws org.apache.thrift.TException {
     // check for required fields
     // check for sub-struct validity
     if (subquery != null) {
@@ -488,8 +446,7 @@ public class DataSource
     }
   }
 
-  private void writeObject(java.io.ObjectOutputStream out)
-      throws java.io.IOException {
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
     try {
       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
     } catch (org.apache.thrift.TException te) {
@@ -497,8 +454,7 @@ public class DataSource
     }
   }
 
-  private void readObject(java.io.ObjectInputStream in)
-      throws java.io.IOException, java.lang.ClassNotFoundException {
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
     try {
       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
     } catch (org.apache.thrift.TException te) {
@@ -507,7 +463,6 @@ public class DataSource
   }
 
   private static class DataSourceStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public DataSourceStandardScheme getScheme() {
       return new DataSourceStandardScheme();
     }
@@ -515,14 +470,13 @@ public class DataSource
 
   private static class DataSourceStandardScheme extends org.apache.thrift.scheme.StandardScheme<DataSource> {
 
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol iprot, DataSource struct)
-        throws org.apache.thrift.TException {
+    public void read(org.apache.thrift.protocol.TProtocol iprot, DataSource struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
-      while (true) {
+      while (true)
+      {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -530,7 +484,7 @@ public class DataSource
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.tableName = iprot.readString();
               struct.setTableNameIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -539,7 +493,7 @@ public class DataSource
               struct.subquery = new PinotQuery();
               struct.subquery.read(iprot);
               struct.setSubqueryIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -548,7 +502,7 @@ public class DataSource
               struct.join = new Join();
               struct.join.read(iprot);
               struct.setJoinIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -558,14 +512,10 @@ public class DataSource
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol oprot, DataSource struct)
-        throws org.apache.thrift.TException {
+    public void write(org.apache.thrift.protocol.TProtocol oprot, DataSource struct) throws org.apache.thrift.TException {
       struct.validate();
 
       oprot.writeStructBegin(STRUCT_DESC);
@@ -593,10 +543,10 @@ public class DataSource
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
+
   }
 
   private static class DataSourceTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public DataSourceTupleScheme getScheme() {
       return new DataSourceTupleScheme();
     }
@@ -605,8 +555,7 @@ public class DataSource
   private static class DataSourceTupleScheme extends org.apache.thrift.scheme.TupleScheme<DataSource> {
 
     @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, DataSource struct)
-        throws org.apache.thrift.TException {
+    public void write(org.apache.thrift.protocol.TProtocol prot, DataSource struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
       java.util.BitSet optionals = new java.util.BitSet();
       if (struct.isSetTableName()) {
@@ -631,8 +580,7 @@ public class DataSource
     }
 
     @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, DataSource struct)
-        throws org.apache.thrift.TException {
+    public void read(org.apache.thrift.protocol.TProtocol prot, DataSource struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
       java.util.BitSet incoming = iprot.readBitSet(3);
       if (incoming.get(0)) {
@@ -653,8 +601,7 @@ public class DataSource
   }
 
   private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
-    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY
-        : TUPLE_SCHEME_FACTORY).getScheme();
+    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
   }
 }
 
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java
index 219dbc5b87..083b244b35 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Expression.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class Expression implements org.apache.thrift.TBase<Expression, Expression._Fields>, java.io.Serializable, Cloneable, Comparable<Expression> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Expression");
 
@@ -37,21 +37,13 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ExpressionStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ExpressionTupleSchemeFactory();
 
-  /**
-   *
-   * @see ExpressionType
-   */
-  public @org.apache.thrift.annotation.Nullable ExpressionType type; // required
-  public @org.apache.thrift.annotation.Nullable Function functionCall; // optional
-  public @org.apache.thrift.annotation.Nullable Literal literal; // optional
-  public @org.apache.thrift.annotation.Nullable Identifier identifier; // optional
+  private @org.apache.thrift.annotation.Nullable ExpressionType type; // required
+  private @org.apache.thrift.annotation.Nullable Function functionCall; // optional
+  private @org.apache.thrift.annotation.Nullable Literal literal; // optional
+  private @org.apache.thrift.annotation.Nullable Identifier identifier; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    /**
-     *
-     * @see ExpressionType
-     */
     TYPE((short)1, "type"),
     FUNCTION_CALL((short)2, "functionCall"),
     LITERAL((short)3, "literal"),
@@ -110,12 +102,10 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -126,14 +116,14 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
-        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ExpressionType.class)));
-    tmpMap.put(_Fields.FUNCTION_CALL, new org.apache.thrift.meta_data.FieldMetaData("functionCall", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Function.class)));
-    tmpMap.put(_Fields.LITERAL, new org.apache.thrift.meta_data.FieldMetaData("literal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Literal.class)));
-    tmpMap.put(_Fields.IDENTIFIER, new org.apache.thrift.meta_data.FieldMetaData("identifier", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Identifier.class)));
+    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM        , "ExpressionType")));
+    tmpMap.put(_Fields.FUNCTION_CALL, new org.apache.thrift.meta_data.FieldMetaData("functionCall", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Function")));
+    tmpMap.put(_Fields.LITERAL, new org.apache.thrift.meta_data.FieldMetaData("literal", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Literal")));
+    tmpMap.put(_Fields.IDENTIFIER, new org.apache.thrift.meta_data.FieldMetaData("identifier", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Identifier")));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Expression.class, metaDataMap);
   }
@@ -142,7 +132,7 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   }
 
   public Expression(
-      ExpressionType type)
+    ExpressionType type)
   {
     this();
     this.type = type;
@@ -166,7 +156,6 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     }
   }
 
-  @Override
   public Expression deepCopy() {
     return new Expression(this);
   }
@@ -179,22 +168,13 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     this.identifier = null;
   }
 
-  /**
-   *
-   * @see ExpressionType
-   */
   @org.apache.thrift.annotation.Nullable
   public ExpressionType getType() {
     return this.type;
   }
 
-  /**
-   *
-   * @see ExpressionType
-   */
-  public Expression setType(@org.apache.thrift.annotation.Nullable ExpressionType type) {
+  public void setType(@org.apache.thrift.annotation.Nullable ExpressionType type) {
     this.type = type;
-    return this;
   }
 
   public void unsetType() {
@@ -217,9 +197,8 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     return this.functionCall;
   }
 
-  public Expression setFunctionCall(@org.apache.thrift.annotation.Nullable Function functionCall) {
+  public void setFunctionCall(@org.apache.thrift.annotation.Nullable Function functionCall) {
     this.functionCall = functionCall;
-    return this;
   }
 
   public void unsetFunctionCall() {
@@ -242,9 +221,8 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     return this.literal;
   }
 
-  public Expression setLiteral(@org.apache.thrift.annotation.Nullable Literal literal) {
+  public void setLiteral(@org.apache.thrift.annotation.Nullable Literal literal) {
     this.literal = literal;
-    return this;
   }
 
   public void unsetLiteral() {
@@ -267,9 +245,8 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     return this.identifier;
   }
 
-  public Expression setIdentifier(@org.apache.thrift.annotation.Nullable Identifier identifier) {
+  public void setIdentifier(@org.apache.thrift.annotation.Nullable Identifier identifier) {
     this.identifier = identifier;
-    return this;
   }
 
   public void unsetIdentifier() {
@@ -287,80 +264,77 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case TYPE:
-        if (value == null) {
-          unsetType();
-        } else {
-          setType((ExpressionType)value);
-        }
-        break;
+    case TYPE:
+      if (value == null) {
+        unsetType();
+      } else {
+        setType((ExpressionType)value);
+      }
+      break;
 
-      case FUNCTION_CALL:
-        if (value == null) {
-          unsetFunctionCall();
-        } else {
-          setFunctionCall((Function)value);
-        }
-        break;
+    case FUNCTION_CALL:
+      if (value == null) {
+        unsetFunctionCall();
+      } else {
+        setFunctionCall((Function)value);
+      }
+      break;
 
-      case LITERAL:
-        if (value == null) {
-          unsetLiteral();
-        } else {
-          setLiteral((Literal)value);
-        }
-        break;
+    case LITERAL:
+      if (value == null) {
+        unsetLiteral();
+      } else {
+        setLiteral((Literal)value);
+      }
+      break;
 
-      case IDENTIFIER:
-        if (value == null) {
-          unsetIdentifier();
-        } else {
-          setIdentifier((Identifier)value);
-        }
-        break;
+    case IDENTIFIER:
+      if (value == null) {
+        unsetIdentifier();
+      } else {
+        setIdentifier((Identifier)value);
+      }
+      break;
 
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case TYPE:
-        return getType();
+    case TYPE:
+      return getType();
 
-      case FUNCTION_CALL:
-        return getFunctionCall();
+    case FUNCTION_CALL:
+      return getFunctionCall();
 
-      case LITERAL:
-        return getLiteral();
+    case LITERAL:
+      return getLiteral();
 
-      case IDENTIFIER:
-        return getIdentifier();
+    case IDENTIFIER:
+      return getIdentifier();
 
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case TYPE:
-        return isSetType();
-      case FUNCTION_CALL:
-        return isSetFunctionCall();
-      case LITERAL:
-        return isSetLiteral();
-      case IDENTIFIER:
-        return isSetIdentifier();
+    case TYPE:
+      return isSetType();
+    case FUNCTION_CALL:
+      return isSetFunctionCall();
+    case LITERAL:
+      return isSetLiteral();
+    case IDENTIFIER:
+      return isSetIdentifier();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -492,17 +466,14 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
@@ -555,16 +526,11 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
 
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    if (type == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' was not present! Struct: " + toString());
+    if (!isSetType()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
     }
+
     // check for sub-struct validity
-    if (functionCall != null) {
-      functionCall.validate();
-    }
-    if (identifier != null) {
-      identifier.validate();
-    }
   }
 
   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -584,7 +550,6 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   }
 
   private static class ExpressionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public ExpressionStandardScheme getScheme() {
       return new ExpressionStandardScheme();
     }
@@ -592,14 +557,13 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
 
   private static class ExpressionStandardScheme extends org.apache.thrift.scheme.StandardScheme<Expression> {
 
-    @Override
     public void read(org.apache.thrift.protocol.TProtocol iprot, Expression struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -607,7 +571,7 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.type = org.apache.pinot.common.request.ExpressionType.findByValue(iprot.readI32());
               struct.setTypeIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -616,7 +580,7 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
               struct.functionCall = new Function();
               struct.functionCall.read(iprot);
               struct.setFunctionCallIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -625,7 +589,7 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
               struct.literal = new Literal();
               struct.literal.read(iprot);
               struct.setLiteralIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -634,7 +598,7 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
               struct.identifier = new Identifier();
               struct.identifier.read(iprot);
               struct.setIdentifierIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -644,12 +608,9 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
     public void write(org.apache.thrift.protocol.TProtocol oprot, Expression struct) throws org.apache.thrift.TException {
       struct.validate();
 
@@ -687,7 +648,6 @@ public class Expression implements org.apache.thrift.TBase<Expression, Expressio
   }
 
   private static class ExpressionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public ExpressionTupleScheme getScheme() {
       return new ExpressionTupleScheme();
     }
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java b/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java
index 8822fbcbff..2b1a3a7945 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/ExpressionType.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public enum ExpressionType implements org.apache.thrift.TEnum {
   LITERAL(0),
   IDENTIFIER(1),
@@ -40,7 +40,6 @@ public enum ExpressionType implements org.apache.thrift.TEnum {
   /**
    * Get the integer value of this enum value, as defined in the Thrift IDL.
    */
-  @Override
   public int getValue() {
     return value;
   }
@@ -50,7 +49,7 @@ public enum ExpressionType implements org.apache.thrift.TEnum {
    * @return null if the value is not found.
    */
   @org.apache.thrift.annotation.Nullable
-  public static ExpressionType findByValue(int value) {
+  public static ExpressionType findByValue(int value) { 
     switch (value) {
       case 0:
         return LITERAL;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java
index 12a8b8b295..9c471f8e41 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Function.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class Function implements org.apache.thrift.TBase<Function, Function._Fields>, java.io.Serializable, Cloneable, Comparable<Function> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Function");
 
@@ -35,8 +35,8 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new FunctionStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new FunctionTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable java.lang.String operator; // required
-  public @org.apache.thrift.annotation.Nullable java.util.List<Expression> operands; // optional
+  private @org.apache.thrift.annotation.Nullable java.lang.String operator; // required
+  private @org.apache.thrift.annotation.Nullable java.util.List<Expression> operands; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -92,12 +92,10 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -108,10 +106,10 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.OPERATOR, new org.apache.thrift.meta_data.FieldMetaData("operator", org.apache.thrift.TFieldRequirementType.REQUIRED,
+    tmpMap.put(_Fields.OPERATOR, new org.apache.thrift.meta_data.FieldMetaData("operator", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.OPERANDS, new org.apache.thrift.meta_data.FieldMetaData("operands", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
+    tmpMap.put(_Fields.OPERANDS, new org.apache.thrift.meta_data.FieldMetaData("operands", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class))));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Function.class, metaDataMap);
@@ -121,7 +119,7 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   }
 
   public Function(
-      java.lang.String operator)
+    java.lang.String operator)
   {
     this();
     this.operator = operator;
@@ -143,7 +141,6 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
     }
   }
 
-  @Override
   public Function deepCopy() {
     return new Function(this);
   }
@@ -159,9 +156,8 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
     return this.operator;
   }
 
-  public Function setOperator(@org.apache.thrift.annotation.Nullable java.lang.String operator) {
+  public void setOperator(@org.apache.thrift.annotation.Nullable java.lang.String operator) {
     this.operator = operator;
-    return this;
   }
 
   public void unsetOperator() {
@@ -200,9 +196,8 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
     return this.operands;
   }
 
-  public Function setOperands(@org.apache.thrift.annotation.Nullable java.util.List<Expression> operands) {
+  public void setOperands(@org.apache.thrift.annotation.Nullable java.util.List<Expression> operands) {
     this.operands = operands;
-    return this;
   }
 
   public void unsetOperands() {
@@ -220,54 +215,51 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case OPERATOR:
-        if (value == null) {
-          unsetOperator();
-        } else {
-          setOperator((java.lang.String)value);
-        }
-        break;
+    case OPERATOR:
+      if (value == null) {
+        unsetOperator();
+      } else {
+        setOperator((java.lang.String)value);
+      }
+      break;
 
-      case OPERANDS:
-        if (value == null) {
-          unsetOperands();
-        } else {
-          setOperands((java.util.List<Expression>)value);
-        }
-        break;
+    case OPERANDS:
+      if (value == null) {
+        unsetOperands();
+      } else {
+        setOperands((java.util.List<Expression>)value);
+      }
+      break;
 
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case OPERATOR:
-        return getOperator();
+    case OPERATOR:
+      return getOperator();
 
-      case OPERANDS:
-        return getOperands();
+    case OPERANDS:
+      return getOperands();
 
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case OPERATOR:
-        return isSetOperator();
-      case OPERANDS:
-        return isSetOperands();
+    case OPERATOR:
+      return isSetOperator();
+    case OPERANDS:
+      return isSetOperands();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -353,17 +345,14 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
@@ -396,9 +385,10 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
 
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    if (operator == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'operator' was not present! Struct: " + toString());
+    if (!isSetOperator()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'operator' is unset! Struct:" + toString());
     }
+
     // check for sub-struct validity
   }
 
@@ -419,7 +409,6 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   }
 
   private static class FunctionStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public FunctionStandardScheme getScheme() {
       return new FunctionStandardScheme();
     }
@@ -427,14 +416,13 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
 
   private static class FunctionStandardScheme extends org.apache.thrift.scheme.StandardScheme<Function> {
 
-    @Override
     public void read(org.apache.thrift.protocol.TProtocol iprot, Function struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -442,7 +430,7 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.operator = iprot.readString();
               struct.setOperatorIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -461,7 +449,7 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
                 iprot.readListEnd();
               }
               struct.setOperandsIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -471,12 +459,9 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
     public void write(org.apache.thrift.protocol.TProtocol oprot, Function struct) throws org.apache.thrift.TException {
       struct.validate();
 
@@ -507,7 +492,6 @@ public class Function implements org.apache.thrift.TBase<Function, Function._Fie
   }
 
   private static class FunctionTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public FunctionTupleScheme getScheme() {
       return new FunctionTupleScheme();
     }
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java
index 307e127f20..36eeb344fe 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Identifier.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class Identifier implements org.apache.thrift.TBase<Identifier, Identifier._Fields>, java.io.Serializable, Cloneable, Comparable<Identifier> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Identifier");
 
@@ -34,7 +34,7 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new IdentifierStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new IdentifierTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable java.lang.String name; // required
+  private @org.apache.thrift.annotation.Nullable java.lang.String name; // required
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -87,12 +87,10 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -102,7 +100,7 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED,
+    tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Identifier.class, metaDataMap);
@@ -112,7 +110,7 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   }
 
   public Identifier(
-      java.lang.String name)
+    java.lang.String name)
   {
     this();
     this.name = name;
@@ -127,7 +125,6 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
     }
   }
 
-  @Override
   public Identifier deepCopy() {
     return new Identifier(this);
   }
@@ -142,9 +139,8 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
     return this.name;
   }
 
-  public Identifier setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
+  public void setName(@org.apache.thrift.annotation.Nullable java.lang.String name) {
     this.name = name;
-    return this;
   }
 
   public void unsetName() {
@@ -162,41 +158,38 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case NAME:
-        if (value == null) {
-          unsetName();
-        } else {
-          setName((java.lang.String)value);
-        }
-        break;
+    case NAME:
+      if (value == null) {
+        unsetName();
+      } else {
+        setName((java.lang.String)value);
+      }
+      break;
 
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case NAME:
-        return getName();
+    case NAME:
+      return getName();
 
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case NAME:
-        return isSetName();
+    case NAME:
+      return isSetName();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -259,17 +252,14 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
@@ -292,9 +282,10 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
 
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    if (name == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' was not present! Struct: " + toString());
+    if (!isSetName()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' is unset! Struct:" + toString());
     }
+
     // check for sub-struct validity
   }
 
@@ -315,7 +306,6 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   }
 
   private static class IdentifierStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public IdentifierStandardScheme getScheme() {
       return new IdentifierStandardScheme();
     }
@@ -323,14 +313,13 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
 
   private static class IdentifierStandardScheme extends org.apache.thrift.scheme.StandardScheme<Identifier> {
 
-    @Override
     public void read(org.apache.thrift.protocol.TProtocol iprot, Identifier struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -338,7 +327,7 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.name = iprot.readString();
               struct.setNameIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -348,12 +337,9 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
     public void write(org.apache.thrift.protocol.TProtocol oprot, Identifier struct) throws org.apache.thrift.TException {
       struct.validate();
 
@@ -370,7 +356,6 @@ public class Identifier implements org.apache.thrift.TBase<Identifier, Identifie
   }
 
   private static class IdentifierTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public IdentifierTupleScheme getScheme() {
       return new IdentifierTupleScheme();
     }
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java b/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java
index a995217f55..603925e129 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/InstanceRequest.java
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2022-05-02")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest, InstanceRequest._Fields>, java.io.Serializable, Cloneable, Comparable<InstanceRequest> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InstanceRequest");
 
@@ -38,11 +38,11 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new InstanceRequestStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new InstanceRequestTupleSchemeFactory();
 
-  public long requestId; // required
-  public @org.apache.thrift.annotation.Nullable BrokerRequest query; // required
-  public @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> searchSegments; // optional
-  public boolean enableTrace; // optional
-  public @org.apache.thrift.annotation.Nullable java.lang.String brokerId; // optional
+  private long requestId; // required
+  private @org.apache.thrift.annotation.Nullable BrokerRequest query; // required
+  private @org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> searchSegments; // optional
+  private boolean enableTrace; // optional
+  private @org.apache.thrift.annotation.Nullable java.lang.String brokerId; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -190,10 +190,9 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
     return this.requestId;
   }
 
-  public InstanceRequest setRequestId(long requestId) {
+  public void setRequestId(long requestId) {
     this.requestId = requestId;
     setRequestIdIsSet(true);
-    return this;
   }
 
   public void unsetRequestId() {
@@ -214,9 +213,8 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
     return this.query;
   }
 
-  public InstanceRequest setQuery(@org.apache.thrift.annotation.Nullable BrokerRequest query) {
+  public void setQuery(@org.apache.thrift.annotation.Nullable BrokerRequest query) {
     this.query = query;
-    return this;
   }
 
   public void unsetQuery() {
@@ -255,9 +253,8 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
     return this.searchSegments;
   }
 
-  public InstanceRequest setSearchSegments(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> searchSegments) {
+  public void setSearchSegments(@org.apache.thrift.annotation.Nullable java.util.List<java.lang.String> searchSegments) {
     this.searchSegments = searchSegments;
-    return this;
   }
 
   public void unsetSearchSegments() {
@@ -279,10 +276,9 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
     return this.enableTrace;
   }
 
-  public InstanceRequest setEnableTrace(boolean enableTrace) {
+  public void setEnableTrace(boolean enableTrace) {
     this.enableTrace = enableTrace;
     setEnableTraceIsSet(true);
-    return this;
   }
 
   public void unsetEnableTrace() {
@@ -303,9 +299,8 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
     return this.brokerId;
   }
 
-  public InstanceRequest setBrokerId(@org.apache.thrift.annotation.Nullable java.lang.String brokerId) {
+  public void setBrokerId(@org.apache.thrift.annotation.Nullable java.lang.String brokerId) {
     this.brokerId = brokerId;
-    return this;
   }
 
   public void unsetBrokerId() {
@@ -619,10 +614,14 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
 
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    // alas, we cannot check 'requestId' because it's a primitive and you chose the non-beans generator.
-    if (query == null) {
-      throw new org.apache.thrift.protocol.TProtocolException("Required field 'query' was not present! Struct: " + toString());
+    if (!isSetRequestId()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestId' is unset! Struct:" + toString());
     }
+
+    if (!isSetQuery()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'query' is unset! Struct:" + toString());
+    }
+
     // check for sub-struct validity
     if (query != null) {
       query.validate();
@@ -722,11 +721,6 @@ public class InstanceRequest implements org.apache.thrift.TBase<InstanceRequest,
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
-      if (!struct.isSetRequestId()) {
-        throw new org.apache.thrift.protocol.TProtocolException("Required field 'requestId' was not found in serialized data! Struct: " + toString());
-      }
       struct.validate();
     }
 
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java
index b618ad4047..acd305266c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Join.java
@@ -25,34 +25,31 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-03-14")
-public class Join
-    implements org.apache.thrift.TBase<Join, Join._Fields>, java.io.Serializable, Cloneable, Comparable<Join> {
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
+public class Join implements org.apache.thrift.TBase<Join, Join._Fields>, java.io.Serializable, Cloneable, Comparable<Join> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Join");
 
-  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short) 1);
-  private static final org.apache.thrift.protocol.TField LEFT_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("left", org.apache.thrift.protocol.TType.STRUCT, (short) 2);
-  private static final org.apache.thrift.protocol.TField RIGHT_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("right", org.apache.thrift.protocol.TType.STRUCT, (short) 3);
-  private static final org.apache.thrift.protocol.TField CONDITION_FIELD_DESC =
-      new org.apache.thrift.protocol.TField("condition", org.apache.thrift.protocol.TType.STRUCT, (short) 4);
+  private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
+  private static final org.apache.thrift.protocol.TField LEFT_FIELD_DESC = new org.apache.thrift.protocol.TField("left", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+  private static final org.apache.thrift.protocol.TField RIGHT_FIELD_DESC = new org.apache.thrift.protocol.TField("right", org.apache.thrift.protocol.TType.STRUCT, (short)3);
+  private static final org.apache.thrift.protocol.TField CONDITION_FIELD_DESC = new org.apache.thrift.protocol.TField("condition", org.apache.thrift.protocol.TType.STRUCT, (short)4);
 
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new JoinStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new JoinTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable JoinType type; // required
-  public @org.apache.thrift.annotation.Nullable DataSource left; // required
-  public @org.apache.thrift.annotation.Nullable DataSource right; // required
-  public @org.apache.thrift.annotation.Nullable Expression condition; // optional
+  private @org.apache.thrift.annotation.Nullable JoinType type; // required
+  private @org.apache.thrift.annotation.Nullable DataSource left; // required
+  private @org.apache.thrift.annotation.Nullable DataSource right; // required
+  private @org.apache.thrift.annotation.Nullable Expression condition; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
-    TYPE((short) 1, "type"), LEFT((short) 2, "left"), RIGHT((short) 3, "right"), CONDITION((short) 4, "condition");
+    TYPE((short)1, "type"),
+    LEFT((short)2, "left"),
+    RIGHT((short)3, "right"),
+    CONDITION((short)4, "condition");
 
-    private static final java.util.Map<java.lang.String, _Fields> byName =
-        new java.util.HashMap<java.lang.String, _Fields>();
+    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
 
     static {
       for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
@@ -65,7 +62,7 @@ public class Join
      */
     @org.apache.thrift.annotation.Nullable
     public static _Fields findByThriftId(int fieldId) {
-      switch (fieldId) {
+      switch(fieldId) {
         case 1: // TYPE
           return TYPE;
         case 2: // LEFT
@@ -85,9 +82,7 @@ public class Join
      */
     public static _Fields findByThriftIdOrThrow(int fieldId) {
       _Fields fields = findByThriftId(fieldId);
-      if (fields == null) {
-        throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      }
+      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
       return fields;
     }
 
@@ -107,12 +102,10 @@ public class Join
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -121,22 +114,16 @@ public class Join
   // isset id assignments
   private static final _Fields optionals[] = {_Fields.CONDITION};
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
-
   static {
-    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap =
-        new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.TYPE,
-        new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM, "JoinType")));
-    tmpMap.put(_Fields.LEFT,
-        new org.apache.thrift.meta_data.FieldMetaData("left", org.apache.thrift.TFieldRequirementType.REQUIRED,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataSource.class)));
-    tmpMap.put(_Fields.RIGHT,
-        new org.apache.thrift.meta_data.FieldMetaData("right", org.apache.thrift.TFieldRequirementType.REQUIRED,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataSource.class)));
-    tmpMap.put(_Fields.CONDITION,
-        new org.apache.thrift.meta_data.FieldMetaData("condition", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT, "Expression")));
+    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.TYPE, new org.apache.thrift.meta_data.FieldMetaData("type", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.ENUM        , "JoinType")));
+    tmpMap.put(_Fields.LEFT, new org.apache.thrift.meta_data.FieldMetaData("left", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataSource.class)));
+    tmpMap.put(_Fields.RIGHT, new org.apache.thrift.meta_data.FieldMetaData("right", org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataSource.class)));
+    tmpMap.put(_Fields.CONDITION, new org.apache.thrift.meta_data.FieldMetaData("condition", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Expression")));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Join.class, metaDataMap);
   }
@@ -144,7 +131,11 @@ public class Join
   public Join() {
   }
 
-  public Join(JoinType type, DataSource left, DataSource right) {
+  public Join(
+    JoinType type,
+    DataSource left,
+    DataSource right)
+  {
     this();
     this.type = type;
     this.left = left;
@@ -169,7 +160,6 @@ public class Join
     }
   }
 
-  @Override
   public Join deepCopy() {
     return new Join(this);
   }
@@ -187,9 +177,8 @@ public class Join
     return this.type;
   }
 
-  public Join setType(@org.apache.thrift.annotation.Nullable JoinType type) {
+  public void setType(@org.apache.thrift.annotation.Nullable JoinType type) {
     this.type = type;
-    return this;
   }
 
   public void unsetType() {
@@ -212,9 +201,8 @@ public class Join
     return this.left;
   }
 
-  public Join setLeft(@org.apache.thrift.annotation.Nullable DataSource left) {
+  public void setLeft(@org.apache.thrift.annotation.Nullable DataSource left) {
     this.left = left;
-    return this;
   }
 
   public void unsetLeft() {
@@ -237,9 +225,8 @@ public class Join
     return this.right;
   }
 
-  public Join setRight(@org.apache.thrift.annotation.Nullable DataSource right) {
+  public void setRight(@org.apache.thrift.annotation.Nullable DataSource right) {
     this.right = right;
-    return this;
   }
 
   public void unsetRight() {
@@ -262,9 +249,8 @@ public class Join
     return this.condition;
   }
 
-  public Join setCondition(@org.apache.thrift.annotation.Nullable Expression condition) {
+  public void setCondition(@org.apache.thrift.annotation.Nullable Expression condition) {
     this.condition = condition;
-    return this;
   }
 
   public void unsetCondition() {
@@ -282,140 +268,128 @@ public class Join
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case TYPE:
-        if (value == null) {
-          unsetType();
-        } else {
-          setType((JoinType) value);
-        }
-        break;
+    case TYPE:
+      if (value == null) {
+        unsetType();
+      } else {
+        setType((JoinType)value);
+      }
+      break;
 
-      case LEFT:
-        if (value == null) {
-          unsetLeft();
-        } else {
-          setLeft((DataSource) value);
-        }
-        break;
+    case LEFT:
+      if (value == null) {
+        unsetLeft();
+      } else {
+        setLeft((DataSource)value);
+      }
+      break;
 
-      case RIGHT:
-        if (value == null) {
-          unsetRight();
-        } else {
-          setRight((DataSource) value);
-        }
-        break;
+    case RIGHT:
+      if (value == null) {
+        unsetRight();
+      } else {
+        setRight((DataSource)value);
+      }
+      break;
+
+    case CONDITION:
+      if (value == null) {
+        unsetCondition();
+      } else {
+        setCondition((Expression)value);
+      }
+      break;
 
-      case CONDITION:
-        if (value == null) {
-          unsetCondition();
-        } else {
-          setCondition((Expression) value);
-        }
-        break;
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case TYPE:
-        return getType();
+    case TYPE:
+      return getType();
+
+    case LEFT:
+      return getLeft();
 
-      case LEFT:
-        return getLeft();
+    case RIGHT:
+      return getRight();
 
-      case RIGHT:
-        return getRight();
+    case CONDITION:
+      return getCondition();
 
-      case CONDITION:
-        return getCondition();
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case TYPE:
-        return isSetType();
-      case LEFT:
-        return isSetLeft();
-      case RIGHT:
-        return isSetRight();
-      case CONDITION:
-        return isSetCondition();
+    case TYPE:
+      return isSetType();
+    case LEFT:
+      return isSetLeft();
+    case RIGHT:
+      return isSetRight();
+    case CONDITION:
+      return isSetCondition();
     }
     throw new java.lang.IllegalStateException();
   }
 
   @Override
   public boolean equals(java.lang.Object that) {
-    if (that instanceof Join) {
-      return this.equals((Join) that);
-    }
+    if (that instanceof Join)
+      return this.equals((Join)that);
     return false;
   }
 
   public boolean equals(Join that) {
-    if (that == null) {
+    if (that == null)
       return false;
-    }
-    if (this == that) {
+    if (this == that)
       return true;
-    }
 
     boolean this_present_type = true && this.isSetType();
     boolean that_present_type = true && that.isSetType();
     if (this_present_type || that_present_type) {
-      if (!(this_present_type && that_present_type)) {
+      if (!(this_present_type && that_present_type))
         return false;
-      }
-      if (!this.type.equals(that.type)) {
+      if (!this.type.equals(that.type))
         return false;
-      }
     }
 
     boolean this_present_left = true && this.isSetLeft();
     boolean that_present_left = true && that.isSetLeft();
     if (this_present_left || that_present_left) {
-      if (!(this_present_left && that_present_left)) {
+      if (!(this_present_left && that_present_left))
         return false;
-      }
-      if (!this.left.equals(that.left)) {
+      if (!this.left.equals(that.left))
         return false;
-      }
     }
 
     boolean this_present_right = true && this.isSetRight();
     boolean that_present_right = true && that.isSetRight();
     if (this_present_right || that_present_right) {
-      if (!(this_present_right && that_present_right)) {
+      if (!(this_present_right && that_present_right))
         return false;
-      }
-      if (!this.right.equals(that.right)) {
+      if (!this.right.equals(that.right))
         return false;
-      }
     }
 
     boolean this_present_condition = true && this.isSetCondition();
     boolean that_present_condition = true && that.isSetCondition();
     if (this_present_condition || that_present_condition) {
-      if (!(this_present_condition && that_present_condition)) {
+      if (!(this_present_condition && that_present_condition))
         return false;
-      }
-      if (!this.condition.equals(that.condition)) {
+      if (!this.condition.equals(that.condition))
         return false;
-      }
     }
 
     return true;
@@ -426,24 +400,20 @@ public class Join
     int hashCode = 1;
 
     hashCode = hashCode * 8191 + ((isSetType()) ? 131071 : 524287);
-    if (isSetType()) {
+    if (isSetType())
       hashCode = hashCode * 8191 + type.getValue();
-    }
 
     hashCode = hashCode * 8191 + ((isSetLeft()) ? 131071 : 524287);
-    if (isSetLeft()) {
+    if (isSetLeft())
       hashCode = hashCode * 8191 + left.hashCode();
-    }
 
     hashCode = hashCode * 8191 + ((isSetRight()) ? 131071 : 524287);
-    if (isSetRight()) {
+    if (isSetRight())
       hashCode = hashCode * 8191 + right.hashCode();
-    }
 
     hashCode = hashCode * 8191 + ((isSetCondition()) ? 131071 : 524287);
-    if (isSetCondition()) {
+    if (isSetCondition())
       hashCode = hashCode * 8191 + condition.hashCode();
-    }
 
     return hashCode;
   }
@@ -500,20 +470,15 @@ public class Join
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
-  public void read(org.apache.thrift.protocol.TProtocol iprot)
-      throws org.apache.thrift.TException {
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
-  public void write(org.apache.thrift.protocol.TProtocol oprot)
-      throws org.apache.thrift.TException {
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
 
@@ -529,9 +494,7 @@ public class Join
       sb.append(this.type);
     }
     first = false;
-    if (!first) {
-      sb.append(", ");
-    }
+    if (!first) sb.append(", ");
     sb.append("left:");
     if (this.left == null) {
       sb.append("null");
@@ -539,9 +502,7 @@ public class Join
       sb.append(this.left);
     }
     first = false;
-    if (!first) {
-      sb.append(", ");
-    }
+    if (!first) sb.append(", ");
     sb.append("right:");
     if (this.right == null) {
       sb.append("null");
@@ -550,9 +511,7 @@ public class Join
     }
     first = false;
     if (isSetCondition()) {
-      if (!first) {
-        sb.append(", ");
-      }
+      if (!first) sb.append(", ");
       sb.append("condition:");
       if (this.condition == null) {
         sb.append("null");
@@ -565,21 +524,20 @@ public class Join
     return sb.toString();
   }
 
-  public void validate()
-      throws org.apache.thrift.TException {
+  public void validate() throws org.apache.thrift.TException {
     // check for required fields
-    if (type == null) {
-      throw new org.apache.thrift.protocol.TProtocolException(
-          "Required field 'type' was not present! Struct: " + toString());
+    if (!isSetType()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'type' is unset! Struct:" + toString());
     }
-    if (left == null) {
-      throw new org.apache.thrift.protocol.TProtocolException(
-          "Required field 'left' was not present! Struct: " + toString());
+
+    if (!isSetLeft()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'left' is unset! Struct:" + toString());
     }
-    if (right == null) {
-      throw new org.apache.thrift.protocol.TProtocolException(
-          "Required field 'right' was not present! Struct: " + toString());
+
+    if (!isSetRight()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 'right' is unset! Struct:" + toString());
     }
+
     // check for sub-struct validity
     if (left != null) {
       left.validate();
@@ -589,8 +547,7 @@ public class Join
     }
   }
 
-  private void writeObject(java.io.ObjectOutputStream out)
-      throws java.io.IOException {
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
     try {
       write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
     } catch (org.apache.thrift.TException te) {
@@ -598,8 +555,7 @@ public class Join
     }
   }
 
-  private void readObject(java.io.ObjectInputStream in)
-      throws java.io.IOException, java.lang.ClassNotFoundException {
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
     try {
       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
     } catch (org.apache.thrift.TException te) {
@@ -608,7 +564,6 @@ public class Join
   }
 
   private static class JoinStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public JoinStandardScheme getScheme() {
       return new JoinStandardScheme();
     }
@@ -616,14 +571,13 @@ public class Join
 
   private static class JoinStandardScheme extends org.apache.thrift.scheme.StandardScheme<Join> {
 
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol iprot, Join struct)
-        throws org.apache.thrift.TException {
+    public void read(org.apache.thrift.protocol.TProtocol iprot, Join struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
-      while (true) {
+      while (true)
+      {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -631,7 +585,7 @@ public class Join
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.type = org.apache.pinot.common.request.JoinType.findByValue(iprot.readI32());
               struct.setTypeIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -640,7 +594,7 @@ public class Join
               struct.left = new DataSource();
               struct.left.read(iprot);
               struct.setLeftIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -649,7 +603,7 @@ public class Join
               struct.right = new DataSource();
               struct.right.read(iprot);
               struct.setRightIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -658,7 +612,7 @@ public class Join
               struct.condition = new Expression();
               struct.condition.read(iprot);
               struct.setConditionIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -668,14 +622,10 @@ public class Join
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol oprot, Join struct)
-        throws org.apache.thrift.TException {
+    public void write(org.apache.thrift.protocol.TProtocol oprot, Join struct) throws org.apache.thrift.TException {
       struct.validate();
 
       oprot.writeStructBegin(STRUCT_DESC);
@@ -704,10 +654,10 @@ public class Join
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
+
   }
 
   private static class JoinTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public JoinTupleScheme getScheme() {
       return new JoinTupleScheme();
     }
@@ -716,8 +666,7 @@ public class Join
   private static class JoinTupleScheme extends org.apache.thrift.scheme.TupleScheme<Join> {
 
     @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, Join struct)
-        throws org.apache.thrift.TException {
+    public void write(org.apache.thrift.protocol.TProtocol prot, Join struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
       oprot.writeI32(struct.type.getValue());
       struct.left.write(oprot);
@@ -733,8 +682,7 @@ public class Join
     }
 
     @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, Join struct)
-        throws org.apache.thrift.TException {
+    public void read(org.apache.thrift.protocol.TProtocol prot, Join struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
       struct.type = org.apache.pinot.common.request.JoinType.findByValue(iprot.readI32());
       struct.setTypeIsSet(true);
@@ -754,8 +702,7 @@ public class Join
   }
 
   private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
-    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY
-        : TUPLE_SCHEME_FACTORY).getScheme();
+    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
   }
 }
 
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java b/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java
index 08efcf21bb..6f08b2a2b0 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/JoinType.java
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-03-14")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public enum JoinType implements org.apache.thrift.TEnum {
   INNER(0),
   LEFT(1),
@@ -50,7 +50,7 @@ public enum JoinType implements org.apache.thrift.TEnum {
    * @return null if the value is not found.
    */
   @org.apache.thrift.annotation.Nullable
-  public static JoinType findByValue(int value) {
+  public static JoinType findByValue(int value) { 
     switch (value) {
       case 0:
         return INNER;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java b/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java
index fcf523187a..c0249aaf7d 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/Literal.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Literal");
   private static final org.apache.thrift.protocol.TField BOOL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("boolValue", org.apache.thrift.protocol.TType.BOOL, (short)1);
@@ -37,6 +37,7 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
   private static final org.apache.thrift.protocol.TField STRING_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("stringValue", org.apache.thrift.protocol.TType.STRING, (short)7);
   private static final org.apache.thrift.protocol.TField BINARY_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("binaryValue", org.apache.thrift.protocol.TType.STRING, (short)8);
   private static final org.apache.thrift.protocol.TField NULL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("nullValue", org.apache.thrift.protocol.TType.BOOL, (short)9);
+  private static final org.apache.thrift.protocol.TField BIG_DECIMAL_VALUE_FIELD_DESC = new org.apache.thrift.protocol.TField("bigDecimalValue", org.apache.thrift.protocol.TType.STRING, (short)10);
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -48,7 +49,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
     DOUBLE_VALUE((short)6, "doubleValue"),
     STRING_VALUE((short)7, "stringValue"),
     BINARY_VALUE((short)8, "binaryValue"),
-    NULL_VALUE((short)9, "nullValue");
+    NULL_VALUE((short)9, "nullValue"),
+    BIG_DECIMAL_VALUE((short)10, "bigDecimalValue");
 
     private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
 
@@ -82,6 +84,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
           return BINARY_VALUE;
         case 9: // NULL_VALUE
           return NULL_VALUE;
+        case 10: // BIG_DECIMAL_VALUE
+          return BIG_DECIMAL_VALUE;
         default:
           return null;
       }
@@ -113,12 +117,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -127,24 +129,26 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.BOOL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("boolValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.BOOL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("boolValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
-    tmpMap.put(_Fields.BYTE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("byteValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.BYTE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("byteValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BYTE)));
-    tmpMap.put(_Fields.SHORT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("shortValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.SHORT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("shortValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
-    tmpMap.put(_Fields.INT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.INT_VALUE, new org.apache.thrift.meta_data.FieldMetaData("intValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.LONG_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.LONG_VALUE, new org.apache.thrift.meta_data.FieldMetaData("longValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
-    tmpMap.put(_Fields.DOUBLE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("doubleValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.DOUBLE_VALUE, new org.apache.thrift.meta_data.FieldMetaData("doubleValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.DOUBLE)));
-    tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.STRING_VALUE, new org.apache.thrift.meta_data.FieldMetaData("stringValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
-    tmpMap.put(_Fields.BINARY_VALUE, new org.apache.thrift.meta_data.FieldMetaData("binaryValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.BINARY_VALUE, new org.apache.thrift.meta_data.FieldMetaData("binaryValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
-    tmpMap.put(_Fields.NULL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("nullValue", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.NULL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("nullValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.BIG_DECIMAL_VALUE, new org.apache.thrift.meta_data.FieldMetaData("bigDecimalValue", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Literal.class, metaDataMap);
   }
@@ -160,7 +164,6 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
   public Literal(Literal other) {
     super(other);
   }
-  @Override
   public Literal deepCopy() {
     return new Literal(this);
   }
@@ -225,6 +228,18 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
     return x;
   }
 
+  public static Literal bigDecimalValue(java.nio.ByteBuffer value) {
+    Literal x = new Literal();
+    x.setBigDecimalValue(value);
+    return x;
+  }
+
+  public static Literal bigDecimalValue(byte[] value) {
+    Literal x = new Literal();
+    x.setBigDecimalValue  (java.nio.ByteBuffer.wrap(value.clone()));
+    return x;
+  }
+
 
   @Override
   protected void checkType(_Fields setField, java.lang.Object value) throws java.lang.ClassCastException {
@@ -274,6 +289,11 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
           break;
         }
         throw new java.lang.ClassCastException("Was expecting value of type java.lang.Boolean for field 'nullValue', but got " + value.getClass().getSimpleName());
+      case BIG_DECIMAL_VALUE:
+        if (value instanceof java.nio.ByteBuffer) {
+          break;
+        }
+        throw new java.lang.ClassCastException("Was expecting value of type java.nio.ByteBuffer for field 'bigDecimalValue', but got " + value.getClass().getSimpleName());
       default:
         throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
     }
@@ -365,6 +385,15 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
             return null;
           }
+        case BIG_DECIMAL_VALUE:
+          if (field.type == BIG_DECIMAL_VALUE_FIELD_DESC.type) {
+            java.nio.ByteBuffer bigDecimalValue;
+            bigDecimalValue = iprot.readBinary();
+            return bigDecimalValue;
+          } else {
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
+            return null;
+          }
         default:
           throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
       }
@@ -413,6 +442,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
         java.lang.Boolean nullValue = (java.lang.Boolean)value_;
         oprot.writeBool(nullValue);
         return;
+      case BIG_DECIMAL_VALUE:
+        java.nio.ByteBuffer bigDecimalValue = (java.nio.ByteBuffer)value_;
+        oprot.writeBinary(bigDecimalValue);
+        return;
       default:
         throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
     }
@@ -459,6 +492,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
           java.lang.Boolean nullValue;
           nullValue = iprot.readBool();
           return nullValue;
+        case BIG_DECIMAL_VALUE:
+          java.nio.ByteBuffer bigDecimalValue;
+          bigDecimalValue = iprot.readBinary();
+          return bigDecimalValue;
         default:
           throw new java.lang.IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
       }
@@ -506,6 +543,10 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
         java.lang.Boolean nullValue = (java.lang.Boolean)value_;
         oprot.writeBool(nullValue);
         return;
+      case BIG_DECIMAL_VALUE:
+        java.nio.ByteBuffer bigDecimalValue = (java.nio.ByteBuffer)value_;
+        oprot.writeBinary(bigDecimalValue);
+        return;
       default:
         throw new java.lang.IllegalStateException("Cannot write union with unknown field " + setField_);
     }
@@ -532,6 +573,8 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
         return BINARY_VALUE_FIELD_DESC;
       case NULL_VALUE:
         return NULL_VALUE_FIELD_DESC;
+      case BIG_DECIMAL_VALUE:
+        return BIG_DECIMAL_VALUE_FIELD_DESC;
       default:
         throw new java.lang.IllegalArgumentException("Unknown field id " + setField);
     }
@@ -548,7 +591,6 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
@@ -681,6 +723,29 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
     value_ = value;
   }
 
+  public byte[] getBigDecimalValue() {
+    setBigDecimalValue(org.apache.thrift.TBaseHelper.rightSize(bufferForBigDecimalValue()));
+    java.nio.ByteBuffer b = bufferForBigDecimalValue();
+    return b == null ? null : b.array();
+  }
+
+  public java.nio.ByteBuffer bufferForBigDecimalValue() {
+    if (getSetField() == _Fields.BIG_DECIMAL_VALUE) {
+      return org.apache.thrift.TBaseHelper.copyBinary((java.nio.ByteBuffer)getFieldValue());
+    } else {
+      throw new java.lang.RuntimeException("Cannot get field 'bigDecimalValue' because union is currently set to " + getFieldDesc(getSetField()).name);
+    }
+  }
+
+  public void setBigDecimalValue(byte[] value) {
+    setBigDecimalValue  (java.nio.ByteBuffer.wrap(value.clone()));
+  }
+
+  public void setBigDecimalValue(java.nio.ByteBuffer value) {
+    setField_ = _Fields.BIG_DECIMAL_VALUE;
+    value_ = java.util.Objects.requireNonNull(value,"_Fields.BIG_DECIMAL_VALUE");
+  }
+
   public boolean isSetBoolValue() {
     return setField_ == _Fields.BOOL_VALUE;
   }
@@ -726,6 +791,11 @@ public class Literal extends org.apache.thrift.TUnion<Literal, Literal._Fields>
   }
 
 
+  public boolean isSetBigDecimalValue() {
+    return setField_ == _Fields.BIG_DECIMAL_VALUE;
+  }
+
+
   public boolean equals(java.lang.Object other) {
     if (other instanceof Literal) {
       return equals((Literal)other);
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java b/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java
index 51b75bf6b9..d947b6bd31 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/PinotQuery.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.17.0)
+ * Autogenerated by Thrift Compiler (0.15.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.17.0)", date = "2023-02-08")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuery._Fields>, java.io.Serializable, Cloneable, Comparable<PinotQuery> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PinotQuery");
 
@@ -46,19 +46,19 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new PinotQueryStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new PinotQueryTupleSchemeFactory();
 
-  public int version; // optional
-  public @org.apache.thrift.annotation.Nullable DataSource dataSource; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.List<Expression> selectList; // optional
-  public @org.apache.thrift.annotation.Nullable Expression filterExpression; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.List<Expression> groupByList; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.List<Expression> orderByList; // optional
-  public @org.apache.thrift.annotation.Nullable Expression havingExpression; // optional
-  public int limit; // optional
-  public int offset; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> debugOptions; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> queryOptions; // optional
-  public boolean explain; // optional
-  public @org.apache.thrift.annotation.Nullable java.util.Map<Expression,Expression> expressionOverrideHints; // optional
+  private int version; // optional
+  private @org.apache.thrift.annotation.Nullable DataSource dataSource; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.List<Expression> selectList; // optional
+  private @org.apache.thrift.annotation.Nullable Expression filterExpression; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.List<Expression> groupByList; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.List<Expression> orderByList; // optional
+  private @org.apache.thrift.annotation.Nullable Expression havingExpression; // optional
+  private int limit; // optional
+  private int offset; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> debugOptions; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> queryOptions; // optional
+  private boolean explain; // optional
+  private @org.apache.thrift.annotation.Nullable java.util.Map<Expression,Expression> expressionOverrideHints; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -147,12 +147,10 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
       _fieldName = fieldName;
     }
 
-    @Override
     public short getThriftFieldId() {
       return _thriftId;
     }
 
-    @Override
     public java.lang.String getFieldName() {
       return _fieldName;
     }
@@ -168,41 +166,41 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
-    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.DATA_SOURCE, new org.apache.thrift.meta_data.FieldMetaData("dataSource", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, DataSource.class)));
-    tmpMap.put(_Fields.SELECT_LIST, new org.apache.thrift.meta_data.FieldMetaData("selectList", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class))));
-    tmpMap.put(_Fields.FILTER_EXPRESSION, new org.apache.thrift.meta_data.FieldMetaData("filterExpression", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class)));
-    tmpMap.put(_Fields.GROUP_BY_LIST, new org.apache.thrift.meta_data.FieldMetaData("groupByList", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class))));
-    tmpMap.put(_Fields.ORDER_BY_LIST, new org.apache.thrift.meta_data.FieldMetaData("orderByList", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class))));
-    tmpMap.put(_Fields.HAVING_EXPRESSION, new org.apache.thrift.meta_data.FieldMetaData("havingExpression", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class)));
-    tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.DATA_SOURCE, new org.apache.thrift.meta_data.FieldMetaData("dataSource", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "DataSource")));
+    tmpMap.put(_Fields.SELECT_LIST, new org.apache.thrift.meta_data.FieldMetaData("selectList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Expression"))));
+    tmpMap.put(_Fields.FILTER_EXPRESSION, new org.apache.thrift.meta_data.FieldMetaData("filterExpression", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Expression")));
+    tmpMap.put(_Fields.GROUP_BY_LIST, new org.apache.thrift.meta_data.FieldMetaData("groupByList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Expression"))));
+    tmpMap.put(_Fields.ORDER_BY_LIST, new org.apache.thrift.meta_data.FieldMetaData("orderByList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Expression"))));
+    tmpMap.put(_Fields.HAVING_EXPRESSION, new org.apache.thrift.meta_data.FieldMetaData("havingExpression", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT        , "Expression")));
+    tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.OFFSET, new org.apache.thrift.meta_data.FieldMetaData("offset", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
-    tmpMap.put(_Fields.DEBUG_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("debugOptions", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+    tmpMap.put(_Fields.DEBUG_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("debugOptions", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
-    tmpMap.put(_Fields.QUERY_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("queryOptions", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
-            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING),
+    tmpMap.put(_Fields.QUERY_OPTIONS, new org.apache.thrift.meta_data.FieldMetaData("queryOptions", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
-    tmpMap.put(_Fields.EXPLAIN, new org.apache.thrift.meta_data.FieldMetaData("explain", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+    tmpMap.put(_Fields.EXPLAIN, new org.apache.thrift.meta_data.FieldMetaData("explain", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
-    tmpMap.put(_Fields.EXPRESSION_OVERRIDE_HINTS, new org.apache.thrift.meta_data.FieldMetaData("expressionOverrideHints", org.apache.thrift.TFieldRequirementType.OPTIONAL,
-        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class),
-            new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Expression.class))));
+    tmpMap.put(_Fields.EXPRESSION_OVERRIDE_HINTS, new org.apache.thrift.meta_data.FieldMetaData("expressionOverrideHints", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP, 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Expression"), 
+            new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT            , "Expression"))));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PinotQuery.class, metaDataMap);
   }
@@ -278,7 +276,6 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     }
   }
 
-  @Override
   public PinotQuery deepCopy() {
     return new PinotQuery(this);
   }
@@ -308,10 +305,9 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.version;
   }
 
-  public PinotQuery setVersion(int version) {
+  public void setVersion(int version) {
     this.version = version;
     setVersionIsSet(true);
-    return this;
   }
 
   public void unsetVersion() {
@@ -332,9 +328,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.dataSource;
   }
 
-  public PinotQuery setDataSource(@org.apache.thrift.annotation.Nullable DataSource dataSource) {
+  public void setDataSource(@org.apache.thrift.annotation.Nullable DataSource dataSource) {
     this.dataSource = dataSource;
-    return this;
   }
 
   public void unsetDataSource() {
@@ -373,9 +368,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.selectList;
   }
 
-  public PinotQuery setSelectList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> selectList) {
+  public void setSelectList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> selectList) {
     this.selectList = selectList;
-    return this;
   }
 
   public void unsetSelectList() {
@@ -398,9 +392,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.filterExpression;
   }
 
-  public PinotQuery setFilterExpression(@org.apache.thrift.annotation.Nullable Expression filterExpression) {
+  public void setFilterExpression(@org.apache.thrift.annotation.Nullable Expression filterExpression) {
     this.filterExpression = filterExpression;
-    return this;
   }
 
   public void unsetFilterExpression() {
@@ -439,9 +432,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.groupByList;
   }
 
-  public PinotQuery setGroupByList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> groupByList) {
+  public void setGroupByList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> groupByList) {
     this.groupByList = groupByList;
-    return this;
   }
 
   public void unsetGroupByList() {
@@ -480,9 +472,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.orderByList;
   }
 
-  public PinotQuery setOrderByList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> orderByList) {
+  public void setOrderByList(@org.apache.thrift.annotation.Nullable java.util.List<Expression> orderByList) {
     this.orderByList = orderByList;
-    return this;
   }
 
   public void unsetOrderByList() {
@@ -505,9 +496,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.havingExpression;
   }
 
-  public PinotQuery setHavingExpression(@org.apache.thrift.annotation.Nullable Expression havingExpression) {
+  public void setHavingExpression(@org.apache.thrift.annotation.Nullable Expression havingExpression) {
     this.havingExpression = havingExpression;
-    return this;
   }
 
   public void unsetHavingExpression() {
@@ -529,10 +519,9 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.limit;
   }
 
-  public PinotQuery setLimit(int limit) {
+  public void setLimit(int limit) {
     this.limit = limit;
     setLimitIsSet(true);
-    return this;
   }
 
   public void unsetLimit() {
@@ -552,10 +541,9 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.offset;
   }
 
-  public PinotQuery setOffset(int offset) {
+  public void setOffset(int offset) {
     this.offset = offset;
     setOffsetIsSet(true);
-    return this;
   }
 
   public void unsetOffset() {
@@ -587,9 +575,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.debugOptions;
   }
 
-  public PinotQuery setDebugOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> debugOptions) {
+  public void setDebugOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> debugOptions) {
     this.debugOptions = debugOptions;
-    return this;
   }
 
   public void unsetDebugOptions() {
@@ -623,9 +610,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.queryOptions;
   }
 
-  public PinotQuery setQueryOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> queryOptions) {
+  public void setQueryOptions(@org.apache.thrift.annotation.Nullable java.util.Map<java.lang.String,java.lang.String> queryOptions) {
     this.queryOptions = queryOptions;
-    return this;
   }
 
   public void unsetQueryOptions() {
@@ -647,10 +633,9 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.explain;
   }
 
-  public PinotQuery setExplain(boolean explain) {
+  public void setExplain(boolean explain) {
     this.explain = explain;
     setExplainIsSet(true);
-    return this;
   }
 
   public void unsetExplain() {
@@ -682,9 +667,8 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     return this.expressionOverrideHints;
   }
 
-  public PinotQuery setExpressionOverrideHints(@org.apache.thrift.annotation.Nullable java.util.Map<Expression,Expression> expressionOverrideHints) {
+  public void setExpressionOverrideHints(@org.apache.thrift.annotation.Nullable java.util.Map<Expression,Expression> expressionOverrideHints) {
     this.expressionOverrideHints = expressionOverrideHints;
-    return this;
   }
 
   public void unsetExpressionOverrideHints() {
@@ -702,197 +686,194 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
     }
   }
 
-  @Override
   public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
-      case VERSION:
-        if (value == null) {
-          unsetVersion();
-        } else {
-          setVersion((java.lang.Integer)value);
-        }
-        break;
+    case VERSION:
+      if (value == null) {
+        unsetVersion();
+      } else {
+        setVersion((java.lang.Integer)value);
+      }
+      break;
 
-      case DATA_SOURCE:
-        if (value == null) {
-          unsetDataSource();
-        } else {
-          setDataSource((DataSource)value);
-        }
-        break;
+    case DATA_SOURCE:
+      if (value == null) {
+        unsetDataSource();
+      } else {
+        setDataSource((DataSource)value);
+      }
+      break;
 
-      case SELECT_LIST:
-        if (value == null) {
-          unsetSelectList();
-        } else {
-          setSelectList((java.util.List<Expression>)value);
-        }
-        break;
+    case SELECT_LIST:
+      if (value == null) {
+        unsetSelectList();
+      } else {
+        setSelectList((java.util.List<Expression>)value);
+      }
+      break;
 
-      case FILTER_EXPRESSION:
-        if (value == null) {
-          unsetFilterExpression();
-        } else {
-          setFilterExpression((Expression)value);
-        }
-        break;
+    case FILTER_EXPRESSION:
+      if (value == null) {
+        unsetFilterExpression();
+      } else {
+        setFilterExpression((Expression)value);
+      }
+      break;
 
-      case GROUP_BY_LIST:
-        if (value == null) {
-          unsetGroupByList();
-        } else {
-          setGroupByList((java.util.List<Expression>)value);
-        }
-        break;
+    case GROUP_BY_LIST:
+      if (value == null) {
+        unsetGroupByList();
+      } else {
+        setGroupByList((java.util.List<Expression>)value);
+      }
+      break;
 
-      case ORDER_BY_LIST:
-        if (value == null) {
-          unsetOrderByList();
-        } else {
-          setOrderByList((java.util.List<Expression>)value);
-        }
-        break;
+    case ORDER_BY_LIST:
+      if (value == null) {
+        unsetOrderByList();
+      } else {
+        setOrderByList((java.util.List<Expression>)value);
+      }
+      break;
 
-      case HAVING_EXPRESSION:
-        if (value == null) {
-          unsetHavingExpression();
-        } else {
-          setHavingExpression((Expression)value);
-        }
-        break;
+    case HAVING_EXPRESSION:
+      if (value == null) {
+        unsetHavingExpression();
+      } else {
+        setHavingExpression((Expression)value);
+      }
+      break;
 
-      case LIMIT:
-        if (value == null) {
-          unsetLimit();
-        } else {
-          setLimit((java.lang.Integer)value);
-        }
-        break;
+    case LIMIT:
+      if (value == null) {
+        unsetLimit();
+      } else {
+        setLimit((java.lang.Integer)value);
+      }
+      break;
 
-      case OFFSET:
-        if (value == null) {
-          unsetOffset();
-        } else {
-          setOffset((java.lang.Integer)value);
-        }
-        break;
+    case OFFSET:
+      if (value == null) {
+        unsetOffset();
+      } else {
+        setOffset((java.lang.Integer)value);
+      }
+      break;
 
-      case DEBUG_OPTIONS:
-        if (value == null) {
-          unsetDebugOptions();
-        } else {
-          setDebugOptions((java.util.Map<java.lang.String,java.lang.String>)value);
-        }
-        break;
+    case DEBUG_OPTIONS:
+      if (value == null) {
+        unsetDebugOptions();
+      } else {
+        setDebugOptions((java.util.Map<java.lang.String,java.lang.String>)value);
+      }
+      break;
 
-      case QUERY_OPTIONS:
-        if (value == null) {
-          unsetQueryOptions();
-        } else {
-          setQueryOptions((java.util.Map<java.lang.String,java.lang.String>)value);
-        }
-        break;
+    case QUERY_OPTIONS:
+      if (value == null) {
+        unsetQueryOptions();
+      } else {
+        setQueryOptions((java.util.Map<java.lang.String,java.lang.String>)value);
+      }
+      break;
 
-      case EXPLAIN:
-        if (value == null) {
-          unsetExplain();
-        } else {
-          setExplain((java.lang.Boolean)value);
-        }
-        break;
+    case EXPLAIN:
+      if (value == null) {
+        unsetExplain();
+      } else {
+        setExplain((java.lang.Boolean)value);
+      }
+      break;
 
-      case EXPRESSION_OVERRIDE_HINTS:
-        if (value == null) {
-          unsetExpressionOverrideHints();
-        } else {
-          setExpressionOverrideHints((java.util.Map<Expression,Expression>)value);
-        }
-        break;
+    case EXPRESSION_OVERRIDE_HINTS:
+      if (value == null) {
+        unsetExpressionOverrideHints();
+      } else {
+        setExpressionOverrideHints((java.util.Map<Expression,Expression>)value);
+      }
+      break;
 
     }
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public java.lang.Object getFieldValue(_Fields field) {
     switch (field) {
-      case VERSION:
-        return getVersion();
+    case VERSION:
+      return getVersion();
 
-      case DATA_SOURCE:
-        return getDataSource();
+    case DATA_SOURCE:
+      return getDataSource();
 
-      case SELECT_LIST:
-        return getSelectList();
+    case SELECT_LIST:
+      return getSelectList();
 
-      case FILTER_EXPRESSION:
-        return getFilterExpression();
+    case FILTER_EXPRESSION:
+      return getFilterExpression();
 
-      case GROUP_BY_LIST:
-        return getGroupByList();
+    case GROUP_BY_LIST:
+      return getGroupByList();
 
-      case ORDER_BY_LIST:
-        return getOrderByList();
+    case ORDER_BY_LIST:
+      return getOrderByList();
 
-      case HAVING_EXPRESSION:
-        return getHavingExpression();
+    case HAVING_EXPRESSION:
+      return getHavingExpression();
 
-      case LIMIT:
-        return getLimit();
+    case LIMIT:
+      return getLimit();
 
-      case OFFSET:
-        return getOffset();
+    case OFFSET:
+      return getOffset();
 
-      case DEBUG_OPTIONS:
-        return getDebugOptions();
+    case DEBUG_OPTIONS:
+      return getDebugOptions();
 
-      case QUERY_OPTIONS:
-        return getQueryOptions();
+    case QUERY_OPTIONS:
+      return getQueryOptions();
 
-      case EXPLAIN:
-        return isExplain();
+    case EXPLAIN:
+      return isExplain();
 
-      case EXPRESSION_OVERRIDE_HINTS:
-        return getExpressionOverrideHints();
+    case EXPRESSION_OVERRIDE_HINTS:
+      return getExpressionOverrideHints();
 
     }
     throw new java.lang.IllegalStateException();
   }
 
   /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  @Override
   public boolean isSet(_Fields field) {
     if (field == null) {
       throw new java.lang.IllegalArgumentException();
     }
 
     switch (field) {
-      case VERSION:
-        return isSetVersion();
-      case DATA_SOURCE:
-        return isSetDataSource();
-      case SELECT_LIST:
-        return isSetSelectList();
-      case FILTER_EXPRESSION:
-        return isSetFilterExpression();
-      case GROUP_BY_LIST:
-        return isSetGroupByList();
-      case ORDER_BY_LIST:
-        return isSetOrderByList();
-      case HAVING_EXPRESSION:
-        return isSetHavingExpression();
-      case LIMIT:
-        return isSetLimit();
-      case OFFSET:
-        return isSetOffset();
-      case DEBUG_OPTIONS:
-        return isSetDebugOptions();
-      case QUERY_OPTIONS:
-        return isSetQueryOptions();
-      case EXPLAIN:
-        return isSetExplain();
-      case EXPRESSION_OVERRIDE_HINTS:
-        return isSetExpressionOverrideHints();
+    case VERSION:
+      return isSetVersion();
+    case DATA_SOURCE:
+      return isSetDataSource();
+    case SELECT_LIST:
+      return isSetSelectList();
+    case FILTER_EXPRESSION:
+      return isSetFilterExpression();
+    case GROUP_BY_LIST:
+      return isSetGroupByList();
+    case ORDER_BY_LIST:
+      return isSetOrderByList();
+    case HAVING_EXPRESSION:
+      return isSetHavingExpression();
+    case LIMIT:
+      return isSetLimit();
+    case OFFSET:
+      return isSetOffset();
+    case DEBUG_OPTIONS:
+      return isSetDebugOptions();
+    case QUERY_OPTIONS:
+      return isSetQueryOptions();
+    case EXPLAIN:
+      return isSetExplain();
+    case EXPRESSION_OVERRIDE_HINTS:
+      return isSetExpressionOverrideHints();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -1231,17 +1212,14 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   }
 
   @org.apache.thrift.annotation.Nullable
-  @Override
   public _Fields fieldForId(int fieldId) {
     return _Fields.findByThriftId(fieldId);
   }
 
-  @Override
   public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
     scheme(iprot).read(iprot, this);
   }
 
-  @Override
   public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
     scheme(oprot).write(oprot, this);
   }
@@ -1371,15 +1349,6 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   public void validate() throws org.apache.thrift.TException {
     // check for required fields
     // check for sub-struct validity
-    if (dataSource != null) {
-      dataSource.validate();
-    }
-    if (filterExpression != null) {
-      filterExpression.validate();
-    }
-    if (havingExpression != null) {
-      havingExpression.validate();
-    }
   }
 
   private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
@@ -1401,7 +1370,6 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   }
 
   private static class PinotQueryStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public PinotQueryStandardScheme getScheme() {
       return new PinotQueryStandardScheme();
     }
@@ -1409,14 +1377,13 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
 
   private static class PinotQueryStandardScheme extends org.apache.thrift.scheme.StandardScheme<PinotQuery> {
 
-    @Override
     public void read(org.apache.thrift.protocol.TProtocol iprot, PinotQuery struct) throws org.apache.thrift.TException {
       org.apache.thrift.protocol.TField schemeField;
       iprot.readStructBegin();
       while (true)
       {
         schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
           break;
         }
         switch (schemeField.id) {
@@ -1424,7 +1391,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.version = iprot.readI32();
               struct.setVersionIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1433,7 +1400,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
               struct.dataSource = new DataSource();
               struct.dataSource.read(iprot);
               struct.setDataSourceIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1452,7 +1419,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readListEnd();
               }
               struct.setSelectListIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1461,7 +1428,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
               struct.filterExpression = new Expression();
               struct.filterExpression.read(iprot);
               struct.setFilterExpressionIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1480,7 +1447,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readListEnd();
               }
               struct.setGroupByListIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1499,7 +1466,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readListEnd();
               }
               struct.setOrderByListIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1508,7 +1475,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
               struct.havingExpression = new Expression();
               struct.havingExpression.read(iprot);
               struct.setHavingExpressionIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1516,7 +1483,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.limit = iprot.readI32();
               struct.setLimitIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1524,7 +1491,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.offset = iprot.readI32();
               struct.setOffsetIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1544,7 +1511,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readMapEnd();
               }
               struct.setDebugOptionsIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1564,7 +1531,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readMapEnd();
               }
               struct.setQueryOptionsIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1572,7 +1539,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
             if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
               struct.explain = iprot.readBool();
               struct.setExplainIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1594,7 +1561,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
                 iprot.readMapEnd();
               }
               struct.setExpressionOverrideHintsIsSet(true);
-            } else {
+            } else { 
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
@@ -1604,12 +1571,9 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
-    @Override
     public void write(org.apache.thrift.protocol.TProtocol oprot, PinotQuery struct) throws org.apache.thrift.TException {
       struct.validate();
 
@@ -1749,7 +1713,6 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
   }
 
   private static class PinotQueryTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
-    @Override
     public PinotQueryTupleScheme getScheme() {
       return new PinotQueryTupleScheme();
     }
@@ -1956,7 +1919,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
       }
       if (incoming.get(9)) {
         {
-          org.apache.thrift.protocol.TMap _map42 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING);
+          org.apache.thrift.protocol.TMap _map42 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); 
           struct.debugOptions = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map42.size);
           @org.apache.thrift.annotation.Nullable java.lang.String _key43;
           @org.apache.thrift.annotation.Nullable java.lang.String _val44;
@@ -1971,7 +1934,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
       }
       if (incoming.get(10)) {
         {
-          org.apache.thrift.protocol.TMap _map46 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING);
+          org.apache.thrift.protocol.TMap _map46 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING); 
           struct.queryOptions = new java.util.HashMap<java.lang.String,java.lang.String>(2*_map46.size);
           @org.apache.thrift.annotation.Nullable java.lang.String _key47;
           @org.apache.thrift.annotation.Nullable java.lang.String _val48;
@@ -1990,7 +1953,7 @@ public class PinotQuery implements org.apache.thrift.TBase<PinotQuery, PinotQuer
       }
       if (incoming.get(12)) {
         {
-          org.apache.thrift.protocol.TMap _map50 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT);
+          org.apache.thrift.protocol.TMap _map50 = iprot.readMapBegin(org.apache.thrift.protocol.TType.STRUCT, org.apache.thrift.protocol.TType.STRUCT); 
           struct.expressionOverrideHints = new java.util.HashMap<Expression,Expression>(2*_map50.size);
           @org.apache.thrift.annotation.Nullable Expression _key51;
           @org.apache.thrift.annotation.Nullable Expression _val52;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java b/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java
index bfb2fc0e9d..4035ea9b87 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/request/QuerySource.java
@@ -25,7 +25,7 @@
 package org.apache.pinot.common.request;
 
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2022-05-02")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class QuerySource implements org.apache.thrift.TBase<QuerySource, QuerySource._Fields>, java.io.Serializable, Cloneable, Comparable<QuerySource> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("QuerySource");
 
@@ -34,7 +34,7 @@ public class QuerySource implements org.apache.thrift.TBase<QuerySource, QuerySo
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new QuerySourceStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new QuerySourceTupleSchemeFactory();
 
-  public @org.apache.thrift.annotation.Nullable java.lang.String tableName; // optional
+  private @org.apache.thrift.annotation.Nullable java.lang.String tableName; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -133,9 +133,8 @@ public class QuerySource implements org.apache.thrift.TBase<QuerySource, QuerySo
     return this.tableName;
   }
 
-  public QuerySource setTableName(@org.apache.thrift.annotation.Nullable java.lang.String tableName) {
+  public void setTableName(@org.apache.thrift.annotation.Nullable java.lang.String tableName) {
     this.tableName = tableName;
-    return this;
   }
 
   public void unsetTableName() {
@@ -330,8 +329,6 @@ public class QuerySource implements org.apache.thrift.TBase<QuerySource, QuerySo
         iprot.readFieldEnd();
       }
       iprot.readStructEnd();
-
-      // check for required fields of primitive type, which can't be checked in the validate method
       struct.validate();
     }
 
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 f009dbf6c5..a3cb093f5e 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
@@ -31,6 +31,7 @@ import org.apache.commons.lang3.tuple.Pair;
 import org.apache.pinot.common.request.Literal;
 import org.apache.pinot.common.utils.PinotDataType;
 import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.utils.BigDecimalUtils;
 
 
 /**
@@ -136,6 +137,16 @@ public class LiteralContext {
         }
         _value = literal.getFieldValue().toString();
         break;
+      case BIG_DECIMAL_VALUE:
+        _type = FieldSpec.DataType.BIG_DECIMAL;
+        _bigDecimalValue = BigDecimalUtils.deserialize(literal.getBigDecimalValue());
+        _value = _bigDecimalValue;
+        break;
+      case BINARY_VALUE:
+        _type = FieldSpec.DataType.BYTES;
+        _value = literal.getBinaryValue();
+        _bigDecimalValue = BigDecimal.ZERO;
+        break;
       case NULL_VALUE:
         _type = FieldSpec.DataType.UNKNOWN;
         _value = null;
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java b/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java
index 5f6649fee3..32b74a7fe8 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/response/ProcessingException.java
@@ -29,7 +29,7 @@ package org.apache.pinot.common.response;
  * Processing exception
  * 
  */
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2022-03-28")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.15.0)", date = "2023-08-31")
 public class ProcessingException extends org.apache.thrift.TException implements org.apache.thrift.TBase<ProcessingException, ProcessingException._Fields>, java.io.Serializable, Cloneable, Comparable<ProcessingException> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ProcessingException");
 
diff --git a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
index c2edab51ec..e0569aee4c 100644
--- a/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
+++ b/pinot-common/src/main/java/org/apache/pinot/common/utils/request/RequestUtils.java
@@ -23,6 +23,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Splitter;
 import com.google.common.collect.ImmutableSet;
+import com.google.protobuf.ByteString;
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
@@ -36,6 +38,7 @@ import org.apache.pinot.common.request.Function;
 import org.apache.pinot.common.request.Identifier;
 import org.apache.pinot.common.request.Literal;
 import org.apache.pinot.common.request.PinotQuery;
+import org.apache.pinot.spi.utils.BigDecimalUtils;
 import org.apache.pinot.spi.utils.BytesUtils;
 import org.apache.pinot.spi.utils.CommonConstants;
 import org.apache.pinot.sql.FilterKind;
@@ -174,10 +177,24 @@ public class RequestUtils {
 
   public static Expression getLiteralExpression(byte[] value) {
     Expression expression = createNewLiteralExpression();
+    // TODO(After 1.0.0): This is for backward-compatibility, we can set the binary value directly instead of
+    //  converting it to hex string after the next released version.
     expression.getLiteral().setStringValue(BytesUtils.toHexString(value));
     return expression;
   }
 
+  public static Expression getLiteralExpression(ByteString value) {
+    Expression expression = createNewLiteralExpression();
+    expression.getLiteral().setBinaryValue(value.toByteArray());
+    return expression;
+  }
+
+  public static Expression getLiteralExpression(BigDecimal value) {
+    Expression expression = createNewLiteralExpression();
+    expression.getLiteral().setBigDecimalValue(BigDecimalUtils.serialize(value));
+    return expression;
+  }
+
   public static Expression getNullLiteralExpression() {
     Expression expression = createNewLiteralExpression();
     expression.getLiteral().setNullValue(true);
@@ -204,6 +221,9 @@ public class RequestUtils {
     if (object instanceof byte[]) {
       return RequestUtils.getLiteralExpression((byte[]) object);
     }
+    if (object instanceof ByteString) {
+      return RequestUtils.getLiteralExpression((ByteString) object);
+    }
     if (object instanceof Boolean) {
       return RequestUtils.getLiteralExpression(((Boolean) object).booleanValue());
     }
diff --git a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
index 5c9a4ec1c5..5b28ce238f 100644
--- a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
+++ b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/CalciteSqlParser.java
@@ -970,7 +970,7 @@ public class CalciteSqlParser {
   }
 
   public static Expression removeOrderByFunctions(Expression expression) {
-    while (expression.isSetFunctionCall() && ORDER_BY_FUNCTIONS.contains(expression.getFunctionCall().operator)) {
+    while (expression.isSetFunctionCall() && ORDER_BY_FUNCTIONS.contains(expression.getFunctionCall().getOperator())) {
       expression = expression.getFunctionCall().getOperands().get(0);
     }
     return expression;
diff --git a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/ExprMinMaxRewriter.java b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/ExprMinMaxRewriter.java
index 96ee26f104..6103b63293 100644
--- a/pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/ExprMinMaxRewriter.java
+++ b/pinot-common/src/main/java/org/apache/pinot/sql/parsers/rewriter/ExprMinMaxRewriter.java
@@ -107,15 +107,21 @@ public class ExprMinMaxRewriter implements QueryRewriter {
       numMeasuringColumns.setLongValue(entry.getKey().size());
 
       Function parentFunction = new Function(isMax ? EXPR_MAX_PARENT : EXPR_MIN_PARENT);
-      parentFunction.addToOperands(new Expression(ExpressionType.LITERAL).setLiteral(functionID));
-      parentFunction.addToOperands(new Expression(ExpressionType.LITERAL).setLiteral(numMeasuringColumns));
+      Expression expr1 = new Expression(ExpressionType.LITERAL);
+      expr1.setLiteral(functionID);
+      parentFunction.addToOperands(expr1);
+      Expression expr2 = new Expression(ExpressionType.LITERAL);
+      expr2.setLiteral(numMeasuringColumns);
+      parentFunction.addToOperands(expr2);
       for (Expression expression : entry.getKey()) {
         parentFunction.addToOperands(expression);
       }
       for (Expression expression : entry.getValue()) {
         parentFunction.addToOperands(expression);
       }
-      selectList.add(new Expression(ExpressionType.FUNCTION).setFunctionCall(parentFunction));
+      Expression funcExpr = new Expression(ExpressionType.FUNCTION);
+      funcExpr.setFunctionCall(parentFunction);
+      selectList.add(funcExpr);
     }
   }
 
@@ -178,14 +184,16 @@ public class ExprMinMaxRewriter implements QueryRewriter {
       return v;
     });
 
-    String operator = function.operator;
+    String operator = function.getOperator();
     function.setOperator(CommonConstants.RewriterConstants.CHILD_AGGREGATION_NAME_PREFIX + operator);
 
     List<Expression> operands = function.getOperands();
     operands.add(0, exprMinMaxProjectionExpression);
     Literal functionID = new Literal();
     functionID.setLongValue(id);
-    operands.add(0, new Expression(ExpressionType.LITERAL).setLiteral(functionID));
+    Expression literalExpr = new Expression(ExpressionType.LITERAL);
+    literalExpr.setLiteral(functionID);
+    operands.add(0, literalExpr);
 
     return added.get();
   }
diff --git a/pinot-common/src/main/proto/plan.proto b/pinot-common/src/main/proto/plan.proto
index 783e37b8b0..b36fa652b0 100644
--- a/pinot-common/src/main/proto/plan.proto
+++ b/pinot-common/src/main/proto/plan.proto
@@ -17,24 +17,6 @@
 // under the License.
 //
 
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
 syntax = "proto3";
 
 package org.apache.pinot.common.proto;
@@ -81,6 +63,8 @@ message LiteralField {
     float floatField = 4;
     double doubleField = 5;
     string stringField = 6;
+    bytes bytesField = 7;
+    bytes bigDecimalField = 8;
   }
 }
 
diff --git a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
index a6e99867a8..46aac8c898 100644
--- a/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
+++ b/pinot-common/src/test/java/org/apache/pinot/sql/parsers/CalciteSqlCompilerTest.java
@@ -2978,10 +2978,10 @@ public class CalciteSqlCompilerTest {
     // Then:
     Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
     Function fun = pinotQuery.getSelectList().get(0).getFunctionCall();
-    Assert.assertEquals(fun.operator, "attimezone");
-    Assert.assertEquals(fun.operands.size(), 2);
-    Assert.assertEquals(fun.operands.get(0).getIdentifier().name, "ts");
-    Assert.assertEquals(fun.operands.get(1).getLiteral().getStringValue(), "pst");
+    Assert.assertEquals(fun.getOperator(), "attimezone");
+    Assert.assertEquals(fun.getOperands().size(), 2);
+    Assert.assertEquals(fun.getOperands().get(0).getIdentifier().getName(), "ts");
+    Assert.assertEquals(fun.getOperands().get(1).getLiteral().getStringValue(), "pst");
   }
 
   @Test
@@ -2995,13 +2995,15 @@ public class CalciteSqlCompilerTest {
     // Then:
     Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
     Function fun = pinotQuery.getSelectList().get(0).getFunctionCall();
-    Assert.assertEquals(fun.operator, "attimezone");
-    Assert.assertEquals(fun.operands.size(), 2);
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operator, "plus");
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.size(), 2);
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.get(0).getIdentifier().getName(), "ts");
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.get(1).getLiteral().getLongValue(), 123L);
-    Assert.assertEquals(fun.operands.get(1).getLiteral().getStringValue(), "pst");
+    Assert.assertEquals(fun.getOperator(), "attimezone");
+    Assert.assertEquals(fun.getOperands().size(), 2);
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperator(), "plus");
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+        "ts");
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral().getLongValue(),
+        123L);
+    Assert.assertEquals(fun.getOperands().get(1).getLiteral().getStringValue(), "pst");
   }
 
   @Test
@@ -3015,12 +3017,14 @@ public class CalciteSqlCompilerTest {
     // Then:
     Assert.assertEquals(pinotQuery.getSelectListSize(), 1);
     Function fun = pinotQuery.getSelectList().get(0).getFunctionCall();
-    Assert.assertEquals(fun.operator, "GREATER_THAN");
-    Assert.assertEquals(fun.operands.size(), 2);
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operator, "attimezone");
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.size(), 2);
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.get(0).getIdentifier().getName(), "ts");
-    Assert.assertEquals(fun.operands.get(0).getFunctionCall().operands.get(1).getLiteral().getStringValue(), "pst");
+    Assert.assertEquals(fun.getOperator(), "GREATER_THAN");
+    Assert.assertEquals(fun.getOperands().size(), 2);
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperator(), "attimezone");
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().size(), 2);
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().get(0).getIdentifier().getName(),
+        "ts");
+    Assert.assertEquals(fun.getOperands().get(0).getFunctionCall().getOperands().get(1).getLiteral().getStringValue(),
+        "pst");
   }
 
   @Test
@@ -3143,49 +3147,49 @@ public class CalciteSqlCompilerTest {
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in IN "
-  + "filter is not supported")
+      + "filter is not supported")
   public void testAndFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 IN (1, 2, NULL) AND column2 = 1");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in NOT_IN "
-  + "filter is not supported")
+      + "filter is not supported")
   public void testOrFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 NOT IN (1, 2, NULL) OR column2 = 1");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in IN "
-  + "filter is not supported")
+      + "filter is not supported")
   public void testNotFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE NOT(column1 IN (NULL, 1, 2))");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in "
-  + "GREATER_THAN filter is not supported")
+      + "GREATER_THAN filter is not supported")
   public void testGreaterThanNullFilterFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 > null");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in "
-  + "LESS_THAN_OR_EQUAL filter is not supported")
+      + "LESS_THAN_OR_EQUAL filter is not supported")
   public void testLessThanOrEqualNullFilterFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 <= null");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in LIKE "
-  + "filter is not supported")
+      + "filter is not supported")
   public void testLikeFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 LIKE null");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in EQUALS "
-  + "filter is not supported")
+      + "filter is not supported")
   public void testEqualFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 = null");
   }
 
   @Test(expectedExceptions = {IllegalStateException.class}, expectedExceptionsMessageRegExp = "Using NULL in "
-  + "NOT_EQUALS filter is not supported")
+      + "NOT_EQUALS filter is not supported")
   public void testInEqualFilterWithNullFails() {
     CalciteSqlParser.compileToPinotQuery("SELECT * FROM testTable WHERE column1 != null");
   }
diff --git a/pinot-common/src/thrift/query.thrift b/pinot-common/src/thrift/query.thrift
index 12a601c2df..946a37eb27 100644
--- a/pinot-common/src/thrift/query.thrift
+++ b/pinot-common/src/thrift/query.thrift
@@ -78,6 +78,7 @@ union Literal {
   8: optional binary binaryValue;
   // Set to true when the literal value is a null.
   9: optional bool nullValue;
+  10: optional binary bigDecimalValue;
 }
 
 struct Identifier {
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/BaseBinaryGeoTransformFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/BaseBinaryGeoTransformFunction.java
index 347abeb0f0..10dbe54cb3 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/BaseBinaryGeoTransformFunction.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/BaseBinaryGeoTransformFunction.java
@@ -30,7 +30,6 @@ import org.apache.pinot.core.operator.transform.function.TransformFunction;
 import org.apache.pinot.core.plan.DocIdSetPlanNode;
 import org.apache.pinot.segment.local.utils.GeometrySerializer;
 import org.apache.pinot.spi.data.FieldSpec;
-import org.apache.pinot.spi.utils.BytesUtils;
 import org.locationtech.jts.geom.Geometry;
 
 
@@ -56,8 +55,7 @@ public abstract class BaseBinaryGeoTransformFunction extends BaseTransformFuncti
             || transformFunction instanceof LiteralTransformFunction,
         "The first argument must be of type BYTES , but was %s", transformFunction.getResultMetadata().getDataType());
     if (transformFunction instanceof LiteralTransformFunction) {
-      _firstLiteral = GeometrySerializer.deserialize(
-          BytesUtils.toBytes(((LiteralTransformFunction) transformFunction).getStringLiteral()));
+      _firstLiteral = GeometrySerializer.deserialize(((LiteralTransformFunction) transformFunction).getBytesLiteral());
     } else {
       _firstArgument = transformFunction;
     }
@@ -68,8 +66,7 @@ public abstract class BaseBinaryGeoTransformFunction extends BaseTransformFuncti
             || transformFunction instanceof LiteralTransformFunction,
         "The second argument must be of type BYTES , but was %s", transformFunction.getResultMetadata().getDataType());
     if (transformFunction instanceof LiteralTransformFunction) {
-      _secondLiteral = GeometrySerializer.deserialize(
-          BytesUtils.toBytes(((LiteralTransformFunction) transformFunction).getStringLiteral()));
+      _secondLiteral = GeometrySerializer.deserialize(((LiteralTransformFunction) transformFunction).getBytesLiteral());
     } else {
       _secondArgument = transformFunction;
     }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/ScalarFunctions.java b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/ScalarFunctions.java
index 4ea84e5815..7291ae6610 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/ScalarFunctions.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/ScalarFunctions.java
@@ -159,4 +159,32 @@ public class ScalarFunctions {
   public static long geoToH3(double longitude, double latitude, int resolution) {
     return H3Utils.H3_CORE.geoToH3(latitude, longitude, resolution);
   }
+
+  /**
+   * Gets the H3 hexagon address from the location
+   * @param geoBytes ST_point serialized bytes
+   * @param resolution H3 index resolution
+   * @return the H3 index address
+   */
+  @ScalarFunction
+  public static long geoToH3(byte[] geoBytes, int resolution) {
+    Geometry geometry = GeometrySerializer.deserialize(geoBytes);
+    double latitude = geometry.getCoordinate().y;
+    double longitude = geometry.getCoordinate().x;
+    return H3Utils.H3_CORE.geoToH3(latitude, longitude, resolution);
+  }
+
+  @ScalarFunction
+  public static double stDistance(byte[] firstPoint, byte[] secondPoint) {
+    Geometry firstGeometry = GeometrySerializer.deserialize(firstPoint);
+    Geometry secondGeometry = GeometrySerializer.deserialize(secondPoint);
+    if (GeometryUtils.isGeography(firstGeometry) != GeometryUtils.isGeography(secondGeometry)) {
+      throw new RuntimeException("The first and second arguments shall either all be geometry or all geography");
+    }
+    if (GeometryUtils.isGeography(firstGeometry)) {
+      return StDistanceFunction.sphericalDistance(firstGeometry, secondGeometry);
+    } else {
+      return firstGeometry.isEmpty() || secondGeometry.isEmpty() ? Double.NaN : firstGeometry.distance(secondGeometry);
+    }
+  }
 }
diff --git a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StDistanceFunction.java b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StDistanceFunction.java
index 1802d7698a..b774b93287 100644
--- a/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StDistanceFunction.java
+++ b/pinot-core/src/main/java/org/apache/pinot/core/geospatial/transform/function/StDistanceFunction.java
@@ -75,7 +75,7 @@ public class StDistanceFunction extends BaseBinaryGeoTransformFunction {
         "Longitude must be between -180 and 180");
   }
 
-  private static double sphericalDistance(Geometry leftGeometry, Geometry rightGeometry) {
+  public static double sphericalDistance(Geometry leftGeometry, Geometry rightGeometry) {
     Preconditions.checkArgument(leftGeometry instanceof Point, "The left argument must be a point");
     Preconditions.checkArgument(rightGeometry instanceof Point, "The right argument must be a point");
     Point leftPoint = (Point) leftGeometry;
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 3ce9abba8b..45a0a55508 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
@@ -49,6 +49,7 @@ public class LiteralTransformFunction implements TransformFunction {
   private final float _floatLiteral;
   private final double _doubleLiteral;
   private final BigDecimal _bigDecimalLiteral;
+  private final byte[] _bytesLiteral;
 
   // literals may be shared but values are intentionally not volatile as assignment races are benign
   private int[] _intResult;
@@ -68,6 +69,7 @@ public class LiteralTransformFunction implements TransformFunction {
     _longLiteral = _bigDecimalLiteral.longValue();
     _floatLiteral = _bigDecimalLiteral.floatValue();
     _doubleLiteral = _bigDecimalLiteral.doubleValue();
+    _bytesLiteral = (_dataType == DataType.BYTES) ? (byte[]) _literal : null;
   }
 
   public boolean getBooleanLiteral() {
@@ -98,6 +100,10 @@ public class LiteralTransformFunction implements TransformFunction {
     return String.valueOf(_literal);
   }
 
+  public byte[] getBytesLiteral() {
+    return (_bytesLiteral != null) ? _bytesLiteral : BytesUtils.toBytes(getStringLiteral());
+  }
+
   @Override
   public String getName() {
     return FUNCTION_NAME;
@@ -222,7 +228,7 @@ public class LiteralTransformFunction implements TransformFunction {
     if (bytesResult == null || bytesResult.length < numDocs) {
       bytesResult = new byte[numDocs][];
       // TODO: Handle null literal
-      Arrays.fill(bytesResult, BytesUtils.toBytes(getStringLiteral()));
+      Arrays.fill(bytesResult, getBytesLiteral());
       _bytesResult = bytesResult;
     }
     return bytesResult;
diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
index d9ee8b3a49..826240ef36 100644
--- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
+++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/MultiStageEngineIntegrationTest.java
@@ -455,7 +455,7 @@ public class MultiStageEngineIntegrationTest extends BaseClusterIntegrationTestS
     // invalid argument
     sqlQuery = "SELECT fromBase64('hello!') FROM mytable";
     response = postQuery(sqlQuery);
-    assertTrue(response.get("exceptions").get(0).get("message").toString().contains("IllegalArgumentException"));
+    assertTrue(response.get("exceptions").get(0).get("message").toString().contains("Illegal base64 character"));
 
     // string literal used in a filter
     sqlQuery = "SELECT * FROM mytable WHERE fromUtf8(fromBase64('aGVsbG8h')) != Carrier AND "
diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
new file mode 100644
index 0000000000..7459dc18ec
--- /dev/null
+++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotEvaluateLiteralRule.java
@@ -0,0 +1,225 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.calcite.rel.rules;
+
+import com.google.common.base.Preconditions;
+import java.math.BigDecimal;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+import org.apache.calcite.avatica.util.ByteString;
+import org.apache.calcite.plan.RelOptRule;
+import org.apache.calcite.plan.RelOptRuleCall;
+import org.apache.calcite.rel.RelNode;
+import org.apache.calcite.rel.RelVisitor;
+import org.apache.calcite.rel.core.Project;
+import org.apache.calcite.rel.logical.LogicalProject;
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rex.RexBuilder;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.rex.RexLiteral;
+import org.apache.calcite.rex.RexNode;
+import org.apache.calcite.rex.RexShuttle;
+import org.apache.calcite.sql.type.SqlTypeName;
+import org.apache.calcite.tools.RelBuilderFactory;
+import org.apache.calcite.util.NlsString;
+import org.apache.calcite.util.TimestampString;
+import org.apache.pinot.common.function.FunctionInfo;
+import org.apache.pinot.common.function.FunctionInvoker;
+import org.apache.pinot.common.function.FunctionRegistry;
+import org.apache.pinot.spi.utils.TimestampUtils;
+import org.apache.pinot.sql.parsers.SqlCompilationException;
+
+
+/**
+ * SingleValueAggregateRemoveRule that matches an Aggregate function SINGLE_VALUE and remove it
+ *
+ */
+public class PinotEvaluateLiteralRule extends RelOptRule {
+  public static final PinotEvaluateLiteralRule INSTANCE =
+      new PinotEvaluateLiteralRule(PinotRuleUtils.PINOT_REL_FACTORY);
+
+  public PinotEvaluateLiteralRule(RelBuilderFactory factory) {
+    super(operand(RelNode.class, any()), factory, null);
+  }
+
+  @Override
+  public boolean matches(RelOptRuleCall call) {
+    // Traverse the relational expression using a RexShuttle visitor
+    AtomicBoolean hasLiteralOnlyCall = new AtomicBoolean(false);
+    try {
+      (new RelVisitor() {
+        @Override
+        public void visit(RelNode node, int ordinal, RelNode parent) {
+          // Check if all operands are RexLiteral
+          if (node.getInputs().stream().allMatch(operand -> (operand instanceof RexLiteral))) {
+            // If all operands are literals, this call can be evaluated
+            hasLiteralOnlyCall.set(true);
+            // early terminate if we found one evaluate call
+            throw new RuntimeException("Found one literal only call");
+          }
+          for (RelNode input : node.getInputs()) {
+            visit(input, ordinal, node);
+          }
+        }
+      }).go(call.rel(0));
+    } catch (RuntimeException e) {
+      // Found one literal only call
+    }
+    return hasLiteralOnlyCall.get();
+  }
+
+  @Override
+  public void onMatch(RelOptRuleCall call) {
+    RelNode rootRelNode = call.rel(0);
+    RexBuilder rexBuilder = rootRelNode.getCluster().getRexBuilder();
+    Map<RexNode, RexNode> evaluatedResults = new HashMap<>();
+
+    // Recursively evaluate all the calls with Literal only operands from bottom up
+    // Traverse the relational expression using a RexShuttle visitor
+    RelNode newRelNode = rootRelNode.accept(new RexShuttle() {
+      @Override
+      public RexNode visitCall(RexCall call) {
+        // Check if all operands are RexLiteral
+        if (call.operands.stream().allMatch(operand -> operand instanceof RexLiteral)) {
+          // If all operands are literals or already evaluated, this call can be evaluated
+          return evaluateLiteralOnlyFunction(rexBuilder, call, evaluatedResults);
+        }
+        List<RexNode> newOperands = call.operands.stream().map(operand -> {
+          if (operand instanceof RexCall) {
+            return visitCall((RexCall) operand);
+          }
+          return operand;
+        }).collect(Collectors.toList());
+        return call.clone(call.getType(), newOperands);
+      }
+    });
+    if (newRelNode instanceof Project) {
+      newRelNode = constructNewProject(rexBuilder, (Project) rootRelNode, (Project) newRelNode);
+    }
+    call.transformTo(newRelNode);
+  }
+
+  private RelNode constructNewProject(RexBuilder rexBuilder, Project oldProjectNode, Project newProjectNode) {
+    List<RexNode> oldProjects = oldProjectNode.getProjects();
+    List<RexNode> newProjects = new ArrayList<>();
+    for (int i = 0; i < oldProjects.size(); i++) {
+      RexNode oldProject = oldProjects.get(i);
+      RexNode newProject = newProjectNode.getProjects().get(i);
+      // Need to cast the result to the original type if the literal type is changed, e.g. VARCHAR literal is typed as
+      // CHAR(STRING_LENGTH) in Calcite, but we need to cast it back to VARCHAR.
+      newProject = (newProject.getType() == oldProject.getType()) ? newProject
+          : rexBuilder.makeCast(oldProject.getType(), newProject, true);
+      newProjects.add(newProject);
+    }
+    return LogicalProject.create(oldProjectNode.getInput(), oldProjectNode.getHints(), newProjects,
+        oldProjectNode.getRowType());
+  }
+
+  /**
+   * Evaluates the literal only function and returns the result as a RexLiteral, null if the function cannot be
+   * evaluated.
+   */
+  protected static RexNode evaluateLiteralOnlyFunction(RexBuilder rexBuilder, RexNode rexNode,
+      Map<RexNode, RexNode> evaluatedResults) {
+    if (rexNode instanceof RexLiteral) {
+      return rexNode;
+    }
+    Preconditions.checkArgument(rexNode instanceof RexCall, "Expected RexCall, got: " + rexNode);
+    RexNode resultRexNode = evaluatedResults.get(rexNode);
+    if (resultRexNode != null) {
+      return resultRexNode;
+    }
+    RexCall function = (RexCall) rexNode;
+    List<RexNode> operands = new ArrayList<>(function.getOperands());
+    int numOperands = operands.size();
+    for (int i = 0; i < numOperands; i++) {
+      // The RexCall is guaranteed to have all operands as RexLiteral or evaluated as RexLiteral.
+      // So recursively call evaluateLiteralOnlyFunction on all operands.
+      RexNode operand = evaluateLiteralOnlyFunction(rexBuilder, operands.get(i), evaluatedResults);
+      operands.set(i, operand);
+    }
+
+    String functionName = PinotRuleUtils.extractFunctionName(function);
+    FunctionInfo functionInfo = FunctionRegistry.getFunctionInfo(functionName, numOperands);
+    resultRexNode = rexNode;
+    if (functionInfo != null) {
+      Object[] arguments = new Object[numOperands];
+      for (int i = 0; i < numOperands; i++) {
+        RexNode operand = function.getOperands().get(i);
+        Preconditions.checkArgument(operand instanceof RexLiteral, "Expected all the operands to be RexLiteral");
+        Object value = ((RexLiteral) operand).getValue();
+        if (value instanceof NlsString) {
+          arguments[i] = ((NlsString) value).getValue();
+        } else if (value instanceof GregorianCalendar) {
+          arguments[i] = ((GregorianCalendar) value).getTimeInMillis();
+        } else if (value instanceof ByteString) {
+          arguments[i] = ((ByteString) value).getBytes();
+        } else {
+          arguments[i] = value;
+        }
+      }
+      RelDataType rexNodeType = rexNode.getType();
+      Object functionResult;
+      try {
+        FunctionInvoker invoker = new FunctionInvoker(functionInfo);
+        invoker.convertTypes(arguments);
+        functionResult = invoker.invoke(arguments);
+      } catch (Exception e) {
+        throw new SqlCompilationException(
+            "Caught exception while invoking method: " + functionInfo.getMethod() + " with arguments: "
+                + Arrays.toString(arguments), e);
+      }
+      if (functionResult == null) {
+        resultRexNode = rexBuilder.makeNullLiteral(rexNodeType);
+      } else if (rexNodeType.getSqlTypeName() == SqlTypeName.TIMESTAMP) {
+        long millis;
+        if (functionResult instanceof Timestamp) {
+          millis = ((Timestamp) functionResult).getTime();
+        } else if (functionResult instanceof Number) {
+          millis = ((Number) functionResult).longValue();
+        } else {
+          millis = TimestampUtils.toMillisSinceEpoch(functionResult.toString());
+        }
+        resultRexNode =
+            rexBuilder.makeTimestampLiteral(TimestampString.fromMillisSinceEpoch(millis), rexNodeType.getPrecision());
+      } else if (functionResult instanceof Byte || functionResult instanceof Short || functionResult instanceof Integer
+          || functionResult instanceof Long) {
+        resultRexNode =
+            rexBuilder.makeExactLiteral(BigDecimal.valueOf(((Number) functionResult).longValue()), rexNodeType);
+      } else if (functionResult instanceof Float || functionResult instanceof Double) {
+        resultRexNode = rexBuilder.makeExactLiteral(new BigDecimal(functionResult.toString()), rexNodeType);
+      } else if (functionResult instanceof BigDecimal) {
+        resultRexNode = rexBuilder.makeExactLiteral((BigDecimal) functionResult, rexNodeType);
+      } else if (functionResult instanceof byte[]) {
+        resultRexNode = rexBuilder.makeLiteral(new ByteString((byte[]) functionResult), rexNodeType, false);
+      } else {
+        resultRexNode = rexBuilder.makeLiteral(functionResult, rexNodeType, false);
+      }
+    }
+    evaluatedResults.put(rexNode, resultRexNode);
+    return resultRexNode;
+  }
+}
diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
index 31edc5a58f..7a533e95d7 100644
--- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
+++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotQueryRuleSets.java
@@ -66,6 +66,8 @@ public class PinotQueryRuleSets {
           // push project through WINDOW
           CoreRules.PROJECT_WINDOW_TRANSPOSE,
 
+          PinotEvaluateLiteralRule.INSTANCE,
+
           // TODO: evaluate the SORT_JOIN_TRANSPOSE and SORT_JOIN_COPY rules
 
           // join rules
diff --git a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotRuleUtils.java b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotRuleUtils.java
index 530704750f..24f1820229 100644
--- a/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotRuleUtils.java
+++ b/pinot-query-planner/src/main/java/org/apache/calcite/rel/rules/PinotRuleUtils.java
@@ -26,6 +26,8 @@ import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Join;
 import org.apache.calcite.rel.core.Project;
 import org.apache.calcite.rel.core.RelFactories;
+import org.apache.calcite.rex.RexCall;
+import org.apache.calcite.sql.SqlKind;
 import org.apache.calcite.tools.RelBuilder;
 import org.apache.calcite.tools.RelBuilderFactory;
 
@@ -80,4 +82,9 @@ public class PinotRuleUtils {
     }
     return true;
   }
+
+  public static String extractFunctionName(RexCall function) {
+    SqlKind funcSqlKind = function.getOperator().getKind();
+    return funcSqlKind == SqlKind.OTHER_FUNCTION ? function.getOperator().getName() : funcSqlKind.name();
+  }
 }
diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/LiteralHintUtils.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/LiteralHintUtils.java
index 166a2fdcd3..ea854e9aba 100644
--- a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/LiteralHintUtils.java
+++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/LiteralHintUtils.java
@@ -26,6 +26,7 @@ import org.apache.calcite.util.Pair;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.pinot.common.request.Literal;
 import org.apache.pinot.spi.data.FieldSpec;
+import org.apache.pinot.spi.utils.BytesUtils;
 
 
 public class LiteralHintUtils {
@@ -75,6 +76,8 @@ public class LiteralHintUtils {
         return Literal.doubleValue(Double.parseDouble(valueStr));
       case STRING:
         return Literal.stringValue(valueStr);
+      case BYTES:
+        return Literal.binaryValue(BytesUtils.toBytes(valueStr));
       default:
         throw new UnsupportedOperationException("Unsupported RexLiteral type: " + dataTypeStr);
     }
diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java
index fd52b32154..0cb443fecc 100644
--- a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java
+++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/RexExpressionUtils.java
@@ -26,6 +26,7 @@ import java.util.GregorianCalendar;
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
+import org.apache.calcite.avatica.util.ByteString;
 import org.apache.calcite.rel.core.AggregateCall;
 import org.apache.calcite.rel.type.RelDataType;
 import org.apache.calcite.rex.RexCall;
@@ -85,6 +86,8 @@ public class RexExpressionUtils {
         return ((GregorianCalendar) value).getTimeInMillis();
       case STRING:
         return ((NlsString) value).getValue();
+      case BYTES:
+        return ((ByteString) value).getBytes();
       default:
         return value;
     }
diff --git a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/serde/ProtoSerializationUtils.java b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/serde/ProtoSerializationUtils.java
index d0d3b1dc3e..c213d4964a 100644
--- a/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/serde/ProtoSerializationUtils.java
+++ b/pinot-query-planner/src/main/java/org/apache/pinot/query/planner/serde/ProtoSerializationUtils.java
@@ -19,8 +19,10 @@
 package org.apache.pinot.query.planner.serde;
 
 import com.google.common.base.Preconditions;
+import com.google.protobuf.ByteString;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
+import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -127,6 +129,10 @@ public class ProtoSerializationUtils {
     return Plan.LiteralField.newBuilder().setStringField(val).build();
   }
 
+  private static Plan.LiteralField bytesField(ByteString val) {
+    return Plan.LiteralField.newBuilder().setBytesField(val).build();
+  }
+
   private static Plan.MemberVariableField serializeMemberVariable(Object fieldObject) {
     Plan.MemberVariableField.Builder builder = Plan.MemberVariableField.newBuilder();
     if (fieldObject instanceof Boolean) {
@@ -141,6 +147,10 @@ public class ProtoSerializationUtils {
       builder.setLiteralField(doubleField((Double) fieldObject));
     } else if (fieldObject instanceof String) {
       builder.setLiteralField(stringField((String) fieldObject));
+    } else if (fieldObject instanceof byte[]) {
+      builder.setLiteralField(bytesField(ByteString.copyFrom((byte[]) fieldObject)));
+    } else if (fieldObject instanceof GregorianCalendar) {
+      builder.setLiteralField(longField(((GregorianCalendar) fieldObject).getTimeInMillis()));
     } else if (fieldObject instanceof List) {
       builder.setListField(serializeListMemberVariable(fieldObject));
     } else if (fieldObject instanceof Map) {
@@ -204,6 +214,8 @@ public class ProtoSerializationUtils {
         return literalField.getDoubleField();
       case STRINGFIELD:
         return literalField.getStringField();
+      case BYTESFIELD:
+        return literalField.getBytesField();
       case LITERALFIELD_NOT_SET:
       default:
         return null;
diff --git a/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json b/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
new file mode 100644
index 0000000000..4a29d734cb
--- /dev/null
+++ b/pinot-query-planner/src/test/resources/queries/LiteralEvaluationPlans.json
@@ -0,0 +1,161 @@
+{
+  "literal_evaluation_tests": {
+    "queries": [
+      {
+        "description": "Select arithmetic expression",
+        "sql": "EXPLAIN PLAN FOR SELECT 5*6,5+6 FROM d",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[30.0], EXPR$1=[11.0])",
+          "\n  LogicalTableScan(table=[[d]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Select fromdatetime function",
+        "sql": "EXPLAIN PLAN FOR SELECT FROMDATETIME( '1997-02-01 00:00:00', 'yyyy-MM-dd HH:mm:ss') FROM d",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[1997-02-01 00:00:00])",
+          "\n  LogicalTableScan(table=[[d]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Select two level function to one literal",
+        "sql": "EXPLAIN PLAN FOR SELECT dateTrunc('MONTH', FROMDATETIME( '1997-02-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')) FROM d",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[CAST(854755200000:BIGINT):BIGINT])",
+          "\n  LogicalTableScan(table=[[d]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Eval inner function to literal",
+        "sql": "EXPLAIN PLAN FOR SELECT timestampDiff(DAY, CAST(ts as TIMESTAMP), CAST(dateTrunc('MONTH', FROMDATETIME('1997-02-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')) as TIMESTAMP)) FROM d",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[TIMESTAMPDIFF(FLAG(DAY), CAST($6):TIMESTAMP(0) NOT NULL, CAST(854755200000:BIGINT):TIMESTAMP(0))])",
+          "\n  LogicalTableScan(table=[[d]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Select fromdatetime function in where clause",
+        "sql": "EXPLAIN PLAN FOR SELECT * FROM d WHERE CAST(ts AS TIMESTAMP) = FROMDATETIME('2019-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss')",
+        "output": [
+          "Execution Plan",
+          "\nLogicalFilter(condition=[=(CAST($6):TIMESTAMP(0) NOT NULL, 2019-01-01 00:00:00)])",
+          "\n  LogicalTableScan(table=[[d]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Select with dateTrunc literal function",
+        "sql": "EXPLAIN PLAN FOR SELECT dateTrunc('MONTH', 854755200000) AS day FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(day=[CAST(854755200000:BIGINT):BIGINT])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "Eval Filter literal function",
+        "sql": "EXPLAIN PLAN FOR SELECT * FROM a WHERE  dateTrunc('MONTH', ts) =  dateTrunc('MONTH', FROMDATETIME('2019-01-01 00:00:00', 'yyyy-MM-dd HH:mm:ss'))",
+        "output": [
+          "Execution Plan",
+          "\nLogicalFilter(condition=[=(DATETRUNC('MONTH', $6), 1546300800000)])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "upper case literal function",
+        "sql": "EXPLAIN PLAN FOR SELECT upper('month') FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=['MONTH'])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "concat literal function",
+        "sql": "EXPLAIN PLAN FOR SELECT concat('month', ' 1') FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[CAST('month 1':VARCHAR):VARCHAR])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "substr literal function",
+        "sql": "EXPLAIN PLAN FOR SELECT substr('month',2) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[CAST('nth':VARCHAR):VARCHAR])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "chained string functions on literal",
+        "sql": "EXPLAIN PLAN FOR SELECT upper(lower(upper(substr('month',2)))) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[CAST('NTH':VARCHAR):VARCHAR])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "geoToH3 functions",
+        "sql": "EXPLAIN PLAN FOR Select geoToH3(ST_point(20,102),5) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[599041711439609855:BIGINT])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "geoToH3 functions",
+        "sql": "EXPLAIN PLAN FOR Select ST_Point(20, 10, 1) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[X'8040340000000000004024000000000000':VARBINARY])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "St distance with two bytes literals",
+        "sql": "EXPLAIN PLAN FOR Select ST_Distance(X'8040340000000000004024000000000000', ST_Point(-122, 37.5, 1)) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[13416951.966757335:DOUBLE])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "select literal with big decimal",
+        "sql": "EXPLAIN PLAN FOR SELECT CAST('12345678901234567890123456789.1234567890123456789' AS DECIMAL) FROM a",
+        "output": [
+          "Execution Plan",
+          "\nLogicalProject(EXPR$0=[12345678901234567890123456789.1234567890123456789:DECIMAL(1000, 0)])",
+          "\n  LogicalTableScan(table=[[a]])",
+          "\n"
+        ]
+      },
+      {
+        "description": "select non-exist literal function",
+        "sql": "EXPLAIN PLAN FOR Select nonExistFun(1,2) FROM a",
+        "expectedException": "Error explain query plan for.*"
+      }
+    ]
+  }
+}


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