shameersss1 commented on a change in pull request #1328:
URL: https://github.com/apache/hive/pull/1328#discussion_r464215422



##########
File path: 
jdbc-handler/src/main/java/org/apache/hive/storage/jdbc/dao/JdbcRecordIterator.java
##########
@@ -59,9 +62,26 @@ public JdbcRecordIterator(Connection conn, PreparedStatement 
ps, ResultSet rs, C
       fieldNamesProperty = 
Preconditions.checkNotNull(conf.get(Constants.JDBC_QUERY_FIELD_NAMES));
       fieldTypesProperty = 
Preconditions.checkNotNull(conf.get(Constants.JDBC_QUERY_FIELD_TYPES));
     } else {
-      fieldNamesProperty = 
Preconditions.checkNotNull(conf.get(serdeConstants.LIST_COLUMNS));
+      try {
+        if (conf.get(Constants.JDBC_QUERY) == null) {
+          ResultSetMetaData metadata = rs.getMetaData();
+          int numColumns = metadata.getColumnCount();
+          List<String> columnNames = new ArrayList<String>(numColumns);
+          for (int i = 0; i < numColumns; i++) {
+            columnNames.add(metadata.getColumnName(i + 1));
+          }
+          fieldNamesProperty = String.join(",",columnNames);

Review comment:
       nit: space missing:  **String.join(",", columnNames);**




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to