MCPcopy Create free account
hub / github.com/apache/impala / Expr

Class Expr

fe/src/main/java/org/apache/impala/analysis/Expr.java:66–2066  ·  view source on GitHub ↗

Root of the expr node hierarchy.

Source from the content-addressed store, hash-verified

64 * Root of the expr node hierarchy.
65 */
66abstract public class Expr extends TreeNode<Expr> implements ParseNode, Cloneable {
67 private static final Logger LOG = LoggerFactory.getLogger(Expr.class);
68
69 // Limits on the number of expr children and the depth of an expr tree. These maximum
70 // values guard against crashes due to stack overflows (IMPALA-432) and were
71 // experimentally determined to be safe.
72 public static final int EXPR_CHILDREN_LIMIT = 10000;
73 // The expr depth limit is mostly due to our recursive implementation of clone().
74 public static final int EXPR_DEPTH_LIMIT = 1000;
75
76 // Name of the function that needs to be implemented by every Expr that
77 // supports negation.
78 private static final String NEGATE_FN = "negate";
79
80 // To be used where we cannot come up with a better estimate (selectivity_ is -1).
81 public static final double DEFAULT_SELECTIVITY = 0.1;
82
83 // The relative costs of different Exprs. These numbers are not intended as a precise
84 // reflection of running times, but as simple heuristics for ordering Exprs from cheap
85 // to expensive.
86 // TODO(tmwarshall): Get these costs in a more principled way, eg. with a benchmark.
87 public static final float ARITHMETIC_OP_COST = 1;
88 public static final float BINARY_PREDICATE_COST = 1;
89 public static final float VAR_LEN_BINARY_PREDICATE_COST = 5;
90 public static final float COMPOUND_PREDICATE_COST = 1;
91 public static final float FUNCTION_CALL_COST = 10;
92 public static final float JAVA_FUNCTION_CALL_COST = 100;
93 public static final float IS_NOT_EMPTY_COST = 1;
94 public static final float IS_NULL_COST = 1;
95 public static final float LIKE_COST = 10;
96 public static final float LITERAL_COST = 1;
97 public static final float SLOT_REF_COST = 1;
98 public static final float TIMESTAMP_ARITHMETIC_COST = 5;
99 public static final float UNKNOWN_COST = -1;
100
101 // Arbitrary max exprs considered for constant propagation due to O(n^2) complexity.
102 private static final int CONST_PROPAGATION_EXPR_LIMIT = 200;
103
104 // To be used when estimating the cost of Exprs of type string where we don't otherwise
105 // have an estimate of how long the strings produced by that Expr are.
106 public static final int DEFAULT_AVG_STRING_LENGTH = 5;
107
108 // returns true if an Expr is a non-analytic aggregate.
109 public static final com.google.common.base.Predicate<Expr> IS_AGGREGATE =
110 new com.google.common.base.Predicate<Expr>() {
111 @Override
112 public boolean apply(Expr arg) {
113 return arg instanceof FunctionCallExpr &&
114 ((FunctionCallExpr)arg).isAggregateFunction();
115 }
116 };
117
118 // Returns true if an Expr is a NOT CompoundPredicate.
119 public static final com.google.common.base.Predicate<Expr> IS_NOT_PREDICATE =
120 new com.google.common.base.Predicate<Expr>() {
121 @Override
122 public boolean apply(Expr arg) {
123 return arg instanceof CompoundPredicate &&

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected