You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2020/12/04 15:55:58 UTC

[GitHub] [nifi] mattyb149 commented on a change in pull request #4697: NIFI-7989: Add support to UpdateHiveTable for creating external tables

mattyb149 commented on a change in pull request #4697:
URL: https://github.com/apache/nifi/pull/4697#discussion_r536199849



##########
File path: nifi-nar-bundles/nifi-hive-bundle/nifi-hive3-processors/src/main/java/org/apache/nifi/processors/hive/UpdateHive3Table.java
##########
@@ -322,29 +411,55 @@ private synchronized void checkAndUpdateTableSchema(final ProcessSession session
                     s.execute(createTableSql);
                 }
 
-                // Now that the table is created, describe it and determine its location (for placing the flowfile downstream)
-                String describeTable = "DESC FORMATTED " + tableName;
-                ResultSet tableInfo = s.executeQuery(describeTable);
-                boolean moreRows = tableInfo.next();
-                boolean locationFound = false;
-                while (moreRows && !locationFound) {
-                    String line = tableInfo.getString(1);
-                    if (line.startsWith("Location:")) {
-                        locationFound = true;
-                        continue; // Don't do a next() here, need to get the second column value
-                    }
-                    moreRows = tableInfo.next();
-                }
-                outputPath = tableInfo.getString(2);
+                tableCreated = true;
+            }
 
-            } else {
-                List<String> hiveColumns = new ArrayList<>();
+            // Process the table (columns, partitions, location, etc.)
+            List<String> hiveColumns = new ArrayList<>();
 
-                String describeTable = "DESC FORMATTED " + tableName;
-                ResultSet tableInfo = s.executeQuery(describeTable);
-                // Result is 3 columns, col_name, data_type, comment. Check the first row for a header and skip if so, otherwise add column name
+            String describeTable = "DESC FORMATTED " + tableName;

Review comment:
       Great catch! Will fix




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