This is an automated email from the ASF dual-hosted git repository.
joemcdonnell pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
The following commit(s) were added to refs/heads/master by this push:
new cf28a4c52 IMPALA-12121: Add non empty check for UDF location in
getLastModifiedTime method
cf28a4c52 is described below
commit cf28a4c5292fdb3504d1fe11183c78243ed148a4
Author: Soumyakanti Das <[email protected]>
AuthorDate: Fri May 5 17:41:26 2023 -0700
IMPALA-12121: Add non empty check for UDF location in getLastModifiedTime
method
getLastModifiedTime() of Function.java assumes that if the UDF is not a
BUILTIN
and if the location is not null, it is a non-empty string. However, we may
have
UDFs with an empty location if they are in the install location and loaded
at
init time.
This patch introduces an isBuiltinOrJava() method that checks if the
function is
BUILTIN, or a JAVA function with blank location.
Change-Id: Ia6035d1a21e7222f0e95f984a0f4022ba2e89d9f
Reviewed-on: http://gerrit.cloudera.org:8080/19852
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
---
fe/src/main/java/org/apache/impala/catalog/Function.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fe/src/main/java/org/apache/impala/catalog/Function.java
b/fe/src/main/java/org/apache/impala/catalog/Function.java
index 62c5f040d..b718442fe 100644
--- a/fe/src/main/java/org/apache/impala/catalog/Function.java
+++ b/fe/src/main/java/org/apache/impala/catalog/Function.java
@@ -438,8 +438,7 @@ public class Function extends CatalogObjectImpl {
// If an error occurs and the mtime cannot be retrieved, an
IllegalStateException is
// thrown.
public final long getLastModifiedTime() {
- if (getBinaryType() != TFunctionBinaryType.BUILTIN && getLocation() !=
null) {
- Preconditions.checkState(!getLocation().toString().isEmpty());
+ if (!isBuiltinOrJava()) {
TSymbolLookupParams lookup =
Preconditions.checkNotNull(getLookupParams());
try {
TSymbolLookupResult result = FeSupport.LookupSymbol(lookup);
@@ -453,6 +452,17 @@ public class Function extends CatalogObjectImpl {
return -1;
}
+ /**
+ * Returns true for BUILTINs, and JAVA functions when location is either
null or empty.
+ *
+ * @return boolean
+ */
+ private boolean isBuiltinOrJava() {
+ return getBinaryType() == TFunctionBinaryType.BUILTIN ||
+ (getBinaryType() == TFunctionBinaryType.JAVA &&
+ (getLocation() == null || getLocation().toString().isEmpty()));
+ }
+
// Returns the resolved symbol in the binary. The BE will do a lookup of
'symbol'
// in the binary and try to resolve unmangled names.
// If this function is expecting a return argument, retArgType is that type.
It should