15 package com.cloudera.impala.analysis;
22 import com.cloudera.impala.thrift.TExtractField;
23 import com.google.common.base.Joiner;
24 import com.google.common.base.Preconditions;
25 import com.google.common.collect.ImmutableSet;
26 import com.google.common.collect.Lists;
38 ImmutableSet.Builder<String> builder =
new ImmutableSet.Builder<String>();
39 for (TExtractField extractField: TExtractField.values()) {
40 if (extractField != TExtractField.INVALID_FIELD) {
41 builder.add(extractField.name());
52 super(fnName, Lists.newArrayList(e,
new StringLiteral(extractFieldIdent)));
68 +
" does not accept the keyword FROM.");
73 "with the EXTRACT builtin.");
76 super.analyze(analyzer);
78 String extractFieldIdent = ((
StringLiteral)children_.get(1)).getValue();
79 Preconditions.checkNotNull(extractFieldIdent);
81 throw new AnalysisException(
"Time unit '" + extractFieldIdent +
"' in expression '"
82 +
toSql() +
"' is invalid. Expected one of "
89 Expr e = children_.get(0);
90 return "Expression '" + e.toSql() +
"' in '" +
toSql() +
"' has a return type of "
91 + e.getType().
toSql() +
" but a TIMESTAMP is required.";
96 StringBuilder strBuilder =
new StringBuilder();
97 strBuilder.append(
getFnName().getFunction().toUpperCase());
98 strBuilder.append(
"(");
100 strBuilder.append(
" FROM ");
101 strBuilder.append(getChild(0).toSql());
102 strBuilder.append(
")");
103 return strBuilder.toString();
static final String BUILTINS_DB
static final ScalarType INT
boolean equals(Object obj)