Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.analysis.LikePredicate Class Reference
Inheritance diagram for com.cloudera.impala.analysis.LikePredicate:
Collaboration diagram for com.cloudera.impala.analysis.LikePredicate:

Classes

enum  Operator
 

Public Member Functions

 LikePredicate (Operator op, Expr e1, Expr e2)
 
 LikePredicate (LikePredicate other)
 
boolean equals (Object obj)
 
String toSqlImpl ()
 
void analyze (Analyzer analyzer) throws AnalysisException
 
Expr clone ()
 
boolean isEqJoinConjunct ()
 
void setIsEqJoinConjunct (boolean v)
 
boolean isSingleColumnPredicate (Reference< SlotRef > slotRefRef, Reference< Integer > idxRef)
 
Pair< SlotId, SlotIdgetEqSlots ()
 
SlotRef getBoundSlot ()
 
ExprId getId ()
 
Type getType ()
 
double getSelectivity ()
 
long getNumDistinctValues ()
 
void setPrintSqlInParens (boolean b)
 
boolean isWhereClauseConjunct ()
 
void setIsWhereClauseConjunct ()
 
boolean isAuxExpr ()
 
boolean isRegisteredPredicate ()
 
void setIsAuxExpr ()
 
Function getFn ()
 
void analyzeNoThrow (Analyzer analyzer)
 
void castChildCharsToStrings (Analyzer analyzer) throws AnalysisException
 
String toSql ()
 
TExpr treeToThrift ()
 
boolean isAggregate ()
 
List< String > childrenToSql ()
 
String debugString ()
 
int hashCode ()
 
List< ExprgetConjuncts ()
 
Expr trySubstitute (ExprSubstitutionMap smap, Analyzer analyzer, boolean preserveRootType) throws AnalysisException
 
Expr substitute (ExprSubstitutionMap smap, Analyzer analyzer, boolean preserveRootType)
 
Expr reset ()
 
boolean isBound (TupleId tid)
 
boolean isBound (SlotId slotId)
 
boolean isBoundByTupleIds (List< TupleId > tids)
 
boolean isBoundBySlotIds (List< SlotId > slotIds)
 
void getIds (List< TupleId > tupleIds, List< SlotId > slotIds)
 
boolean isLiteral ()
 
boolean isConstant ()
 
boolean isNullLiteral ()
 
boolean isScalarSubquery ()
 
void checkReturnsBool (String name, boolean printExpr) throws AnalysisException
 
final Expr castTo (Type targetType) throws AnalysisException
 
void castChild (Type targetType, int childIndex) throws AnalysisException
 
Expr ignoreImplicitCast ()
 
boolean isImplicitCast ()
 
String toString ()
 
SlotRef unwrapSlotRef (boolean implicitOnly)
 
Expr negate ()
 
Subquery getSubquery ()
 
void foldConstantChildren (Analyzer analyzer) throws AnalysisException
 

Static Public Member Functions

static void initBuiltins (Db db)
 
static void analyze (List<?extends Expr > exprs, Analyzer analyzer) throws AnalysisException
 
static long getNumDistinctValues (List< Expr > exprs)
 
static String toSql (List<?extends Expr > exprs)
 
static List< TExpr > treesToThrift (List<?extends Expr > exprs)
 
static
com.google.common.base.Predicate
< Expr
isAggregatePredicate ()
 
static String debugString (List<?extends Expr > exprs)
 
static< CextendsExpr > boolean equalLists (List< C > l1, List< C > l2)
 
static< CextendsExpr > boolean equalSets (List< C > l1, List< C > l2)
 
static< CextendsExpr > boolean isSubset (List< C > l1, List< C > l2)
 
static< CextendsExpr > List< C > intersect (List< C > l1, List< C > l2)
 
static void intersect (Analyzer analyzer, List< Expr > l1, List< Expr > l2, ExprSubstitutionMap smap, List< Expr > i1, List< Expr > i2)
 
static ArrayList< ExprtrySubstituteList (Iterable<?extends Expr > exprs, ExprSubstitutionMap smap, Analyzer analyzer, boolean preserveRootTypes) throws AnalysisException
 
static ArrayList< ExprsubstituteList (Iterable<?extends Expr > exprs, ExprSubstitutionMap smap, Analyzer analyzer, boolean preserveRootTypes)
 
static ArrayList< ExprresetList (ArrayList< Expr > l)
 
static< CextendsExpr >
ArrayList< C > 
cloneList (Iterable< C > l)
 
static< CextendsExpr > void removeDuplicates (List< C > l)
 
static< CextendsExpr > void removeConstants (List< C > l)
 
static boolean isBound (List<?extends Expr > exprs, List< TupleId > tids)
 
static< CextendsExpr > void getIds (List<?extends Expr > exprs, List< TupleId > tupleIds, List< SlotId > slotIds)
 
static Expr pushNegationToOperands (Expr root)
 

Static Public Attributes

static final int EXPR_CHILDREN_LIMIT = 10000
 
static final int EXPR_DEPTH_LIMIT = 1000
 
static final
com.google.common.base.Predicate
< Expr
IS_NOT_PREDICATE
 
static final
com.google.common.base.Predicate
< Expr
IS_OR_PREDICATE
 
static final
com.google.common.base.Predicate
< Expr
IS_SCALAR_SUBQUERY
 
static final
com.google.common.base.Predicate
< Expr
NON_NULL_EMPTY_AGG
 
static final
com.google.common.base.Predicate
< Expr
IS_BUILTIN_AGG_FN
 
static final
com.google.common.base.Predicate
< Expr
IS_TRUE_LITERAL
 

Protected Member Functions

void toThrift (TExprNode msg)
 
void setId (ExprId id)
 
void computeNumDistinctValues ()
 
Type[] collectChildReturnTypes ()
 
Function getBuiltinFunction (Analyzer analyzer, String name, Type[] argTypes, CompareMode mode) throws AnalysisException
 
void castForFunctionCall (boolean ignoreWildcardDecimals) throws AnalysisException
 
void convertNumericLiteralsFromDecimal (Analyzer analyzer) throws AnalysisException
 
void treeToThriftHelper (TExpr container)
 
Expr substituteImpl (ExprSubstitutionMap smap, Analyzer analyzer) throws AnalysisException
 
void resetAnalysisState ()
 
void getIdsHelper (Set< TupleId > tupleIds, Set< SlotId > slotIds)
 
Expr uncheckedCastTo (Type targetType) throws AnalysisException
 
void uncheckedCastChild (Type targetType, int childIndex) throws AnalysisException
 

Protected Attributes

boolean isEqJoinConjunct_
 
ExprId id_
 
Type type_
 
boolean isAnalyzed_
 
boolean isWhereClauseConjunct_
 
boolean printSqlInParens_ = false
 
double selectivity_
 
long numDistinctValues_
 
Function fn_
 

Static Protected Attributes

static double DEFAULT_SELECTIVITY = 0.1
 

Package Functions

Type getResolvedWildCardType () throws AnalysisException
 

Private Attributes

final Operator op_
 

Detailed Description

Definition at line 30 of file LikePredicate.java.

Constructor & Destructor Documentation

com.cloudera.impala.analysis.LikePredicate.LikePredicate ( Operator  op,
Expr  e1,
Expr  e2 
)
inline
com.cloudera.impala.analysis.LikePredicate.LikePredicate ( LikePredicate  other)
inline

Copy c'tor used in clone().

Definition at line 79 of file LikePredicate.java.

References com.cloudera.impala.analysis.LikePredicate.op_.

Member Function Documentation

static void com.cloudera.impala.analysis.Expr.analyze ( List<?extends Expr exprs,
Analyzer  analyzer 
) throws AnalysisException
inlinestaticinherited

Helper function: analyze list of exprs

Definition at line 440 of file Expr.java.

void com.cloudera.impala.analysis.Expr.analyzeNoThrow ( Analyzer  analyzer)
inlineinherited

Helper function to analyze this expr and assert that the analysis was successful. TODO: This function could be used in many more places to clean up. Consider adding an IAnalyzable interface or similar to and move this helper into Analyzer such that non-Expr things can use the helper also.

Definition at line 238 of file Expr.java.

References com.cloudera.impala.analysis.Expr.analyze().

void com.cloudera.impala.analysis.Expr.castChild ( Type  targetType,
int  childIndex 
) throws AnalysisException
inlineinherited

Add a cast expression above child. If child is a literal expression, we attempt to convert the value of the child directly, and not insert a cast node.

Parameters
targetTypetype to be cast to
childIndexindex of child to be cast

Definition at line 1008 of file Expr.java.

Referenced by com.cloudera.impala.analysis.CaseExpr.analyze(), and com.cloudera.impala.analysis.Expr.castForFunctionCall().

void com.cloudera.impala.analysis.Expr.castChildCharsToStrings ( Analyzer  analyzer) throws AnalysisException
inlineinherited
void com.cloudera.impala.analysis.Expr.castForFunctionCall ( boolean  ignoreWildcardDecimals) throws AnalysisException
inlineprotectedinherited

Generates the necessary casts for the children of this expr to call fn_. child(0) is cast to the function's first argument, child(1) to the second etc. This does not do any validation and the casts are assumed to be safe.

If ignoreWildcardDecimals is true, the function will not cast arguments that are wildcard decimals. This is used for builtins where the cast is done within the BE function. Otherwise, if the function signature contains wildcard decimals, each wildcard child argument will be cast to the highest resolution that can contain all of the child wildcard arguments. e.g. fn(decimal(*), decimal(*)) called with fn(decimal(10,2), decimal(5,3)) both children will be cast to (11, 3).

Definition at line 312 of file Expr.java.

References com.cloudera.impala.analysis.Expr.castChild(), com.cloudera.impala.analysis.Expr.fn_, and com.cloudera.impala.analysis.Expr.getResolvedWildCardType().

Referenced by com.cloudera.impala.analysis.LikePredicate.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), com.cloudera.impala.analysis.TimestampArithmeticExpr.analyze(), com.cloudera.impala.analysis.CompoundPredicate.analyze(), com.cloudera.impala.analysis.ArithmeticExpr.analyze(), com.cloudera.impala.analysis.BinaryPredicate.analyze(), and com.cloudera.impala.analysis.FunctionCallExpr.analyze().

final Expr com.cloudera.impala.analysis.Expr.castTo ( Type  targetType) throws AnalysisException
inlineinherited

Casts this expr to a specific target type. It checks the validity of the cast and calls uncheckedCastTo().

Parameters
targetTypetype to be cast to
Returns
cast expression, or converted literal, should never return null
Exceptions
AnalysisExceptionwhen an invalid cast is asked for, for example, failure to convert a string literal to a date literal

Definition at line 967 of file Expr.java.

References com.cloudera.impala.analysis.Expr.type_, and com.cloudera.impala.analysis.Expr.uncheckedCastTo().

Referenced by com.cloudera.impala.analysis.Expr.castChildCharsToStrings().

void com.cloudera.impala.analysis.Expr.checkReturnsBool ( String  name,
boolean  printExpr 
) throws AnalysisException
inlineinherited

Checks whether this expr returns a boolean type or NULL type. If not, throws an AnalysisException with an appropriate error message using 'name' as a prefix. For example, 'name' could be "WHERE clause". The error message only contains this.toSql() if printExpr is true.

Definition at line 947 of file Expr.java.

References com.cloudera.impala.catalog.Type.isBoolean(), impala.name, com.cloudera.impala.analysis.Expr.toSql(), and com.cloudera.impala.analysis.Expr.type_.

List<String> com.cloudera.impala.analysis.Expr.childrenToSql ( )
inlineinherited

Definition at line 531 of file Expr.java.

Referenced by com.cloudera.impala.analysis.FunctionCallExpr.toSqlImpl().

Expr com.cloudera.impala.analysis.LikePredicate.clone ( )
inline
static <CextendsExpr> ArrayList<C> com.cloudera.impala.analysis.Expr.cloneList ( Iterable< C >  l)
inlinestaticinherited

Create a deep copy of 'l'. The elements of the returned list are of the same type as the input list.

Definition at line 798 of file Expr.java.

Referenced by com.cloudera.impala.planner.DistributedPlanner.createHashJoinFragment().

void com.cloudera.impala.analysis.Expr.computeNumDistinctValues ( )
inlineprotectedinherited
void com.cloudera.impala.analysis.Expr.convertNumericLiteralsFromDecimal ( Analyzer  analyzer) throws AnalysisException
inlineprotectedinherited

Converts numeric literal in the expr tree rooted at this expr to return floating point types instead of decimals, if possible.

Decimal has a higher processing cost than floating point and we should not pay the cost if the user does not require the accuracy. For example: "select float_col + 1.1" would start out with 1.1 as a decimal(2,1) and the float_col would be promoted to a high accuracy decimal. This function will identify this case and treat 1.1 as a float. In the case of "decimal_col + 1.1", 1.1 would remain a decimal. In the case of "float_col + cast(1.1 as decimal(2,1))", the result would be a decimal.

Another way to think about it is that DecimalLiterals are analyzed as returning decimals (of the narrowest precision/scale) and we later convert them to a floating point type when it is consistent with the user's intent.

TODO: another option is to do constant folding in the FE and then apply this rule.

Definition at line 413 of file Expr.java.

References com.cloudera.impala.analysis.Expr.convertNumericLiteralsToFloat(), com.cloudera.impala.catalog.Type.isDecimal(), and com.cloudera.impala.analysis.Expr.isExplicitCastToDecimal().

Referenced by com.cloudera.impala.analysis.ArithmeticExpr.analyze(), and com.cloudera.impala.analysis.BinaryPredicate.analyze().

static String com.cloudera.impala.analysis.Expr.debugString ( List<?extends Expr exprs)
inlinestaticinherited

Definition at line 543 of file Expr.java.

static <CextendsExpr> boolean com.cloudera.impala.analysis.Expr.equalLists ( List< C >  l1,
List< C >  l2 
)
inlinestaticinherited

Return true if l1[i].equals(l2[i]) for all i.

Definition at line 584 of file Expr.java.

Referenced by com.cloudera.impala.analysis.AggregateInfo.createDistinctAggInfo().

boolean com.cloudera.impala.analysis.LikePredicate.equals ( Object  obj)
inline

Definition at line 85 of file LikePredicate.java.

References com.cloudera.impala.analysis.LikePredicate.op_.

static <CextendsExpr> boolean com.cloudera.impala.analysis.Expr.equalSets ( List< C >  l1,
List< C >  l2 
)
inlinestaticinherited

Return true if l1 equals l2 when both lists are interpreted as sets. TODO: come up with something better than O(n^2)?

Definition at line 598 of file Expr.java.

Referenced by com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.isCompatible(), and com.cloudera.impala.planner.AnalyticPlanner.SortGroup.isPrefixOf().

void com.cloudera.impala.analysis.Expr.foldConstantChildren ( Analyzer  analyzer) throws AnalysisException
inlineinherited

Evaluate in the BE the children of 'this' that are constant expressions and substitute them with the evaluation result as LiteralExprs. Modifies 'this' in place and does not re-analyze it. Hence, it is not safe to evaluate the modified expr in the BE as the resolved fn_ may be incorrect given the new arguments.

Throws an AnalysisException if the evaluation fails in the BE.

TODO: Used only during partition pruning. Convert it to a generic constant expression folding function to be used during the analysis.

Definition at line 1134 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isAnalyzed_, and com.cloudera.impala.analysis.Expr.isLiteral().

SlotRef com.cloudera.impala.analysis.Predicate.getBoundSlot ( )
inlineinherited

Returns the SlotRef bound by this Predicate.

Definition at line 95 of file Predicate.java.

Referenced by com.cloudera.impala.analysis.CompoundPredicate.getBoundSlots().

List<Expr> com.cloudera.impala.analysis.Expr.getConjuncts ( )
inlineinherited

Gather conjuncts from this expr and return them in a list. A conjunct is an expr that returns a boolean, e.g., Predicates, function calls, SlotRefs, etc. Hence, this method is placed here and not in Predicate.

Definition at line 662 of file Expr.java.

Referenced by com.cloudera.impala.analysis.TableRef.analyzeJoin(), com.cloudera.impala.analysis.StmtRewriter.canEliminate(), com.cloudera.impala.analysis.StmtRewriter.mergeExpr(), com.cloudera.impala.analysis.Analyzer.registerConjuncts(), com.cloudera.impala.analysis.Analyzer.registerOnClauseConjuncts(), and com.cloudera.impala.analysis.StmtRewriter.rewriteWhereClauseSubqueries().

Pair<SlotId, SlotId> com.cloudera.impala.analysis.Predicate.getEqSlots ( )
inlineinherited

If predicate is of the form "<slotref> = <slotref>", returns both SlotRefs, otherwise returns null.

Definition at line 90 of file Predicate.java.

void com.cloudera.impala.analysis.Expr.getIds ( List< TupleId tupleIds,
List< SlotId slotIds 
)
inlineinherited

Definition at line 883 of file Expr.java.

References com.cloudera.impala.analysis.Expr.getIdsHelper().

static <CextendsExpr> void com.cloudera.impala.analysis.Expr.getIds ( List<?extends Expr exprs,
List< TupleId tupleIds,
List< SlotId slotIds 
)
inlinestaticinherited

Definition at line 897 of file Expr.java.

void com.cloudera.impala.analysis.Expr.getIdsHelper ( Set< TupleId tupleIds,
Set< SlotId slotIds 
)
inlineprotectedinherited

Definition at line 891 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Expr.getIds().

long com.cloudera.impala.analysis.Expr.getNumDistinctValues ( )
inlineinherited
static long com.cloudera.impala.analysis.Expr.getNumDistinctValues ( List< Expr exprs)
inlinestaticinherited

Returns the product of the given exprs' number of distinct values or -1 if any of the exprs have an invalid number of distinct values.

Definition at line 502 of file Expr.java.

Type com.cloudera.impala.analysis.Expr.getResolvedWildCardType ( ) throws AnalysisException
inlinepackageinherited

Returns the max resolution type of all the wild card decimal types. Returns null if there are no wild card types.

Definition at line 336 of file Expr.java.

References com.cloudera.impala.catalog.Type.isNull(), com.cloudera.impala.catalog.Type.isWildcardDecimal(), and com.cloudera.impala.analysis.Expr.type_.

Referenced by com.cloudera.impala.analysis.Expr.castForFunctionCall().

double com.cloudera.impala.analysis.Expr.getSelectivity ( )
inlineinherited

Definition at line 189 of file Expr.java.

References com.cloudera.impala.analysis.Expr.selectivity_.

Subquery com.cloudera.impala.analysis.Expr.getSubquery ( )
inlineinherited

Returns the subquery of an expr. Returns null if this expr does not contain a subquery.

TODO: Support predicates with more that one subqueries when we implement the independent subquery evaluation.

Definition at line 1114 of file Expr.java.

Type com.cloudera.impala.analysis.Expr.getType ( )
inlineinherited

Definition at line 188 of file Expr.java.

References com.cloudera.impala.analysis.Expr.type_.

Referenced by com.cloudera.impala.analysis.Subquery.analyze(), com.cloudera.impala.analysis.IsNullPredicate.analyze(), com.cloudera.impala.analysis.LimitElement.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), com.cloudera.impala.analysis.TimestampArithmeticExpr.analyze(), com.cloudera.impala.analysis.BinaryPredicate.analyze(), com.cloudera.impala.analysis.CastExpr.analyze(), com.cloudera.impala.analysis.CaseExpr.analyze(), com.cloudera.impala.analysis.AnalyticExpr.analyze(), com.cloudera.impala.analysis.FunctionCallExpr.analyze(), com.cloudera.impala.analysis.AnalyzeExprsTest.checkCasts(), com.cloudera.impala.analysis.AnalyticInfo.checkConsistency(), com.cloudera.impala.analysis.AggregateInfo.checkConsistency(), com.cloudera.impala.analysis.AnalyticWindow.checkOffsetBoundaries(), com.cloudera.impala.analysis.AnalyticExpr.checkRangeOffsetBoundaryExpr(), com.cloudera.impala.analysis.Subquery.createStructTypeFromExprList(), com.cloudera.impala.analysis.InlineViewRef.createTupleDescriptor(), com.cloudera.impala.catalog.ColumnStats.fromExpr(), com.cloudera.impala.planner.DataSourceScanNode.getDisjunctsHelper(), com.cloudera.impala.analysis.Expr.isExplicitCastToDecimal(), com.cloudera.impala.analysis.Expr.isScalarSubquery(), com.cloudera.impala.planner.DataSourceScanNode.literalToColumnValue(), com.cloudera.impala.analysis.Subquery.returnsScalarColumn(), com.cloudera.impala.analysis.QueryStmt.substituteOrdinals(), com.cloudera.impala.analysis.Expr.trySubstitute(), and com.cloudera.impala.analysis.AnalyzeExprsTest.typeCastTest().

int com.cloudera.impala.analysis.Expr.hashCode ( )
inlineinherited

Definition at line 649 of file Expr.java.

References com.cloudera.impala.analysis.Expr.id_.

Expr com.cloudera.impala.analysis.Expr.ignoreImplicitCast ( )
inlineinherited

Returns child expr if this expr is an implicit cast, otherwise returns 'this'.

Definition at line 1034 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isImplicitCast().

static void com.cloudera.impala.analysis.LikePredicate.initBuiltins ( Db  db)
inlinestatic
static <CextendsExpr> List<C> com.cloudera.impala.analysis.Expr.intersect ( List< C >  l1,
List< C >  l2 
)
inlinestaticinherited

Return the intersection of l1 and l2.599

Definition at line 614 of file Expr.java.

static void com.cloudera.impala.analysis.Expr.intersect ( Analyzer  analyzer,
List< Expr l1,
List< Expr l2,
ExprSubstitutionMap  smap,
List< Expr i1,
List< Expr i2 
)
inlinestaticinherited

Compute the intersection of l1 and l2, given the smap, and return the intersecting l1 elements in i1 and the intersecting l2 elements in i2.

Definition at line 626 of file Expr.java.

References com.cloudera.impala.analysis.Expr.equals().

boolean com.cloudera.impala.analysis.Expr.isAggregate ( )
inlineinherited

Definition at line 527 of file Expr.java.

static com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.isAggregatePredicate ( )
inlinestaticinherited
boolean com.cloudera.impala.analysis.Expr.isAuxExpr ( )
inlineinherited
boolean com.cloudera.impala.analysis.Expr.isBound ( TupleId  tid)
inlineinherited

Returns true if expr is fully bound by tid, otherwise false.

Definition at line 845 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isBoundByTupleIds().

Referenced by com.cloudera.impala.analysis.SelectStmt.analyzeAggregation().

boolean com.cloudera.impala.analysis.Expr.isBound ( SlotId  slotId)
inlineinherited

Returns true if expr is fully bound by slotId, otherwise false.

Definition at line 862 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isBoundBySlotIds().

static boolean com.cloudera.impala.analysis.Expr.isBound ( List<?extends Expr exprs,
List< TupleId tids 
)
inlinestaticinherited

Definition at line 876 of file Expr.java.

boolean com.cloudera.impala.analysis.Expr.isBoundBySlotIds ( List< SlotId slotIds)
inlineinherited

Returns true if expr is fully bound by slotIds, otherwise false.

Definition at line 869 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Expr.isBound(), and com.cloudera.impala.planner.HdfsScanNode.prunePartitions().

boolean com.cloudera.impala.analysis.Expr.isBoundByTupleIds ( List< TupleId tids)
inlineinherited
boolean com.cloudera.impala.analysis.Expr.isConstant ( )
inlineinherited
Returns
true if this expr can be evaluated with Expr::GetValue(NULL), ie, if it doesn't contain any references to runtime variables (which at the moment are only slotrefs and subqueries).

Definition at line 917 of file Expr.java.

Referenced by com.cloudera.impala.analysis.PartitionKeyValue.analyze(), com.cloudera.impala.analysis.LimitElement.analyze(), com.cloudera.impala.analysis.Expr.computeNumDistinctValues(), com.cloudera.impala.planner.SingleNodePlanner.createHBaseValueRange(), com.cloudera.impala.analysis.AggregateInfoBase.createTupleDesc(), and com.cloudera.impala.analysis.Analyzer.markConstantConjunct().

boolean com.cloudera.impala.analysis.Predicate.isEqJoinConjunct ( )
inlineinherited

Definition at line 45 of file Predicate.java.

boolean com.cloudera.impala.analysis.Expr.isImplicitCast ( )
inlineinherited
boolean com.cloudera.impala.analysis.Expr.isLiteral ( )
inlineinherited
boolean com.cloudera.impala.analysis.Expr.isNullLiteral ( )
inlineinherited
Returns
true if this expr is either a null literal or a cast from a null literal.

Definition at line 926 of file Expr.java.

Referenced by com.cloudera.impala.analysis.CaseExpr.CaseExpr().

boolean com.cloudera.impala.analysis.Expr.isRegisteredPredicate ( )
inlineinherited
boolean com.cloudera.impala.analysis.Expr.isScalarSubquery ( )
inlineinherited

Return true if this expr is a scalar subquery.

Definition at line 936 of file Expr.java.

References com.cloudera.impala.analysis.Expr.getType(), and com.cloudera.impala.analysis.Expr.isAnalyzed_.

Referenced by com.cloudera.impala.analysis.StmtRewriter.createJoinConjunct().

boolean com.cloudera.impala.analysis.Predicate.isSingleColumnPredicate ( Reference< SlotRef slotRefRef,
Reference< Integer >  idxRef 
)
inlineinherited

Returns true if one of the children is a slotref (possibly wrapped in a cast) and the other children are all constant. Returns the slotref in 'slotRef' and its child index in 'idx'. This will pick up something like "col = 5", but not "2 * col = 10", which is what we want.

Definition at line 64 of file Predicate.java.

Referenced by com.cloudera.impala.analysis.IsNullPredicate.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), and com.cloudera.impala.analysis.BinaryPredicate.analyze().

static <CextendsExpr> boolean com.cloudera.impala.analysis.Expr.isSubset ( List< C >  l1,
List< C >  l2 
)
inlinestaticinherited

Return true if l1 is a subset of l2.

Definition at line 606 of file Expr.java.

Referenced by com.cloudera.impala.planner.DistributedPlanner.createInsertFragment().

boolean com.cloudera.impala.analysis.Expr.isWhereClauseConjunct ( )
inlineinherited
Expr com.cloudera.impala.analysis.Expr.negate ( )
inlineinherited

Negates a boolean Expr.

Definition at line 1102 of file Expr.java.

References com.cloudera.impala.catalog.PrimitiveType.BOOLEAN.

static Expr com.cloudera.impala.analysis.Expr.pushNegationToOperands ( Expr  root)
inlinestaticinherited

Pushes negation to the individual operands of a predicate tree rooted at 'root'.

Definition at line 1076 of file Expr.java.

References com.cloudera.impala.analysis.Expr.IS_NOT_PREDICATE, and com.cloudera.impala.analysis.Expr.NEGATE_FN.

static <CextendsExpr> void com.cloudera.impala.analysis.Expr.removeConstants ( List< C >  l)
inlinestaticinherited

Removes constant exprs

Definition at line 833 of file Expr.java.

static <CextendsExpr> void com.cloudera.impala.analysis.Expr.removeDuplicates ( List< C >  l)
inlinestaticinherited

Removes duplicate exprs (according to equals()).

Definition at line 810 of file Expr.java.

Expr com.cloudera.impala.analysis.Expr.reset ( )
inlineinherited

Resets the internal analysis state of this expr tree. Removes implicit casts.

Definition at line 771 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isImplicitCast(), and com.cloudera.impala.analysis.Expr.resetAnalysisState().

Referenced by com.cloudera.impala.analysis.Expr.resetList().

void com.cloudera.impala.analysis.Expr.resetAnalysisState ( )
inlineprotectedinherited

Resets the internal state of this expr produced by analyze(). Only modifies this expr, and not its child exprs.

Definition at line 766 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isAnalyzed_.

Referenced by com.cloudera.impala.analysis.Expr.reset(), and com.cloudera.impala.analysis.Expr.substituteImpl().

static ArrayList<Expr> com.cloudera.impala.analysis.Expr.resetList ( ArrayList< Expr l)
inlinestaticinherited

Definition at line 780 of file Expr.java.

References com.cloudera.impala.analysis.Expr.reset().

void com.cloudera.impala.analysis.Expr.setId ( ExprId  id)
inlineprotectedinherited

Definition at line 187 of file Expr.java.

void com.cloudera.impala.analysis.Expr.setIsAuxExpr ( )
inlineinherited

Definition at line 196 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isAuxExpr_.

void com.cloudera.impala.analysis.Predicate.setIsEqJoinConjunct ( boolean  v)
inlineinherited

Definition at line 46 of file Predicate.java.

void com.cloudera.impala.analysis.Expr.setIsWhereClauseConjunct ( )
inlineinherited
void com.cloudera.impala.analysis.Expr.setPrintSqlInParens ( boolean  b)
inlineinherited

Definition at line 191 of file Expr.java.

References com.cloudera.impala.analysis.Expr.printSqlInParens_.

Expr com.cloudera.impala.analysis.Expr.substitute ( ExprSubstitutionMap  smap,
Analyzer  analyzer,
boolean  preserveRootType 
)
inlineinherited

Returns an analyzed clone of 'this' with exprs substituted according to smap. Removes implicit casts and analysis state while cloning/substituting exprs within this tree, such that the returned result has minimal implicit casts and types. Expects the analysis of the post-substitution expr to succeed. If smap is null, this function is equivalent to clone(). If preserveRootType is true, the resulting expr tree will be cast if necessary to the type of 'this'.

Definition at line 710 of file Expr.java.

References com.cloudera.impala.analysis.Expr.trySubstitute().

Referenced by com.cloudera.impala.planner.HashJoinNode.init().

Expr com.cloudera.impala.analysis.Expr.substituteImpl ( ExprSubstitutionMap  smap,
Analyzer  analyzer 
) throws AnalysisException
inlineprotectedinherited

Recursive method that performs the actual substitution for try/substitute() while removing implicit casts. Resets the analysis state in all non-SlotRef expressions. Exprs that have non-child exprs which should be affected by substitutions must override this method and apply the substitution to such exprs as well.

Definition at line 745 of file Expr.java.

References com.cloudera.impala.analysis.Expr.isImplicitCast(), and com.cloudera.impala.analysis.Expr.resetAnalysisState().

Referenced by com.cloudera.impala.analysis.BetweenPredicate.substituteImpl().

static ArrayList<Expr> com.cloudera.impala.analysis.Expr.substituteList ( Iterable<?extends Expr exprs,
ExprSubstitutionMap  smap,
Analyzer  analyzer,
boolean  preserveRootTypes 
)
inlinestaticinherited
String com.cloudera.impala.analysis.Expr.toSql ( )
inlineinherited
Returns
SQL syntax corresponding to this node.

Implements com.cloudera.impala.analysis.ParseNode.

Definition at line 449 of file Expr.java.

References com.cloudera.impala.analysis.Expr.printSqlInParens_, and com.cloudera.impala.analysis.Expr.toSqlImpl().

Referenced by com.cloudera.impala.analysis.ExtractFromExpr.analyze(), com.cloudera.impala.analysis.Subquery.analyze(), com.cloudera.impala.analysis.SlotRef.analyze(), com.cloudera.impala.analysis.LimitElement.analyze(), com.cloudera.impala.analysis.LikePredicate.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), com.cloudera.impala.analysis.TimestampArithmeticExpr.analyze(), com.cloudera.impala.analysis.CompoundPredicate.analyze(), com.cloudera.impala.analysis.ArithmeticExpr.analyze(), com.cloudera.impala.analysis.BinaryPredicate.analyze(), com.cloudera.impala.analysis.NumericLiteral.analyze(), com.cloudera.impala.analysis.Expr.analyze(), com.cloudera.impala.analysis.CastExpr.analyze(), com.cloudera.impala.analysis.CaseExpr.analyze(), com.cloudera.impala.analysis.AnalyticExpr.analyze(), com.cloudera.impala.analysis.FunctionCallExpr.analyze(), com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), com.cloudera.impala.analysis.AnalyticExpr.checkOffset(), com.cloudera.impala.analysis.AnalyticExpr.checkRangeOffsetBoundaryExpr(), com.cloudera.impala.analysis.Expr.checkReturnsBool(), com.cloudera.impala.analysis.LiteralExpr.create(), com.cloudera.impala.analysis.StmtRewriter.createJoinConjunct(), com.cloudera.impala.analysis.QueryStmt.createSortInfo(), com.cloudera.impala.analysis.ExtractFromExpr.getFunctionNotFoundError(), com.cloudera.impala.analysis.FunctionCallExpr.getFunctionNotFoundError(), com.cloudera.impala.analysis.Analyzer.registerConjunct(), com.cloudera.impala.analysis.QueryStmt.substituteOrdinals(), com.cloudera.impala.analysis.CaseExpr.toCaseSql(), com.cloudera.impala.analysis.TableRef.toSql(), com.cloudera.impala.analysis.BetweenPredicate.toSqlImpl(), and com.cloudera.impala.analysis.AnalyticExpr.toSqlImpl().

static String com.cloudera.impala.analysis.Expr.toSql ( List<?extends Expr exprs)
inlinestaticinherited

Definition at line 552 of file Expr.java.

String com.cloudera.impala.analysis.LikePredicate.toSqlImpl ( )
inline
void com.cloudera.impala.analysis.LikePredicate.toThrift ( TExprNode  msg)
inlineprotected

Definition at line 96 of file LikePredicate.java.

static List<TExpr> com.cloudera.impala.analysis.Expr.treesToThrift ( List<?extends Expr exprs)
inlinestaticinherited
TExpr com.cloudera.impala.analysis.Expr.treeToThrift ( )
inlineinherited
Expr com.cloudera.impala.analysis.Expr.trySubstitute ( ExprSubstitutionMap  smap,
Analyzer  analyzer,
boolean  preserveRootType 
) throws AnalysisException
inlineinherited

Returns an analyzed clone of 'this' with exprs substituted according to smap. Removes implicit casts and analysis state while cloning/substituting exprs within this tree, such that the returned result has minimal implicit casts and types. Throws if analyzing the post-substitution expr tree failed. If smap is null, this function is equivalent to clone(). If preserveRootType is true, the resulting expr tree will be cast if necessary to the type of 'this'.

Definition at line 689 of file Expr.java.

References com.cloudera.impala.analysis.Expr.clone(), com.cloudera.impala.analysis.Expr.getType(), and com.cloudera.impala.analysis.Expr.type_.

Referenced by com.cloudera.impala.analysis.Expr.substitute().

static ArrayList<Expr> com.cloudera.impala.analysis.Expr.trySubstituteList ( Iterable<?extends Expr exprs,
ExprSubstitutionMap  smap,
Analyzer  analyzer,
boolean  preserveRootTypes 
) throws AnalysisException
inlinestaticinherited

Definition at line 719 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Expr.substituteList().

void com.cloudera.impala.analysis.Expr.uncheckedCastChild ( Type  targetType,
int  childIndex 
) throws AnalysisException
inlineprotectedinherited

Convert child to to targetType, possibly by inserting an implicit cast, or by returning an altogether new expression, or by returning 'this' with a modified return type'.

Parameters
targetTypetype to be cast to
childIndexindex of child to be cast

Definition at line 1024 of file Expr.java.

Referenced by com.cloudera.impala.analysis.IsNullPredicate.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), com.cloudera.impala.analysis.CastExpr.analyze(), and com.cloudera.impala.analysis.FunctionCallExpr.analyze().

Expr com.cloudera.impala.analysis.Expr.uncheckedCastTo ( Type  targetType) throws AnalysisException
inlineprotectedinherited

Create an expression equivalent to 'this' but returning targetType; possibly by inserting an implicit cast, or by returning an altogether new expression or by returning 'this' with a modified return type'.

Parameters
targetTypetype to be cast to
Returns
cast expression, or converted literal, should never return null
Exceptions
AnalysisExceptionwhen an invalid cast is asked for, for example, failure to convert a string literal to a date literal

Definition at line 995 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Expr.castTo().

SlotRef com.cloudera.impala.analysis.Expr.unwrapSlotRef ( boolean  implicitOnly)
inlineinherited

If 'this' is a SlotRef or a Cast that wraps a SlotRef, returns that SlotRef. Otherwise returns null.

Definition at line 1060 of file Expr.java.

Member Data Documentation

final int com.cloudera.impala.analysis.Expr.EXPR_CHILDREN_LIMIT = 10000
staticinherited
final int com.cloudera.impala.analysis.Expr.EXPR_DEPTH_LIMIT = 1000
staticinherited
final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.IS_BUILTIN_AGG_FN
staticinherited
Initial value:
=
new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg instanceof FunctionCallExpr &&
((FunctionCallExpr)arg).getFnName().isBuiltin();
}
}

Definition at line 115 of file Expr.java.

Referenced by com.cloudera.impala.analysis.StmtRewriter.createJoinConjunct().

final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.IS_NOT_PREDICATE
staticinherited
Initial value:
=
new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg instanceof CompoundPredicate &&
((CompoundPredicate)arg).getOp() == CompoundPredicate.Operator.NOT;
}
}

Definition at line 75 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Expr.pushNegationToOperands().

final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.IS_OR_PREDICATE
staticinherited
Initial value:
=
new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg instanceof CompoundPredicate &&
((CompoundPredicate)arg).getOp() == CompoundPredicate.Operator.OR;
}
}

Definition at line 85 of file Expr.java.

Referenced by com.cloudera.impala.analysis.StmtRewriter.canExtractCorrelatedPredicates(), and com.cloudera.impala.analysis.StmtRewriter.hasSubqueryInDisjunction().

final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.IS_SCALAR_SUBQUERY
staticinherited
Initial value:
=
new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg.isScalarSubquery();
}
}

Definition at line 95 of file Expr.java.

Referenced by com.cloudera.impala.analysis.IsNullPredicate.analyze(), and com.cloudera.impala.analysis.StmtRewriter.rewriteWhereClauseSubqueries().

final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.IS_TRUE_LITERAL
staticinherited
Initial value:
=
new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg instanceof BoolLiteral && ((BoolLiteral)arg).getValue();
}
}

Definition at line 124 of file Expr.java.

Referenced by com.cloudera.impala.analysis.StmtRewriter.canEliminate().

boolean com.cloudera.impala.analysis.Expr.isAnalyzed_
protectedinherited

Definition at line 143 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Predicate< com.cloudera.impala.analysis.Expr >.analyze(), com.cloudera.impala.analysis.ExistsPredicate.analyze(), com.cloudera.impala.analysis.TupleIsNullPredicate.analyze(), com.cloudera.impala.analysis.ExtractFromExpr.analyze(), com.cloudera.impala.analysis.BetweenPredicate.analyze(), com.cloudera.impala.analysis.Subquery.analyze(), com.cloudera.impala.analysis.SlotRef.analyze(), com.cloudera.impala.analysis.IsNullPredicate.analyze(), com.cloudera.impala.analysis.LikePredicate.analyze(), com.cloudera.impala.analysis.InPredicate.analyze(), com.cloudera.impala.analysis.TimestampArithmeticExpr.analyze(), com.cloudera.impala.analysis.CompoundPredicate.analyze(), com.cloudera.impala.analysis.ArithmeticExpr.analyze(), com.cloudera.impala.analysis.BinaryPredicate.analyze(), com.cloudera.impala.analysis.NumericLiteral.analyze(), com.cloudera.impala.analysis.CastExpr.analyze(), com.cloudera.impala.analysis.Expr.analyze(), com.cloudera.impala.analysis.CaseExpr.analyze(), com.cloudera.impala.analysis.AnalyticExpr.analyze(), com.cloudera.impala.analysis.FunctionCallExpr.analyze(), com.cloudera.impala.analysis.CastExpr.CastExpr(), com.cloudera.impala.analysis.Expr.Expr(), com.cloudera.impala.analysis.Expr.foldConstantChildren(), com.cloudera.impala.analysis.SlotRef.getDesc(), com.cloudera.impala.analysis.SlotRef.getResolvedPath(), com.cloudera.impala.analysis.BetweenPredicate.getRewrittenPredicate(), com.cloudera.impala.analysis.SlotRef.getSlotId(), com.cloudera.impala.analysis.NumericLiteral.init(), com.cloudera.impala.analysis.SlotRef.isBoundBySlotIds(), com.cloudera.impala.analysis.Expr.isScalarSubquery(), com.cloudera.impala.analysis.NumericLiteral.NumericLiteral(), com.cloudera.impala.analysis.FunctionCallExpr.resetAnalysisState(), com.cloudera.impala.analysis.Expr.resetAnalysisState(), com.cloudera.impala.analysis.SlotRef.SlotRef(), com.cloudera.impala.analysis.Subquery.Subquery(), com.cloudera.impala.analysis.Expr.treeToThriftHelper(), and com.cloudera.impala.analysis.NumericLiteral.uncheckedCastTo().

final com.google.common.base.Predicate<Expr> com.cloudera.impala.analysis.Expr.NON_NULL_EMPTY_AGG
staticinherited
Initial value:
= new com.google.common.base.Predicate<Expr>() {
@Override
public boolean apply(Expr arg) {
return arg instanceof FunctionCallExpr &&
((FunctionCallExpr)arg).returnsNonNullOnEmpty();
}
}

Definition at line 106 of file Expr.java.

Referenced by com.cloudera.impala.analysis.StmtRewriter.createJoinConjunct(), and com.cloudera.impala.analysis.StmtRewriter.mergeExpr().

boolean com.cloudera.impala.analysis.Expr.printSqlInParens_ = false
protectedinherited
Type com.cloudera.impala.analysis.Expr.type_
protectedinherited

Definition at line 142 of file Expr.java.

Referenced by com.cloudera.impala.analysis.Predicate< com.cloudera.impala.analysis.Expr >.analyze(), com.cloudera.impala.analysis.Subquery.analyze(), com.cloudera.impala.analysis.SlotRef.analyze(), com.cloudera.impala.analysis.TimestampArithmeticExpr.analyze(), com.cloudera.impala.analysis.ArithmeticExpr.analyze(), com.cloudera.impala.analysis.NumericLiteral.analyze(), com.cloudera.impala.analysis.CastExpr.analyze(), com.cloudera.impala.analysis.CaseExpr.analyze(), com.cloudera.impala.analysis.AnalyticExpr.analyze(), com.cloudera.impala.analysis.FunctionCallExpr.analyze(), com.cloudera.impala.analysis.BoolLiteral.BoolLiteral(), com.cloudera.impala.analysis.CastExpr.CastExpr(), com.cloudera.impala.analysis.Expr.castTo(), com.cloudera.impala.analysis.Expr.checkReturnsBool(), com.cloudera.impala.analysis.Expr.collectChildReturnTypes(), com.cloudera.impala.analysis.NumericLiteral.debugString(), com.cloudera.impala.analysis.CastExpr.debugString(), com.cloudera.impala.analysis.NumericLiteral.explicitlyCastToFloat(), com.cloudera.impala.analysis.Expr.Expr(), com.cloudera.impala.analysis.ExtractFromExpr.ExtractFromExpr(), com.cloudera.impala.analysis.Expr.getResolvedWildCardType(), com.cloudera.impala.analysis.Expr.getType(), com.cloudera.impala.analysis.NumericLiteral.getUnscaledValue(), com.cloudera.impala.analysis.NullLiteral.NullLiteral(), com.cloudera.impala.analysis.NumericLiteral.NumericLiteral(), com.cloudera.impala.analysis.NullLiteral.resetAnalysisState(), com.cloudera.impala.analysis.SlotRef.SlotRef(), com.cloudera.impala.analysis.AnalyticExpr.standardize(), com.cloudera.impala.analysis.StringLiteral.StringLiteral(), com.cloudera.impala.analysis.Expr.toString(), com.cloudera.impala.analysis.NumericLiteral.toThrift(), com.cloudera.impala.analysis.Expr.treeToThrift(), com.cloudera.impala.analysis.Expr.trySubstitute(), com.cloudera.impala.analysis.NullLiteral.uncheckedCastTo(), com.cloudera.impala.analysis.StringLiteral.uncheckedCastTo(), com.cloudera.impala.analysis.NumericLiteral.uncheckedCastTo(), and com.cloudera.impala.analysis.SlotRef.uncheckedCastTo().


The documentation for this class was generated from the following file: