You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ja...@apache.org on 2020/07/10 06:07:43 UTC

[incubator-pinot] branch master updated: fetch all columns and datatypes (#5673)

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/incubator-pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 9196fcb  fetch all columns and datatypes (#5673)
9196fcb is described below

commit 9196fcb6c8697f25e9cc8ea59f7a83e1e89404e4
Author: Kartik Khare <kh...@gmail.com>
AuthorDate: Fri Jul 10 11:37:31 2020 +0530

    fetch all columns and datatypes (#5673)
    
    The patch is needed to provide ResultSet metadata to JDBC driver.
    The driver requires a column data type in response and currently there is not way to fetch that.
---
 .../apache/pinot/client/ResultTableResultSet.java  | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
index 3271caa..86a7c17 100644
--- a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
+++ b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ResultTableResultSet.java
@@ -19,6 +19,8 @@
 package org.apache.pinot.client;
 
 import com.fasterxml.jackson.databind.JsonNode;
+import java.util.ArrayList;
+import java.util.List;
 
 
 /**
@@ -61,6 +63,33 @@ class ResultTableResultSet extends AbstractResultSet {
     }
   }
 
+  public List<String> getAllColumns() {
+    List<String> columns = new ArrayList<>();
+    if (_columnNamesArray == null) {
+      return columns;
+    }
+
+    for (JsonNode column : _columnNamesArray) {
+      columns.add(column.textValue());
+    }
+
+    return columns;
+  }
+
+
+  public List<String> getAllColumnsDataTypes() {
+    List<String> columnDataTypes = new ArrayList<>();
+    if (_columnDataTypesArray == null) {
+      return columnDataTypes;
+    }
+
+    for (JsonNode columnDataType : _columnDataTypesArray) {
+      columnDataTypes.add(columnDataType.textValue());
+    }
+
+    return columnDataTypes;
+  }
+
   @Override
   public int getGroupKeyLength() {
     return 0;


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