deniskuzZ commented on code in PR #6081:
URL: https://github.com/apache/hive/pull/6081#discussion_r2416145503
##########
ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java:
##########
@@ -314,7 +350,46 @@ private static List<DagCredentialSupplier>
defaultCredentialSuppliers() {
LOG.error("Failed to add credential supplier", e);
}
}
- return dagSuppliers;
+ credentialSuppliers.addAll(dagSuppliers);
+ }
+
+ /**
+ * Returns the security protocol if one is defined in the properties and
null otherwise.
+ * <p>The following properties are examined to determine the protocol:</p>
+ * <ol>
+ * <li>security.protocol</li>
+ * <li>kafka.consumer.security.protocol</li>
+ * <li>kafka.producer.security.protocol</li>
+ * </ol>
+ * <p>and the first non null/not empty is returned.</p>
+ * <p>Defining multiple security protocols at the same time is invalid but
this method is lenient and tries to pick
+ * the most reasonable option.</p>
+ * @param props the properties from which to obtain the protocol.
+ * @return the security protocol if one is defined in the properties and
null otherwise.
+ */
+ static SecurityProtocol getSecurityProtocol(Properties props) {
+ String[] securityProtocolConfigs = new String[] {
CommonClientConfigs.SECURITY_PROTOCOL_CONFIG,
+ CONSUMER_CONFIGURATION_PREFIX + "." +
CommonClientConfigs.SECURITY_PROTOCOL_CONFIG,
+ PRODUCER_CONFIGURATION_PREFIX + "." +
CommonClientConfigs.SECURITY_PROTOCOL_CONFIG };
+ for (String c : securityProtocolConfigs) {
+ String v = props.getProperty(c);
+ if (v != null && !v.isEmpty()) {
+ return SecurityProtocol.forName(v);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns whether a Kafka token is required for performing operations on
the specified table.
+ * If "security.protocol" is set to "PLAINTEXT", we don't need to collect
delegation token at all.
+ *
+ * @return true if a Kafka token is required for performing operations on
the specified table and false otherwise.
+ */
+ private boolean isTokenRequired(TableDesc tableDesc) {
Review Comment:
could we make it more descriptive, like isKafkaTokenRequired?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]