Jackie-Jiang commented on a change in pull request #5213: Support order-by on 
BYTES column
URL: https://github.com/apache/incubator-pinot/pull/5213#discussion_r405239912
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/query/selection/SelectionOperatorUtils.java
 ##########
 @@ -481,55 +510,81 @@ public static ResultTable 
renderResultTableWithoutOrdering(List<Serializable[]>
   }
 
   /**
-   * Extract columns from the row based on the given column indices.
-   * <p>The extracted row is used to build the {@link SelectionResults}.
-   *
-   * @param row selection row to be extracted.
-   * @param columnIndices column indices.
-   * @return selection row.
+   * Converts a value into the given data type. (Broker side)
+   * <p>Actual value type can be different with data type passed in, but they 
must be type compatible.
    */
-  public static Serializable[] extractColumns(Serializable[] row, int[] 
columnIndices,
-      @Nullable DataSchema.ColumnDataType[] columnDataTypes) {
-    int numColumns = columnIndices.length;
-    Serializable[] extractedRow = new Serializable[numColumns];
-    if (columnDataTypes == null) {
-      for (int i = 0; i < numColumns; i++) {
-        extractedRow[i] = row[columnIndices[i]];
-      }
-    } else {
-      for (int i = 0; i < numColumns; i++) {
-        extractedRow[i] = getFormattedValue(row[columnIndices[i]], 
columnDataTypes[i]);
-      }
-    }
-    return extractedRow;
-  }
+  public static Serializable convertValueToType(Object value, 
DataSchema.ColumnDataType dataType) {
+    switch (dataType) {
+      // Single-value column
+      case INT:
+        return ((Number) value).intValue();
 
 Review comment:
   We are trying to handle compatible types here (commented on line 514). This 
is required for cases where different segments have different schema (same 
column name, but different data types).
   The long term solution should be let the query engine use the table schema 
instead of the schema inside each segments.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to