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

jackie 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 1a476dea72 Add TableSegmentsInfo to Thrift and Proto broker/server 
messages (#15573)
1a476dea72 is described below

commit 1a476dea72ebf1c15e14ded28ae60c385f71b2c3
Author: Rajat Venkatesh <1638298+vra...@users.noreply.github.com>
AuthorDate: Wed Apr 30 06:48:25 2025 +0530

    Add TableSegmentsInfo to Thrift and Proto broker/server messages (#15573)
---
 .../apache/pinot/common/request/BrokerRequest.java |   4 +-
 .../apache/pinot/common/request/DataSource.java    |   4 +-
 .../apache/pinot/common/request/Expression.java    |   4 +-
 .../pinot/common/request/ExpressionType.java       |   4 +-
 .../org/apache/pinot/common/request/Function.java  |   4 +-
 .../apache/pinot/common/request/Identifier.java    |   4 +-
 .../pinot/common/request/InstanceRequest.java      | 237 +++++--
 .../java/org/apache/pinot/common/request/Join.java |   4 +-
 .../org/apache/pinot/common/request/JoinType.java  |   4 +-
 .../org/apache/pinot/common/request/Literal.java   |   4 +-
 .../apache/pinot/common/request/PinotQuery.java    |   4 +-
 .../apache/pinot/common/request/QuerySource.java   |   4 +-
 .../pinot/common/request/TableSegmentsInfo.java    | 708 +++++++++++++++++++++
 .../pinot/common/response/ProcessingException.java |   4 +-
 pinot-common/src/main/proto/server.proto           |   8 +
 pinot-common/src/thrift/request.thrift             |   7 +
 .../core/query/request/ServerQueryRequest.java     |  32 +
 .../request/context/TableSegmentsContext.java      |  46 ++
 18 files changed, 1024 insertions(+), 62 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 f85c6c7470..a12401620e 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 8451397162..5bbd0e25d0 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 58c2a3bbb1..5ac0c55b2e 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 fd209646e4..f2070dd91f 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 public enum ExpressionType implements org.apache.thrift.TEnum {
   LITERAL(0),
   IDENTIFIER(1),
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 b493d73b9a..d7400ef53b 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 ad06e69bb9..1cd194fac2 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 3ea150fd54..79ac876ba1 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
@@ -36,6 +36,7 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
   private static final org.apache.thrift.protocol.TField BROKER_ID_FIELD_DESC 
= new org.apache.thrift.protocol.TField("brokerId", 
org.apache.thrift.protocol.TType.STRING, (short)5);
   private static final org.apache.thrift.protocol.TField 
OPTIONAL_SEGMENTS_FIELD_DESC = new 
org.apache.thrift.protocol.TField("optionalSegments", 
org.apache.thrift.protocol.TType.LIST, (short)6);
   private static final org.apache.thrift.protocol.TField CID_FIELD_DESC = new 
org.apache.thrift.protocol.TField("cid", 
org.apache.thrift.protocol.TType.STRING, (short)7);
+  private static final org.apache.thrift.protocol.TField 
TABLE_SEGMENTS_INFO_LIST_FIELD_DESC = new 
org.apache.thrift.protocol.TField("tableSegmentsInfoList", 
org.apache.thrift.protocol.TType.LIST, (short)8);
 
   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();
@@ -47,6 +48,7 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
   private @org.apache.thrift.annotation.Nullable java.lang.String brokerId; // 
optional
   private @org.apache.thrift.annotation.Nullable 
java.util.List<java.lang.String> optionalSegments; // optional
   private @org.apache.thrift.annotation.Nullable java.lang.String cid; // 
optional
+  private @org.apache.thrift.annotation.Nullable 
java.util.List<TableSegmentsInfo> tableSegmentsInfoList; // 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 {
@@ -56,7 +58,8 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     ENABLE_TRACE((short)4, "enableTrace"),
     BROKER_ID((short)5, "brokerId"),
     OPTIONAL_SEGMENTS((short)6, "optionalSegments"),
-    CID((short)7, "cid");
+    CID((short)7, "cid"),
+    TABLE_SEGMENTS_INFO_LIST((short)8, "tableSegmentsInfoList");
 
     private static final java.util.Map<java.lang.String, _Fields> byName = new 
java.util.HashMap<java.lang.String, _Fields>();
 
@@ -86,6 +89,8 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           return OPTIONAL_SEGMENTS;
         case 7: // CID
           return CID;
+        case 8: // TABLE_SEGMENTS_INFO_LIST
+          return TABLE_SEGMENTS_INFO_LIST;
         default:
           return null;
       }
@@ -132,7 +137,7 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
   private static final int __REQUESTID_ISSET_ID = 0;
   private static final int __ENABLETRACE_ISSET_ID = 1;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = 
{_Fields.SEARCH_SEGMENTS,_Fields.ENABLE_TRACE,_Fields.BROKER_ID,_Fields.OPTIONAL_SEGMENTS,_Fields.CID};
+  private static final _Fields optionals[] = 
{_Fields.SEARCH_SEGMENTS,_Fields.ENABLE_TRACE,_Fields.BROKER_ID,_Fields.OPTIONAL_SEGMENTS,_Fields.CID,_Fields.TABLE_SEGMENTS_INFO_LIST};
   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);
@@ -152,6 +157,9 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
             new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
     tmpMap.put(_Fields.CID, new 
org.apache.thrift.meta_data.FieldMetaData("cid", 
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.TABLE_SEGMENTS_INFO_LIST, new 
org.apache.thrift.meta_data.FieldMetaData("tableSegmentsInfoList", 
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,
 TableSegmentsInfo.class))));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(InstanceRequest.class,
 metaDataMap);
   }
@@ -193,6 +201,13 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     if (other.isSetCid()) {
       this.cid = other.cid;
     }
+    if (other.isSetTableSegmentsInfoList()) {
+      java.util.List<TableSegmentsInfo> __this__tableSegmentsInfoList = new 
java.util.ArrayList<TableSegmentsInfo>(other.tableSegmentsInfoList.size());
+      for (TableSegmentsInfo other_element : other.tableSegmentsInfoList) {
+        __this__tableSegmentsInfoList.add(new 
TableSegmentsInfo(other_element));
+      }
+      this.tableSegmentsInfoList = __this__tableSegmentsInfoList;
+    }
   }
 
   @Override
@@ -211,6 +226,7 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     this.brokerId = null;
     this.optionalSegments = null;
     this.cid = null;
+    this.tableSegmentsInfoList = null;
   }
 
   public long getRequestId() {
@@ -409,6 +425,46 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     }
   }
 
+  public int getTableSegmentsInfoListSize() {
+    return (this.tableSegmentsInfoList == null) ? 0 : 
this.tableSegmentsInfoList.size();
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.Iterator<TableSegmentsInfo> 
getTableSegmentsInfoListIterator() {
+    return (this.tableSegmentsInfoList == null) ? null : 
this.tableSegmentsInfoList.iterator();
+  }
+
+  public void addToTableSegmentsInfoList(TableSegmentsInfo elem) {
+    if (this.tableSegmentsInfoList == null) {
+      this.tableSegmentsInfoList = new 
java.util.ArrayList<TableSegmentsInfo>();
+    }
+    this.tableSegmentsInfoList.add(elem);
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.List<TableSegmentsInfo> getTableSegmentsInfoList() {
+    return this.tableSegmentsInfoList;
+  }
+
+  public void setTableSegmentsInfoList(@org.apache.thrift.annotation.Nullable 
java.util.List<TableSegmentsInfo> tableSegmentsInfoList) {
+    this.tableSegmentsInfoList = tableSegmentsInfoList;
+  }
+
+  public void unsetTableSegmentsInfoList() {
+    this.tableSegmentsInfoList = null;
+  }
+
+  /** Returns true if field tableSegmentsInfoList is set (has been assigned a 
value) and false otherwise */
+  public boolean isSetTableSegmentsInfoList() {
+    return this.tableSegmentsInfoList != null;
+  }
+
+  public void setTableSegmentsInfoListIsSet(boolean value) {
+    if (!value) {
+      this.tableSegmentsInfoList = null;
+    }
+  }
+
   @Override
   public void setFieldValue(_Fields field, 
@org.apache.thrift.annotation.Nullable java.lang.Object value) {
     switch (field) {
@@ -468,6 +524,14 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       }
       break;
 
+    case TABLE_SEGMENTS_INFO_LIST:
+      if (value == null) {
+        unsetTableSegmentsInfoList();
+      } else {
+        setTableSegmentsInfoList((java.util.List<TableSegmentsInfo>)value);
+      }
+      break;
+
     }
   }
 
@@ -496,6 +560,9 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     case CID:
       return getCid();
 
+    case TABLE_SEGMENTS_INFO_LIST:
+      return getTableSegmentsInfoList();
+
     }
     throw new java.lang.IllegalStateException();
   }
@@ -522,6 +589,8 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       return isSetOptionalSegments();
     case CID:
       return isSetCid();
+    case TABLE_SEGMENTS_INFO_LIST:
+      return isSetTableSegmentsInfoList();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -602,6 +671,15 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
         return false;
     }
 
+    boolean this_present_tableSegmentsInfoList = true && 
this.isSetTableSegmentsInfoList();
+    boolean that_present_tableSegmentsInfoList = true && 
that.isSetTableSegmentsInfoList();
+    if (this_present_tableSegmentsInfoList || 
that_present_tableSegmentsInfoList) {
+      if (!(this_present_tableSegmentsInfoList && 
that_present_tableSegmentsInfoList))
+        return false;
+      if (!this.tableSegmentsInfoList.equals(that.tableSegmentsInfoList))
+        return false;
+    }
+
     return true;
   }
 
@@ -635,6 +713,10 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
     if (isSetCid())
       hashCode = hashCode * 8191 + cid.hashCode();
 
+    hashCode = hashCode * 8191 + ((isSetTableSegmentsInfoList()) ? 131071 : 
524287);
+    if (isSetTableSegmentsInfoList())
+      hashCode = hashCode * 8191 + tableSegmentsInfoList.hashCode();
+
     return hashCode;
   }
 
@@ -716,6 +798,16 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
         return lastComparison;
       }
     }
+    lastComparison = java.lang.Boolean.compare(isSetTableSegmentsInfoList(), 
other.isSetTableSegmentsInfoList());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTableSegmentsInfoList()) {
+      lastComparison = 
org.apache.thrift.TBaseHelper.compareTo(this.tableSegmentsInfoList, 
other.tableSegmentsInfoList);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -797,6 +889,16 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       }
       first = false;
     }
+    if (isSetTableSegmentsInfoList()) {
+      if (!first) sb.append(", ");
+      sb.append("tableSegmentsInfoList:");
+      if (this.tableSegmentsInfoList == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.tableSegmentsInfoList);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -875,13 +977,13 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           case 3: // SEARCH_SEGMENTS
             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list0 = 
iprot.readListBegin();
-                struct.searchSegments = new 
java.util.ArrayList<java.lang.String>(_list0.size);
-                @org.apache.thrift.annotation.Nullable java.lang.String _elem1;
-                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+                org.apache.thrift.protocol.TList _list16 = 
iprot.readListBegin();
+                struct.searchSegments = new 
java.util.ArrayList<java.lang.String>(_list16.size);
+                @org.apache.thrift.annotation.Nullable java.lang.String 
_elem17;
+                for (int _i18 = 0; _i18 < _list16.size; ++_i18)
                 {
-                  _elem1 = iprot.readString();
-                  struct.searchSegments.add(_elem1);
+                  _elem17 = iprot.readString();
+                  struct.searchSegments.add(_elem17);
                 }
                 iprot.readListEnd();
               }
@@ -909,13 +1011,13 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           case 6: // OPTIONAL_SEGMENTS
             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list3 = 
iprot.readListBegin();
-                struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list3.size);
-                @org.apache.thrift.annotation.Nullable java.lang.String _elem4;
-                for (int _i5 = 0; _i5 < _list3.size; ++_i5)
+                org.apache.thrift.protocol.TList _list19 = 
iprot.readListBegin();
+                struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list19.size);
+                @org.apache.thrift.annotation.Nullable java.lang.String 
_elem20;
+                for (int _i21 = 0; _i21 < _list19.size; ++_i21)
                 {
-                  _elem4 = iprot.readString();
-                  struct.optionalSegments.add(_elem4);
+                  _elem20 = iprot.readString();
+                  struct.optionalSegments.add(_elem20);
                 }
                 iprot.readListEnd();
               }
@@ -932,6 +1034,25 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
             }
             break;
+          case 8: // TABLE_SEGMENTS_INFO_LIST
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list22 = 
iprot.readListBegin();
+                struct.tableSegmentsInfoList = new 
java.util.ArrayList<TableSegmentsInfo>(_list22.size);
+                @org.apache.thrift.annotation.Nullable TableSegmentsInfo 
_elem23;
+                for (int _i24 = 0; _i24 < _list22.size; ++_i24)
+                {
+                  _elem23 = new TableSegmentsInfo();
+                  _elem23.read(iprot);
+                  struct.tableSegmentsInfoList.add(_elem23);
+                }
+                iprot.readListEnd();
+              }
+              struct.setTableSegmentsInfoListIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
         }
@@ -959,9 +1080,9 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           oprot.writeFieldBegin(SEARCH_SEGMENTS_FIELD_DESC);
           {
             oprot.writeListBegin(new 
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, 
struct.searchSegments.size()));
-            for (java.lang.String _iter6 : struct.searchSegments)
+            for (java.lang.String _iter25 : struct.searchSegments)
             {
-              oprot.writeString(_iter6);
+              oprot.writeString(_iter25);
             }
             oprot.writeListEnd();
           }
@@ -985,9 +1106,9 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           oprot.writeFieldBegin(OPTIONAL_SEGMENTS_FIELD_DESC);
           {
             oprot.writeListBegin(new 
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, 
struct.optionalSegments.size()));
-            for (java.lang.String _iter7 : struct.optionalSegments)
+            for (java.lang.String _iter26 : struct.optionalSegments)
             {
-              oprot.writeString(_iter7);
+              oprot.writeString(_iter26);
             }
             oprot.writeListEnd();
           }
@@ -1001,6 +1122,20 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
           oprot.writeFieldEnd();
         }
       }
+      if (struct.tableSegmentsInfoList != null) {
+        if (struct.isSetTableSegmentsInfoList()) {
+          oprot.writeFieldBegin(TABLE_SEGMENTS_INFO_LIST_FIELD_DESC);
+          {
+            oprot.writeListBegin(new 
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, 
struct.tableSegmentsInfoList.size()));
+            for (TableSegmentsInfo _iter27 : struct.tableSegmentsInfoList)
+            {
+              _iter27.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -1037,13 +1172,16 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       if (struct.isSetCid()) {
         optionals.set(4);
       }
-      oprot.writeBitSet(optionals, 5);
+      if (struct.isSetTableSegmentsInfoList()) {
+        optionals.set(5);
+      }
+      oprot.writeBitSet(optionals, 6);
       if (struct.isSetSearchSegments()) {
         {
           oprot.writeI32(struct.searchSegments.size());
-          for (java.lang.String _iter8 : struct.searchSegments)
+          for (java.lang.String _iter28 : struct.searchSegments)
           {
-            oprot.writeString(_iter8);
+            oprot.writeString(_iter28);
           }
         }
       }
@@ -1056,15 +1194,24 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       if (struct.isSetOptionalSegments()) {
         {
           oprot.writeI32(struct.optionalSegments.size());
-          for (java.lang.String _iter9 : struct.optionalSegments)
+          for (java.lang.String _iter29 : struct.optionalSegments)
           {
-            oprot.writeString(_iter9);
+            oprot.writeString(_iter29);
           }
         }
       }
       if (struct.isSetCid()) {
         oprot.writeString(struct.cid);
       }
+      if (struct.isSetTableSegmentsInfoList()) {
+        {
+          oprot.writeI32(struct.tableSegmentsInfoList.size());
+          for (TableSegmentsInfo _iter30 : struct.tableSegmentsInfoList)
+          {
+            _iter30.write(oprot);
+          }
+        }
+      }
     }
 
     @Override
@@ -1075,16 +1222,16 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       struct.query = new BrokerRequest();
       struct.query.read(iprot);
       struct.setQueryIsSet(true);
-      java.util.BitSet incoming = iprot.readBitSet(5);
+      java.util.BitSet incoming = iprot.readBitSet(6);
       if (incoming.get(0)) {
         {
-          org.apache.thrift.protocol.TList _list10 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
-          struct.searchSegments = new 
java.util.ArrayList<java.lang.String>(_list10.size);
-          @org.apache.thrift.annotation.Nullable java.lang.String _elem11;
-          for (int _i12 = 0; _i12 < _list10.size; ++_i12)
+          org.apache.thrift.protocol.TList _list31 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
+          struct.searchSegments = new 
java.util.ArrayList<java.lang.String>(_list31.size);
+          @org.apache.thrift.annotation.Nullable java.lang.String _elem32;
+          for (int _i33 = 0; _i33 < _list31.size; ++_i33)
           {
-            _elem11 = iprot.readString();
-            struct.searchSegments.add(_elem11);
+            _elem32 = iprot.readString();
+            struct.searchSegments.add(_elem32);
           }
         }
         struct.setSearchSegmentsIsSet(true);
@@ -1099,13 +1246,13 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
       }
       if (incoming.get(3)) {
         {
-          org.apache.thrift.protocol.TList _list13 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
-          struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list13.size);
-          @org.apache.thrift.annotation.Nullable java.lang.String _elem14;
-          for (int _i15 = 0; _i15 < _list13.size; ++_i15)
+          org.apache.thrift.protocol.TList _list34 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
+          struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list34.size);
+          @org.apache.thrift.annotation.Nullable java.lang.String _elem35;
+          for (int _i36 = 0; _i36 < _list34.size; ++_i36)
           {
-            _elem14 = iprot.readString();
-            struct.optionalSegments.add(_elem14);
+            _elem35 = iprot.readString();
+            struct.optionalSegments.add(_elem35);
           }
         }
         struct.setOptionalSegmentsIsSet(true);
@@ -1114,6 +1261,20 @@ public class InstanceRequest implements 
org.apache.thrift.TBase<InstanceRequest,
         struct.cid = iprot.readString();
         struct.setCidIsSet(true);
       }
+      if (incoming.get(5)) {
+        {
+          org.apache.thrift.protocol.TList _list37 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRUCT);
+          struct.tableSegmentsInfoList = new 
java.util.ArrayList<TableSegmentsInfo>(_list37.size);
+          @org.apache.thrift.annotation.Nullable TableSegmentsInfo _elem38;
+          for (int _i39 = 0; _i39 < _list37.size; ++_i39)
+          {
+            _elem38 = new TableSegmentsInfo();
+            _elem38.read(iprot);
+            struct.tableSegmentsInfoList.add(_elem38);
+          }
+        }
+        struct.setTableSegmentsInfoListIsSet(true);
+      }
     }
   }
 
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 43c22610ab..08559cb92d 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 10f2e73c3b..a4ce68ce16 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 public enum JoinType implements org.apache.thrift.TEnum {
   INNER(0),
   LEFT(1),
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 bd350c2d99..ca15bb5f87 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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);
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 a0802d47d5..5b3d79f076 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.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
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 e9061552b4..f675591b1b 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.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.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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");
 
diff --git 
a/pinot-common/src/main/java/org/apache/pinot/common/request/TableSegmentsInfo.java
 
b/pinot-common/src/main/java/org/apache/pinot/common/request/TableSegmentsInfo.java
new file mode 100644
index 0000000000..8e4b37891d
--- /dev/null
+++ 
b/pinot-common/src/main/java/org/apache/pinot/common/request/TableSegmentsInfo.java
@@ -0,0 +1,708 @@
+/**
+ * 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.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.21.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.pinot.common.request;
+
+@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
+public class TableSegmentsInfo implements 
org.apache.thrift.TBase<TableSegmentsInfo, TableSegmentsInfo._Fields>, 
java.io.Serializable, Cloneable, Comparable<TableSegmentsInfo> {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new 
org.apache.thrift.protocol.TStruct("TableSegmentsInfo");
+
+  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 SEGMENTS_FIELD_DESC = 
new org.apache.thrift.protocol.TField("segments", 
org.apache.thrift.protocol.TType.LIST, (short)2);
+  private static final org.apache.thrift.protocol.TField 
OPTIONAL_SEGMENTS_FIELD_DESC = new 
org.apache.thrift.protocol.TField("optionalSegments", 
org.apache.thrift.protocol.TType.LIST, (short)3);
+
+  private static final org.apache.thrift.scheme.SchemeFactory 
STANDARD_SCHEME_FACTORY = new TableSegmentsInfoStandardSchemeFactory();
+  private static final org.apache.thrift.scheme.SchemeFactory 
TUPLE_SCHEME_FACTORY = new TableSegmentsInfoTupleSchemeFactory();
+
+  private @org.apache.thrift.annotation.Nullable java.lang.String tableName; 
// required
+  private @org.apache.thrift.annotation.Nullable 
java.util.List<java.lang.String> segments; // required
+  private @org.apache.thrift.annotation.Nullable 
java.util.List<java.lang.String> optionalSegments; // 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"),
+    SEGMENTS((short)2, "segments"),
+    OPTIONAL_SEGMENTS((short)3, "optionalSegments");
+
+    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)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not 
found.
+     */
+    @org.apache.thrift.annotation.Nullable
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // TABLE_NAME
+          return TABLE_NAME;
+        case 2: // SEGMENTS
+          return SEGMENTS;
+        case 3: // OPTIONAL_SEGMENTS
+          return OPTIONAL_SEGMENTS;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new java.lang.IllegalArgumentException("Field 
" + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    @org.apache.thrift.annotation.Nullable
+    public static _Fields findByName(java.lang.String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final java.lang.String _fieldName;
+
+    _Fields(short thriftId, java.lang.String fieldName) {
+      _thriftId = thriftId;
+      _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.OPTIONAL_SEGMENTS};
+  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.REQUIRED, 
+        new 
org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.SEGMENTS, new 
org.apache.thrift.meta_data.FieldMetaData("segments", 
org.apache.thrift.TFieldRequirementType.REQUIRED, 
+        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.STRING))));
+    tmpMap.put(_Fields.OPTIONAL_SEGMENTS, new 
org.apache.thrift.meta_data.FieldMetaData("optionalSegments", 
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.STRING))));
+    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
+    
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TableSegmentsInfo.class,
 metaDataMap);
+  }
+
+  public TableSegmentsInfo() {
+  }
+
+  public TableSegmentsInfo(
+    java.lang.String tableName,
+    java.util.List<java.lang.String> segments)
+  {
+    this();
+    this.tableName = tableName;
+    this.segments = segments;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public TableSegmentsInfo(TableSegmentsInfo other) {
+    if (other.isSetTableName()) {
+      this.tableName = other.tableName;
+    }
+    if (other.isSetSegments()) {
+      java.util.List<java.lang.String> __this__segments = new 
java.util.ArrayList<java.lang.String>(other.segments);
+      this.segments = __this__segments;
+    }
+    if (other.isSetOptionalSegments()) {
+      java.util.List<java.lang.String> __this__optionalSegments = new 
java.util.ArrayList<java.lang.String>(other.optionalSegments);
+      this.optionalSegments = __this__optionalSegments;
+    }
+  }
+
+  @Override
+  public TableSegmentsInfo deepCopy() {
+    return new TableSegmentsInfo(this);
+  }
+
+  @Override
+  public void clear() {
+    this.tableName = null;
+    this.segments = null;
+    this.optionalSegments = null;
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.lang.String getTableName() {
+    return this.tableName;
+  }
+
+  public void setTableName(@org.apache.thrift.annotation.Nullable 
java.lang.String tableName) {
+    this.tableName = tableName;
+  }
+
+  public void unsetTableName() {
+    this.tableName = null;
+  }
+
+  /** Returns true if field tableName is set (has been assigned a value) and 
false otherwise */
+  public boolean isSetTableName() {
+    return this.tableName != null;
+  }
+
+  public void setTableNameIsSet(boolean value) {
+    if (!value) {
+      this.tableName = null;
+    }
+  }
+
+  public int getSegmentsSize() {
+    return (this.segments == null) ? 0 : this.segments.size();
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.Iterator<java.lang.String> getSegmentsIterator() {
+    return (this.segments == null) ? null : this.segments.iterator();
+  }
+
+  public void addToSegments(java.lang.String elem) {
+    if (this.segments == null) {
+      this.segments = new java.util.ArrayList<java.lang.String>();
+    }
+    this.segments.add(elem);
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.List<java.lang.String> getSegments() {
+    return this.segments;
+  }
+
+  public void setSegments(@org.apache.thrift.annotation.Nullable 
java.util.List<java.lang.String> segments) {
+    this.segments = segments;
+  }
+
+  public void unsetSegments() {
+    this.segments = null;
+  }
+
+  /** Returns true if field segments is set (has been assigned a value) and 
false otherwise */
+  public boolean isSetSegments() {
+    return this.segments != null;
+  }
+
+  public void setSegmentsIsSet(boolean value) {
+    if (!value) {
+      this.segments = null;
+    }
+  }
+
+  public int getOptionalSegmentsSize() {
+    return (this.optionalSegments == null) ? 0 : this.optionalSegments.size();
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.Iterator<java.lang.String> getOptionalSegmentsIterator() {
+    return (this.optionalSegments == null) ? null : 
this.optionalSegments.iterator();
+  }
+
+  public void addToOptionalSegments(java.lang.String elem) {
+    if (this.optionalSegments == null) {
+      this.optionalSegments = new java.util.ArrayList<java.lang.String>();
+    }
+    this.optionalSegments.add(elem);
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  public java.util.List<java.lang.String> getOptionalSegments() {
+    return this.optionalSegments;
+  }
+
+  public void setOptionalSegments(@org.apache.thrift.annotation.Nullable 
java.util.List<java.lang.String> optionalSegments) {
+    this.optionalSegments = optionalSegments;
+  }
+
+  public void unsetOptionalSegments() {
+    this.optionalSegments = null;
+  }
+
+  /** Returns true if field optionalSegments is set (has been assigned a 
value) and false otherwise */
+  public boolean isSetOptionalSegments() {
+    return this.optionalSegments != null;
+  }
+
+  public void setOptionalSegmentsIsSet(boolean value) {
+    if (!value) {
+      this.optionalSegments = null;
+    }
+  }
+
+  @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 SEGMENTS:
+      if (value == null) {
+        unsetSegments();
+      } else {
+        setSegments((java.util.List<java.lang.String>)value);
+      }
+      break;
+
+    case OPTIONAL_SEGMENTS:
+      if (value == null) {
+        unsetOptionalSegments();
+      } else {
+        setOptionalSegments((java.util.List<java.lang.String>)value);
+      }
+      break;
+
+    }
+  }
+
+  @org.apache.thrift.annotation.Nullable
+  @Override
+  public java.lang.Object getFieldValue(_Fields field) {
+    switch (field) {
+    case TABLE_NAME:
+      return getTableName();
+
+    case SEGMENTS:
+      return getSegments();
+
+    case OPTIONAL_SEGMENTS:
+      return getOptionalSegments();
+
+    }
+    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 SEGMENTS:
+      return isSetSegments();
+    case OPTIONAL_SEGMENTS:
+      return isSetOptionalSegments();
+    }
+    throw new java.lang.IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(java.lang.Object that) {
+    if (that instanceof TableSegmentsInfo)
+      return this.equals((TableSegmentsInfo)that);
+    return false;
+  }
+
+  public boolean equals(TableSegmentsInfo that) {
+    if (that == null)
+      return false;
+    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))
+        return false;
+      if (!this.tableName.equals(that.tableName))
+        return false;
+    }
+
+    boolean this_present_segments = true && this.isSetSegments();
+    boolean that_present_segments = true && that.isSetSegments();
+    if (this_present_segments || that_present_segments) {
+      if (!(this_present_segments && that_present_segments))
+        return false;
+      if (!this.segments.equals(that.segments))
+        return false;
+    }
+
+    boolean this_present_optionalSegments = true && 
this.isSetOptionalSegments();
+    boolean that_present_optionalSegments = true && 
that.isSetOptionalSegments();
+    if (this_present_optionalSegments || that_present_optionalSegments) {
+      if (!(this_present_optionalSegments && that_present_optionalSegments))
+        return false;
+      if (!this.optionalSegments.equals(that.optionalSegments))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    int hashCode = 1;
+
+    hashCode = hashCode * 8191 + ((isSetTableName()) ? 131071 : 524287);
+    if (isSetTableName())
+      hashCode = hashCode * 8191 + tableName.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetSegments()) ? 131071 : 524287);
+    if (isSetSegments())
+      hashCode = hashCode * 8191 + segments.hashCode();
+
+    hashCode = hashCode * 8191 + ((isSetOptionalSegments()) ? 131071 : 524287);
+    if (isSetOptionalSegments())
+      hashCode = hashCode * 8191 + optionalSegments.hashCode();
+
+    return hashCode;
+  }
+
+  @Override
+  public int compareTo(TableSegmentsInfo other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = java.lang.Boolean.compare(isSetTableName(), 
other.isSetTableName());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTableName()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.tableName, 
other.tableName);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = java.lang.Boolean.compare(isSetSegments(), 
other.isSetSegments());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetSegments()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.segments, 
other.segments);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = java.lang.Boolean.compare(isSetOptionalSegments(), 
other.isSetOptionalSegments());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetOptionalSegments()) {
+      lastComparison = 
org.apache.thrift.TBaseHelper.compareTo(this.optionalSegments, 
other.optionalSegments);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  @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);
+  }
+
+  @Override
+  public java.lang.String toString() {
+    java.lang.StringBuilder sb = new 
java.lang.StringBuilder("TableSegmentsInfo(");
+    boolean first = true;
+
+    sb.append("tableName:");
+    if (this.tableName == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.tableName);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("segments:");
+    if (this.segments == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.segments);
+    }
+    first = false;
+    if (isSetOptionalSegments()) {
+      if (!first) sb.append(", ");
+      sb.append("optionalSegments:");
+      if (this.optionalSegments == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.optionalSegments);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (!isSetTableName()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 
'tableName' is unset! Struct:" + toString());
+    }
+
+    if (!isSetSegments()) {
+      throw new org.apache.thrift.protocol.TProtocolException("Required field 
'segments' is unset! Struct:" + toString());
+    }
+
+    // check for sub-struct validity
+  }
+
+  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) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  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) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class TableSegmentsInfoStandardSchemeFactory implements 
org.apache.thrift.scheme.SchemeFactory {
+    @Override
+    public TableSegmentsInfoStandardScheme getScheme() {
+      return new TableSegmentsInfoStandardScheme();
+    }
+  }
+
+  private static class TableSegmentsInfoStandardScheme extends 
org.apache.thrift.scheme.StandardScheme<TableSegmentsInfo> {
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol iprot, 
TableSegmentsInfo 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) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // TABLE_NAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.tableName = iprot.readString();
+              struct.setTableNameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          case 2: // SEGMENTS
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list0 = 
iprot.readListBegin();
+                struct.segments = new 
java.util.ArrayList<java.lang.String>(_list0.size);
+                @org.apache.thrift.annotation.Nullable java.lang.String _elem1;
+                for (int _i2 = 0; _i2 < _list0.size; ++_i2)
+                {
+                  _elem1 = iprot.readString();
+                  struct.segments.add(_elem1);
+                }
+                iprot.readListEnd();
+              }
+              struct.setSegmentsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          case 3: // OPTIONAL_SEGMENTS
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list3 = 
iprot.readListBegin();
+                struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list3.size);
+                @org.apache.thrift.annotation.Nullable java.lang.String _elem4;
+                for (int _i5 = 0; _i5 < _list3.size; ++_i5)
+                {
+                  _elem4 = iprot.readString();
+                  struct.optionalSegments.add(_elem4);
+                }
+                iprot.readListEnd();
+              }
+              struct.setOptionalSegmentsIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, 
schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+      struct.validate();
+    }
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol oprot, 
TableSegmentsInfo struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.tableName != null) {
+        oprot.writeFieldBegin(TABLE_NAME_FIELD_DESC);
+        oprot.writeString(struct.tableName);
+        oprot.writeFieldEnd();
+      }
+      if (struct.segments != null) {
+        oprot.writeFieldBegin(SEGMENTS_FIELD_DESC);
+        {
+          oprot.writeListBegin(new 
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, 
struct.segments.size()));
+          for (java.lang.String _iter6 : struct.segments)
+          {
+            oprot.writeString(_iter6);
+          }
+          oprot.writeListEnd();
+        }
+        oprot.writeFieldEnd();
+      }
+      if (struct.optionalSegments != null) {
+        if (struct.isSetOptionalSegments()) {
+          oprot.writeFieldBegin(OPTIONAL_SEGMENTS_FIELD_DESC);
+          {
+            oprot.writeListBegin(new 
org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, 
struct.optionalSegments.size()));
+            for (java.lang.String _iter7 : struct.optionalSegments)
+            {
+              oprot.writeString(_iter7);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class TableSegmentsInfoTupleSchemeFactory implements 
org.apache.thrift.scheme.SchemeFactory {
+    @Override
+    public TableSegmentsInfoTupleScheme getScheme() {
+      return new TableSegmentsInfoTupleScheme();
+    }
+  }
+
+  private static class TableSegmentsInfoTupleScheme extends 
org.apache.thrift.scheme.TupleScheme<TableSegmentsInfo> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, 
TableSegmentsInfo struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol oprot = 
(org.apache.thrift.protocol.TTupleProtocol) prot;
+      oprot.writeString(struct.tableName);
+      {
+        oprot.writeI32(struct.segments.size());
+        for (java.lang.String _iter8 : struct.segments)
+        {
+          oprot.writeString(_iter8);
+        }
+      }
+      java.util.BitSet optionals = new java.util.BitSet();
+      if (struct.isSetOptionalSegments()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetOptionalSegments()) {
+        {
+          oprot.writeI32(struct.optionalSegments.size());
+          for (java.lang.String _iter9 : struct.optionalSegments)
+          {
+            oprot.writeString(_iter9);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, 
TableSegmentsInfo struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TTupleProtocol iprot = 
(org.apache.thrift.protocol.TTupleProtocol) prot;
+      struct.tableName = iprot.readString();
+      struct.setTableNameIsSet(true);
+      {
+        org.apache.thrift.protocol.TList _list10 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
+        struct.segments = new 
java.util.ArrayList<java.lang.String>(_list10.size);
+        @org.apache.thrift.annotation.Nullable java.lang.String _elem11;
+        for (int _i12 = 0; _i12 < _list10.size; ++_i12)
+        {
+          _elem11 = iprot.readString();
+          struct.segments.add(_elem11);
+        }
+      }
+      struct.setSegmentsIsSet(true);
+      java.util.BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        {
+          org.apache.thrift.protocol.TList _list13 = 
iprot.readListBegin(org.apache.thrift.protocol.TType.STRING);
+          struct.optionalSegments = new 
java.util.ArrayList<java.lang.String>(_list13.size);
+          @org.apache.thrift.annotation.Nullable java.lang.String _elem14;
+          for (int _i15 = 0; _i15 < _list13.size; ++_i15)
+          {
+            _elem14 = iprot.readString();
+            struct.optionalSegments.add(_elem14);
+          }
+        }
+        struct.setOptionalSegmentsIsSet(true);
+      }
+    }
+  }
+
+  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();
+  }
+}
+
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 3f47c6c4b4..5a0c018e63 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
@@ -17,7 +17,7 @@
  * under the License.
  */
 /**
- * Autogenerated by Thrift Compiler (0.19.0)
+ * Autogenerated by Thrift Compiler (0.21.0)
  *
  * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
  *  @generated
@@ -29,7 +29,7 @@ package org.apache.pinot.common.response;
  * 
  */
 @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
-@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.19.0)", date = "2025-03-03")
+@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler 
(0.21.0)", date = "2025-04-16")
 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/proto/server.proto 
b/pinot-common/src/main/proto/server.proto
index 7781d6f96e..17bfcef916 100644
--- a/pinot-common/src/main/proto/server.proto
+++ b/pinot-common/src/main/proto/server.proto
@@ -25,11 +25,19 @@ service PinotQueryServer {
   rpc Submit(ServerRequest) returns (stream ServerResponse);
 }
 
+message TableSegmentsInfo {
+  string tableName = 1;
+  repeated string segments = 2;
+  repeated string optionalSegments = 3;
+}
+
 message ServerRequest {
   map<string, string> metadata = 1;
   string sql = 2;
   repeated string segments = 3;
   bytes payload = 4;
+  repeated string optionalSegments = 5;
+  repeated TableSegmentsInfo tableSegmentsInfo = 6;
 }
 
 message ServerResponse {
diff --git a/pinot-common/src/thrift/request.thrift 
b/pinot-common/src/thrift/request.thrift
index 73a0334757..c213467744 100644
--- a/pinot-common/src/thrift/request.thrift
+++ b/pinot-common/src/thrift/request.thrift
@@ -45,6 +45,12 @@ struct BrokerRequest {
 // 19: optional i32 limit = 0;
 }
 
+struct TableSegmentsInfo {
+  1: required string tableName;
+  2: required list<string> segments;
+  3: optional list<string> optionalSegments;
+}
+
 struct InstanceRequest {
   1: required i64 requestId;
   2: required BrokerRequest query;
@@ -53,4 +59,5 @@ struct InstanceRequest {
   5: optional string brokerId;
   6: optional list<string> optionalSegments;
   7: optional string cid;
+  8: optional list<TableSegmentsInfo> tableSegmentsInfoList;
 }
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java
index c45a4c2cd2..b42fe241f0 100644
--- 
a/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/query/request/ServerQueryRequest.java
@@ -18,14 +18,18 @@
  */
 package org.apache.pinot.core.query.request;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import javax.annotation.Nullable;
 import org.apache.pinot.common.metrics.ServerMetrics;
 import org.apache.pinot.common.proto.Server;
 import org.apache.pinot.common.request.BrokerRequest;
 import org.apache.pinot.common.request.InstanceRequest;
 import org.apache.pinot.common.request.PinotQuery;
+import org.apache.pinot.common.request.TableSegmentsInfo;
 import org.apache.pinot.core.query.request.context.QueryContext;
+import org.apache.pinot.core.query.request.context.TableSegmentsContext;
 import org.apache.pinot.core.query.request.context.TimerContext;
 import 
org.apache.pinot.core.query.request.context.utils.QueryContextConverterUtils;
 import org.apache.pinot.core.query.utils.QueryIdUtils;
@@ -54,6 +58,7 @@ public class ServerQueryRequest {
   private final boolean _enableStreaming;
   private final List<String> _segmentsToQuery;
   private final List<String> _optionalSegments;
+  private final List<TableSegmentsContext> _tableSegmentsContexts;
   private final QueryContext _queryContext;
 
   // Request id might not be unique across brokers or for request hitting a 
hybrid table. To solve that we may construct
@@ -86,6 +91,16 @@ public class ServerQueryRequest {
     _queryId = QueryIdUtils.getQueryId(_brokerId, _requestId,
         
TableNameBuilder.getTableTypeFromTableName(_queryContext.getTableName()));
     _timerContext = new TimerContext(_queryContext.getTableName(), 
serverMetrics, queryArrivalTimeMs);
+    if (instanceRequest.getTableSegmentsInfoListSize() > 0) {
+      _tableSegmentsContexts = new 
ArrayList<>(instanceRequest.getTableSegmentsInfoListSize());
+      for (TableSegmentsInfo tableSegmentsInfo : 
instanceRequest.getTableSegmentsInfoList()) {
+        _tableSegmentsContexts.add(
+            new TableSegmentsContext(tableSegmentsInfo.getTableName(), 
tableSegmentsInfo.getSegments(),
+                tableSegmentsInfo.getOptionalSegments()));
+      }
+    } else {
+      _tableSegmentsContexts = null;
+    }
   }
 
   /**
@@ -125,6 +140,17 @@ public class ServerQueryRequest {
     _queryId = QueryIdUtils.getQueryId(_brokerId, _requestId,
         
TableNameBuilder.getTableTypeFromTableName(_queryContext.getTableName()));
     _timerContext = new TimerContext(_queryContext.getTableName(), 
serverMetrics, queryArrivalTimeMs);
+    if (serverRequest.getTableSegmentsInfoCount() > 0) {
+      _tableSegmentsContexts = new 
ArrayList<>(serverRequest.getTableSegmentsInfoCount());
+      for (org.apache.pinot.common.proto.Server.TableSegmentsInfo 
tableSegmentsInfo
+          : serverRequest.getTableSegmentsInfoList()) {
+        _tableSegmentsContexts.add(
+            new TableSegmentsContext(tableSegmentsInfo.getTableName(), 
tableSegmentsInfo.getSegmentsList(),
+                tableSegmentsInfo.getOptionalSegmentsList()));
+      }
+    } else {
+      _tableSegmentsContexts = null;
+    }
   }
 
   /**
@@ -148,6 +174,7 @@ public class ServerQueryRequest {
     _optionalSegments = null;
 
     _timerContext = new TimerContext(_queryContext.getTableName(), 
serverMetrics, queryArrivalTimeMs);
+    _tableSegmentsContexts = null;
   }
 
   private static QueryContext getQueryContext(PinotQuery pinotQuery) {
@@ -182,6 +209,11 @@ public class ServerQueryRequest {
     return _optionalSegments;
   }
 
+  @Nullable
+  public List<TableSegmentsContext> getTableSegmentsContexts() {
+    return _tableSegmentsContexts;
+  }
+
   public QueryContext getQueryContext() {
     return _queryContext;
   }
diff --git 
a/pinot-core/src/main/java/org/apache/pinot/core/query/request/context/TableSegmentsContext.java
 
b/pinot-core/src/main/java/org/apache/pinot/core/query/request/context/TableSegmentsContext.java
new file mode 100644
index 0000000000..59fe10f3ab
--- /dev/null
+++ 
b/pinot-core/src/main/java/org/apache/pinot/core/query/request/context/TableSegmentsContext.java
@@ -0,0 +1,46 @@
+/**
+ * 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.pinot.core.query.request.context;
+
+import java.util.List;
+
+
+public class TableSegmentsContext {
+  private final String _tableName;
+  private final List<String> _segments;
+  private final List<String> _optionalSegments;
+
+  public TableSegmentsContext(String tableName, List<String> segments, 
List<String> optionalSegments) {
+    _tableName = tableName;
+    _segments = segments;
+    _optionalSegments = optionalSegments;
+  }
+
+  public String getTableName() {
+    return _tableName;
+  }
+
+  public List<String> getSegments() {
+    return _segments;
+  }
+
+  public List<String> getOptionalSegments() {
+    return _optionalSegments;
+  }
+}


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

Reply via email to