fetch all columns and datatypes
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.
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;
