[NO ISSUE][COMP] Refactor function lookup in expression translator

- user model changes: no
- storage format changes: no
- interface changes: no

Details:
- Move function lookup code in LangExpressionToPlanTranslator
  into a separate method so it can be modified by product extensions

Change-Id: I917665fd631b220daa6fe7436288193b0dec60b4
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3258
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Ali Alsuliman <ali.al.solaiman@gmail.com>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
index 91de474..96773a6 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/LangExpressionToPlanTranslator.java
@@ -779,10 +779,8 @@
         }
 
         SourceLocation sourceLoc = fcall.getSourceLocation();
-        AbstractFunctionCallExpression f;
-        if ((f = lookupUserDefinedFunction(signature, args, sourceLoc)) == null) {
-            f = lookupBuiltinFunction(signature.getName(), signature.getArity(), args, sourceLoc);
-        }
+
+        AbstractFunctionCallExpression f = lookupFunction(signature, args, sourceLoc);
 
         if (f == null) {
             throw new CompilationException(ErrorCode.UNKNOWN_FUNCTION, sourceLoc,
@@ -816,6 +814,15 @@
         return varRef;
     }
 
+    protected AbstractFunctionCallExpression lookupFunction(FunctionSignature signature,
+            List<Mutable<ILogicalExpression>> args, SourceLocation sourceLoc) throws CompilationException {
+        AbstractFunctionCallExpression f;
+        if ((f = lookupUserDefinedFunction(signature, args, sourceLoc)) == null) {
+            f = lookupBuiltinFunction(signature.getName(), signature.getArity(), args, sourceLoc);
+        }
+        return f;
+    }
+
     private AbstractFunctionCallExpression lookupUserDefinedFunction(FunctionSignature signature,
             List<Mutable<ILogicalExpression>> args, SourceLocation sourceLoc) throws CompilationException {
         try {