Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2138#discussion_r160458722
--- Diff:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive-processors/src/main/java/org/apache/nifi/processors/hive/AbstractHiveQLProcessor.java
---
@@ -75,6 +81,38 @@
.addValidator(StandardValidators.CHARACTER_SET_VALIDATOR)
.build();
+ public static final PropertyDescriptor QUERY_TIMEOUT = new
PropertyDescriptor.Builder()
+ .name("hive-query-timeout")
+ .displayName("Query timeout")
+ .description("Sets the number of seconds the driver will wait
for a query to execute. "
+ + "A value of 0 means no timeout. NOTE: Non-zero
values may not be supported by the driver.")
+ .defaultValue("0")
+ .required(true)
+ .addValidator(StandardValidators.INTEGER_VALIDATOR)
+ .expressionLanguageSupported(true)
+ .build();
+
+ @Override
+ protected Collection<ValidationResult>
customValidate(ValidationContext validationContext) {
+ final List<ValidationResult> problems = new ArrayList<>(1);
+
+ if(validationContext.getProperty(QUERY_TIMEOUT).isSet()
+ &&
!validationContext.getProperty(QUERY_TIMEOUT).isExpressionLanguagePresent()
+ &&
validationContext.getProperty(QUERY_TIMEOUT).asInteger() != 0) {
+ try(HiveStatement stmt = new HiveStatement(null, null, null)) {
+ stmt.setQueryTimeout(0);
+ } catch (SQLException e) {
+ problems.add(new ValidationResult.Builder()
+ .subject("Query Timeout")
+ .valid(false)
+ .explanation(e.getLocalizedMessage())
--- End diff --
This message is "Method not supported", I can add more text around before
merge, such as "setQueryTimeout caused the driver to report
"+e.getLocalizedMessage() or something like that?
---