15 package com.cloudera.impala.analysis;
17 import java.util.ArrayList;
22 import com.cloudera.impala.thrift.TFunctionName;
23 import com.google.common.base.Joiner;
24 import com.google.common.base.Preconditions;
49 db_ = (dbName != null) ? dbName.toLowerCase() : null;
50 fn_ = fn.toLowerCase();
62 if ((
db_ == null || o.
db_ == null) && (
db_ != o.db_)) {
63 if (
db_ == null && o.
db_ != null)
return false;
64 if (
db_ != null && o.
db_ == null)
return false;
65 if (!
db_.equalsIgnoreCase(o.
db_))
return false;
67 return fn_.equalsIgnoreCase(o.fn_);
88 for (
int i = 0; i < fn_.length(); ++i) {
91 "Function names must be all alphanumeric or underscore. " +
92 "Invalid name: " +
fn_);
95 if (Character.isDigit(
fn_.charAt(0))) {
101 Db builtinDb = analyzer.getCatalog().getBuiltinsDb();
108 db_ = analyzer.getDefaultDb();
119 if (
fnNamePath_.size() > 2 || fnNamePath_.isEmpty()) {
120 throw new AnalysisException(
121 String.format(
"Invalid function name: '%s'. Expected [dbname].funcname.",
124 db_ = fnNamePath_.get(0);
125 fn_ = fnNamePath_.get(1).toLowerCase();
127 Preconditions.checkState(fnNamePath_.size() == 1);
128 fn_ = fnNamePath_.get(0).toLowerCase();
133 return Character.isLetterOrDigit(c) || c ==
'_';
137 TFunctionName
name =
new TFunctionName(
fn_);
138 name.setDb_name(
db_);
143 return new FunctionName(fnName.getDb_name(), fnName.getFunction_name());
boolean isFullyQualified()
boolean isValidCharacter(char c)
final ArrayList< String > fnNamePath_
void analyze(Analyzer analyzer)
static final String BUILTINS_DB
FunctionName(String dbName, String fn)
static FunctionName fromThrift(TFunctionName fnName)
FunctionName(ArrayList< String > fnNamePath)
ArrayList< String > getFnNamePath()
boolean equals(Object obj)
boolean containsFunction(String name)