dawidwys commented on a change in pull request #9988: [FLINK-14418][hive]
Create HiveModule to provide Hive built-in functions
URL: https://github.com/apache/flink/pull/9988#discussion_r340491142
##########
File path:
flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/catalog/hive/factories/HiveFunctionDefinitionFactory.java
##########
@@ -67,14 +69,26 @@ public HiveFunctionDefinitionFactory(HiveConf hiveConf) {
this.hiveShim = HiveShimLoader.loadHiveShim(hiveVersion);
}
+ public HiveFunctionDefinitionFactory(String hiveVersion) {
+ checkArgument(!StringUtils.isNullOrWhitespaceOnly(hiveVersion),
+ "Hive version cannot be null or empty string");
+ this.hiveVersion = hiveVersion;
+ this.hiveShim = HiveShimLoader.loadHiveShim(hiveVersion);
+ }
+
@Override
public FunctionDefinition createFunctionDefinition(String name,
CatalogFunction catalogFunction) {
if
(Boolean.valueOf(catalogFunction.getProperties().get(CatalogConfig.IS_GENERIC)))
{
FunctionDefinitionUtil.createFunctionDefinition(name,
catalogFunction);
}
- String functionClassName = catalogFunction.getClassName();
+ return createFunctionDefinitionFromHiveFunction(name,
catalogFunction.getClassName());
+ }
+ /**
+ * Create a FunctionDefinition from a Hive function's class name.
+ */
+ public FunctionDefinition
createFunctionDefinitionFromHiveFunction(String name, String functionClassName)
{
Review comment:
Ah, I see. Sorry for the mistake.
Could you add a note to the javadoc why its public (that it's used in the
HiveModule). This method is very Hive specific and has not much to do with the
Factory interface itself. Or how about event extracting it to some
HiveFunctionUtils class?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services