Github user pvillard31 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2695#discussion_r188990055
--- Diff:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/SelectHiveQL.java
---
@@ -311,7 +340,15 @@ private void onTrigger(final ProcessContext context,
final ProcessSession sessio
try (final Connection con =
dbcpService.getConnection(fileToProcess == null ? Collections.emptyMap() :
fileToProcess.getAttributes());
final Statement st = (flowbased ?
con.prepareStatement(selectQuery) : con.createStatement())
) {
-
+ Pair<String,SQLException> failure =
executeConfigStatements(con, preQueries);
+ if (failure != null) {
+ // In case of failure, assigning config query to
"selectQuery" var will allow to avoid major changes in error handling (catch
block),
--- End diff --
I understand the intent here, just wondering if it's a good idea on the
long term for code maintainability/clarity. @mattyb149 what are your thoughts?
---