siddharthteotia commented on a change in pull request #6710:
URL: https://github.com/apache/incubator-pinot/pull/6710#discussion_r603763658



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/common/datatable/DataTableUtils.java
##########
@@ -233,4 +243,98 @@ private static DataTable 
buildEmptyDataTableForDistinctQuery(QueryContext queryC
     dataTableBuilder.finishRow();
     return dataTableBuilder.build();
   }
+
+  /**
+   * Helper method to decode string.
+   */
+  public static String decodeString(DataInputStream dataInputStream)
+      throws IOException {
+    int length = dataInputStream.readInt();
+    if (length == 0) {
+      return StringUtils.EMPTY;
+    } else {
+      byte[] buffer = new byte[length];
+      int numBytesRead = dataInputStream.read(buffer);
+      assert numBytesRead == length;
+      return StringUtil.decodeUtf8(buffer);
+    }
+  }
+
+  /**
+   * Helper method to decode int.
+   */
+  public static int decodeInt(DataInputStream dataInputStream)
+      throws IOException {
+    int length = Integer.BYTES;
+    byte[] buffer = new byte[length];
+    int numBytesRead = dataInputStream.read(buffer);
+    assert numBytesRead == length;
+    return Ints.fromByteArray(buffer);

Review comment:
       Does this convert from big endian to little endian?




-- 
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]



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

Reply via email to