Skip to content

Commit 71eb569

Browse files
Bharath VissapragadaImpala Public Jenkins
Bharath Vissapragada
authored and
Impala Public Jenkins
committed
Remove deadcode from frontend - Part 1
Change-Id: I3fa810cf4eaf9f9ff545fe80a11bc62619039224 Reviewed-on: http://gerrit.cloudera.org:8080/6172 Reviewed-by: Alex Behm <alex.behm@cloudera.com> Reviewed-by: Ravi Shetye <ravi@cloudera.com> Tested-by: Impala Public Jenkins
1 parent 8b417c6 commit 71eb569

File tree

77 files changed

+3
-557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+3
-557
lines changed

fe/src/main/java/org/apache/impala/analysis/AggregateInfo.java

-31
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,6 @@ private void createDistinctAggInfo(
266266
public AggregateInfo getSecondPhaseDistinctAggInfo() {
267267
return secondPhaseDistinctAggInfo_;
268268
}
269-
public AggPhase getAggPhase() { return aggPhase_; }
270269
public boolean isMerge() { return aggPhase_.isMerge(); }
271270
public boolean isDistinctAgg() { return secondPhaseDistinctAggInfo_ != null; }
272271
public ExprSubstitutionMap getIntermediateSmap() { return intermediateTupleSmap_; }
@@ -297,22 +296,6 @@ public ArrayList<FunctionCallExpr> getMaterializedAggregateExprs() {
297296
return result;
298297
}
299298

300-
/**
301-
* Append ids of all slots that are being referenced in the process
302-
* of performing the aggregate computation described by this AggregateInfo.
303-
*/
304-
public void getRefdSlots(List<SlotId> ids) {
305-
Preconditions.checkState(outputTupleDesc_ != null);
306-
if (groupingExprs_ != null) {
307-
Expr.getIds(groupingExprs_, null, ids);
308-
}
309-
Expr.getIds(aggregateExprs_, null, ids);
310-
// The backend assumes that the entire aggTupleDesc is materialized
311-
for (int i = 0; i < outputTupleDesc_.getSlots().size(); ++i) {
312-
ids.add(outputTupleDesc_.getSlots().get(i).getId());
313-
}
314-
}
315-
316299
/**
317300
* Substitute all the expressions (grouping expr, aggregate expr) and update our
318301
* substitution map according to the given substitution map:
@@ -717,20 +700,6 @@ public void checkConsistency() {
717700
}
718701
}
719702

720-
/**
721-
* Returns DataPartition derived from grouping exprs.
722-
* Returns unpartitioned spec if no grouping.
723-
* TODO: this won't work when we start supporting range partitions,
724-
* because we could derive both hash and order-based partitions
725-
*/
726-
public DataPartition getPartition() {
727-
if (groupingExprs_.isEmpty()) {
728-
return DataPartition.UNPARTITIONED;
729-
} else {
730-
return DataPartition.hashPartitioned(groupingExprs_);
731-
}
732-
}
733-
734703
@Override
735704
public String debugString() {
736705
StringBuilder out = new StringBuilder(super.debugString());

fe/src/main/java/org/apache/impala/analysis/AnalyticExpr.java

-2
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@
6262
* and need to be substituted as such; example: COUNT(COUNT(..)) OVER (..)
6363
*/
6464
public class AnalyticExpr extends Expr {
65-
private final static Logger LOG = LoggerFactory.getLogger(AnalyticExpr.class);
66-
6765
private FunctionCallExpr fnCall_;
6866
private final List<Expr> partitionExprs_;
6967
// These elements are modified to point to the corresponding child exprs to keep them

fe/src/main/java/org/apache/impala/analysis/AnalyticInfo.java

-13
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,6 @@ private List<Expr> computeCommonPartitionExprs() {
125125
return result;
126126
}
127127

128-
/**
129-
* Append ids of all slots that are being referenced in the process
130-
* of performing the analytic computation described by this AnalyticInfo.
131-
*/
132-
public void getRefdSlots(List<SlotId> ids) {
133-
Preconditions.checkState(intermediateTupleDesc_ != null);
134-
Expr.getIds(analyticExprs_, null, ids);
135-
// The backend assumes that the entire intermediateTupleDesc is materialized
136-
for (SlotDescriptor slotDesc: intermediateTupleDesc_.getSlots()) {
137-
ids.add(slotDesc.getId());
138-
}
139-
}
140-
141128
@Override
142129
public void materializeRequiredSlots(Analyzer analyzer, ExprSubstitutionMap smap) {
143130
materializedSlots_.clear();

fe/src/main/java/org/apache/impala/analysis/Analyzer.java

-89
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public void setIsSubquery() {
165165
isSubquery_ = true;
166166
globalState_.containsSubquery = true;
167167
}
168-
public boolean isSubquery() { return isSubquery_; }
169168
public boolean setHasPlanHints() { return globalState_.hasPlanHints = true; }
170169
public boolean hasPlanHints() { return globalState_.hasPlanHints; }
171170
public void setIsWithClause() { isWithClause_ = true; }
@@ -316,12 +315,6 @@ public GlobalState(ImpaladCatalog catalog, TQueryCtx queryCtx,
316315

317316
public boolean containsSubquery() { return globalState_.containsSubquery; }
318317

319-
/**
320-
* Helper function to reset the global state information about the existence of
321-
* subqueries.
322-
*/
323-
public void resetSubquery() { globalState_.containsSubquery = false; }
324-
325318
// An analyzer stores analysis state for a single select block. A select block can be
326319
// a top level select statement, or an inline view select block.
327320
// ancestors contains the Analyzers of the enclosing select blocks of 'this'
@@ -1587,35 +1580,6 @@ public ArrayList<Expr> getBoundPredicates(TupleId destTid) {
15871580
return getBoundPredicates(destTid, new HashSet<SlotId>(), true);
15881581
}
15891582

1590-
/**
1591-
* Modifies the analysis state associated with the rhs table ref of an outer join
1592-
* to accomodate a join inversion that changes the rhs table ref of the join from
1593-
* oldRhsTbl to newRhsTbl.
1594-
* TODO: Revisit this function and how outer joins are inverted. This function
1595-
* should not be necessary because the semantics of an inverted outer join do
1596-
* not change. This function will naturally become obsolete when we can transform
1597-
* outer joins with otherPredicates into inner joins.
1598-
*/
1599-
public void invertOuterJoinState(TableRef oldRhsTbl, TableRef newRhsTbl) {
1600-
Preconditions.checkState(oldRhsTbl.getJoinOp().isOuterJoin());
1601-
// Invert analysis state for an outer join.
1602-
List<ExprId> conjunctIds =
1603-
globalState_.conjunctsByOjClause.remove(oldRhsTbl.getId());
1604-
if (conjunctIds != null) {
1605-
globalState_.conjunctsByOjClause.put(newRhsTbl.getId(), conjunctIds);
1606-
for (ExprId eid: conjunctIds) {
1607-
globalState_.ojClauseByConjunct.put(eid, newRhsTbl);
1608-
}
1609-
} else {
1610-
// An outer join is allowed not to have an On-clause if the rhs table ref is
1611-
// correlated or relative.
1612-
Preconditions.checkState(oldRhsTbl.isCorrelated() || oldRhsTbl.isRelative());
1613-
}
1614-
for (Map.Entry<TupleId, TableRef> e: globalState_.outerJoinedTupleIds.entrySet()) {
1615-
if (e.getValue() == oldRhsTbl) e.setValue(newRhsTbl);
1616-
}
1617-
}
1618-
16191583
/**
16201584
* For each equivalence class, adds/removes predicates from conjuncts such that it
16211585
* contains a minimum set of <lhsSlot> = <rhsSlot> predicates that establish the known
@@ -2086,11 +2050,6 @@ public EquivalenceClassId getEquivClassId(SlotId slotId) {
20862050
return globalState_.equivClassBySlotId.get(slotId);
20872051
}
20882052

2089-
public Collection<SlotId> getEquivSlots(SlotId slotId) {
2090-
EquivalenceClassId classId = globalState_.equivClassBySlotId.get(slotId);
2091-
return globalState_.equivClassMembers.get(classId);
2092-
}
2093-
20942053
public ExprSubstitutionMap getEquivClassSmap() { return globalState_.equivClassSmap; }
20952054

20962055
/**
@@ -2117,27 +2076,6 @@ public boolean equivExprs(Expr e1, Expr e2) {
21172076
return substE1.equals(substE2);
21182077
}
21192078

2120-
/**
2121-
* Removes redundant expressions from exprs based on equivalence classes, as follows:
2122-
* First, normalizes the exprs using the canonical SlotRef representative of each
2123-
* equivalence class. Then retains the first original element of exprs that is
2124-
* non-redundant in the normalized exprs. Returns a new list with the unique exprs.
2125-
*/
2126-
public List<Expr> removeRedundantExprs(List<Expr> exprs) {
2127-
List<Expr> result = Lists.newArrayList();
2128-
List<Expr> normalizedExprs =
2129-
Expr.substituteList(exprs, globalState_.equivClassSmap, this, false);
2130-
Preconditions.checkState(exprs.size() == normalizedExprs.size());
2131-
List<Expr> uniqueExprs = Lists.newArrayList();
2132-
for (int i = 0; i < normalizedExprs.size(); ++i) {
2133-
if (!uniqueExprs.contains(normalizedExprs.get(i))) {
2134-
uniqueExprs.add(normalizedExprs.get(i));
2135-
result.add(exprs.get(i).clone());
2136-
}
2137-
}
2138-
return result;
2139-
}
2140-
21412079
/**
21422080
* Mark predicates as assigned.
21432081
*/
@@ -2155,10 +2093,6 @@ public void markConjunctAssigned(Expr conjunct) {
21552093
globalState_.assignedConjuncts.add(conjunct.getId());
21562094
}
21572095

2158-
public boolean isConjunctAssigned(Expr conjunct) {
2159-
return globalState_.assignedConjuncts.contains(conjunct.getId());
2160-
}
2161-
21622096
public Set<ExprId> getAssignedConjuncts() {
21632097
return Sets.newHashSet(globalState_.assignedConjuncts);
21642098
}
@@ -2167,19 +2101,6 @@ public void setAssignedConjuncts(Set<ExprId> assigned) {
21672101
globalState_.assignedConjuncts = Sets.newHashSet(assigned);
21682102
}
21692103

2170-
/**
2171-
* Return true if there's at least one unassigned non-auxiliary conjunct.
2172-
*/
2173-
public boolean hasUnassignedConjuncts() {
2174-
for (ExprId id: globalState_.conjuncts.keySet()) {
2175-
if (globalState_.assignedConjuncts.contains(id)) continue;
2176-
Expr e = globalState_.conjuncts.get(id);
2177-
if (e.isAuxExpr()) continue;
2178-
return true;
2179-
}
2180-
return false;
2181-
}
2182-
21832104
/**
21842105
* Mark all slots that are referenced in exprs as materialized.
21852106
*/
@@ -2486,10 +2407,6 @@ public String getTargetDbName(TableName tableName) {
24862407
return tableName.isFullyQualified() ? tableName.getDb() : getDefaultDb();
24872408
}
24882409

2489-
public String getTargetDbName(FunctionName fnName) {
2490-
return fnName.isFullyQualified() ? fnName.getDb() : getDefaultDb();
2491-
}
2492-
24932410
/**
24942411
* Returns the fully-qualified table name of tableName. If tableName
24952412
* is already fully qualified, returns tableName.
@@ -2519,12 +2436,6 @@ public void setHasLimitOffsetClause(boolean hasLimitOffset) {
25192436
public List<Expr> getConjuncts() {
25202437
return new ArrayList<Expr>(globalState_.conjuncts.values());
25212438
}
2522-
public Expr getConjunct(ExprId exprId) {
2523-
return globalState_.conjuncts.get(exprId);
2524-
}
2525-
public Map<TupleId, List<ExprId>> getEqJoinConjuncts() {
2526-
return globalState_.eqJoinConjuncts;
2527-
}
25282439

25292440
public int incrementCallDepth() { return ++callDepth_; }
25302441
public int decrementCallDepth() { return --callDepth_; }

fe/src/main/java/org/apache/impala/analysis/BinaryPredicate.java

-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
*
4545
*/
4646
public class BinaryPredicate extends Predicate {
47-
private final static Logger LOG = LoggerFactory.getLogger(BinaryPredicate.class);
48-
4947
// true if this BinaryPredicate is inferred from slot equivalences, false otherwise.
5048
private boolean isInferred_ = false;
5149

fe/src/main/java/org/apache/impala/analysis/CollectionStructType.java

-1
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,4 @@ public static CollectionStructType createMapStructType(MapType mapType) {
7575

7676
public StructField getOptionalField() { return optionalField_; }
7777
public boolean isMapStruct() { return isMapStruct_; }
78-
public boolean isArrayStruct() { return !isMapStruct_; }
7978
}

fe/src/main/java/org/apache/impala/analysis/CompoundPredicate.java

-17
Original file line numberDiff line numberDiff line change
@@ -158,23 +158,6 @@ protected void analyzeImpl(Analyzer analyzer) throws AnalysisException {
158158
selectivity_ = Math.max(0.0, Math.min(1.0, selectivity_));
159159
}
160160

161-
/**
162-
* Retrieve the slots bound by BinaryPredicate, InPredicate and
163-
* CompoundPredicates in the subtree rooted at 'this'.
164-
*/
165-
public ArrayList<SlotRef> getBoundSlots() {
166-
ArrayList<SlotRef> slots = Lists.newArrayList();
167-
for (int i = 0; i < getChildren().size(); ++i) {
168-
if (getChild(i) instanceof BinaryPredicate ||
169-
getChild(i) instanceof InPredicate) {
170-
slots.add(((Predicate)getChild(i)).getBoundSlot());
171-
} else if (getChild(i) instanceof CompoundPredicate) {
172-
slots.addAll(((CompoundPredicate)getChild(i)).getBoundSlots());
173-
}
174-
}
175-
return slots;
176-
}
177-
178161
/**
179162
* Negates a CompoundPredicate.
180163
*/

fe/src/main/java/org/apache/impala/analysis/CreateDbStmt.java

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public CreateDbStmt(String dbName, String comment, HdfsUri location,
5858
public String getComment() { return comment_; }
5959
public String getDb() { return dbName_; }
6060
public boolean getIfNotExists() { return ifNotExists_; }
61-
public HdfsUri getLocation() { return location_; }
6261

6362
@Override
6463
public String toSql() {

fe/src/main/java/org/apache/impala/analysis/CreateFunctionStmtBase.java

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ protected CreateFunctionStmtBase(FunctionName fnName, FunctionArgs args,
8383
optArgs_ = optArgs;
8484
}
8585

86-
public String getComment() { return optArgs_.get(OptArg.COMMENT); }
8786
public boolean getIfNotExists() { return ifNotExists_; }
8887
public boolean hasSignature() { return args_ != null; }
8988

fe/src/main/java/org/apache/impala/analysis/CreateOrAlterViewStmtBase.java

-3
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ public String getOwner() {
200200
return owner_;
201201
}
202202

203-
public List<ColumnDef> getColumnDescs() {return columnDefs_; }
204-
public String getComment() { return comment_; }
205203
public boolean getIfNotExists() { return ifNotExists_; }
206-
public String getOriginalViewDef() { return originalViewDef_; }
207204
public String getInlineViewDef() { return inlineViewDef_; }
208205
public String getTbl() { return tableName_.getTbl(); }
209206
}

fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ public CreateTableLikeStmt(TableName tableName, TableName srcTableName,
7676
public String getSrcTbl() { return srcTableName_.getTbl(); }
7777
public boolean isExternal() { return isExternal_; }
7878
public boolean getIfNotExists() { return ifNotExists_; }
79-
public String getComment() { return comment_; }
8079
public THdfsFileFormat getFileFormat() { return fileFormat_; }
8180
public HdfsUri getLocation() { return location_; }
8281

fe/src/main/java/org/apache/impala/analysis/DescribeDbStmt.java

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ public String toSql() {
5555
}
5656

5757
public String getDb() { return dbName_; }
58-
public TDescribeOutputStyle getOutputStyle() { return outputStyle_; }
5958

6059
@Override
6160
public void analyze(Analyzer analyzer) throws AnalysisException {

fe/src/main/java/org/apache/impala/analysis/DescriptorTable.java

-14
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,9 @@ public SlotDescriptor copySlotDescriptor(TupleDescriptor dest, SlotDescriptor sr
101101

102102
public TupleDescriptor getTupleDesc(TupleId id) { return tupleDescs_.get(id); }
103103
public SlotDescriptor getSlotDesc(SlotId id) { return slotDescs_.get(id); }
104-
public Collection<TupleDescriptor> getTupleDescs() { return tupleDescs_.values(); }
105104
public Collection<SlotDescriptor> getSlotDescs() { return slotDescs_.values(); }
106-
public TupleId getMaxTupleId() { return tupleIdGenerator_.getMaxId(); }
107105
public SlotId getMaxSlotId() { return slotIdGenerator_.getMaxId(); }
108106

109-
public Table getTargetTable() { return targetTable_; }
110107
public void setTargetTable(Table table) { targetTable_ = table; }
111108

112109
/**
@@ -139,17 +136,6 @@ public void markSlotsMaterialized(List<SlotId> ids) {
139136
}
140137
}
141138

142-
/**
143-
* Return all ids in slotIds that belong to tupleId.
144-
*/
145-
public List<SlotId> getTupleSlotIds(List<SlotId> slotIds, TupleId tupleId) {
146-
List<SlotId> result = Lists.newArrayList();
147-
for (SlotId id: slotIds) {
148-
if (getSlotDesc(id).getParent().getId().equals(tupleId)) result.add(id);
149-
}
150-
return result;
151-
}
152-
153139
/**
154140
* Computes physical layout parameters of all descriptors.
155141
* Call this only after the last descriptor was added.

fe/src/main/java/org/apache/impala/analysis/DropFunctionStmt.java

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public DropFunctionStmt(FunctionName fnName, FunctionArgs fnArgs, boolean ifExis
5151
ifExists_ = ifExists;
5252
}
5353

54-
public FunctionName getFunction() { return desc_.getFunctionName(); }
5554
public boolean getIfExists() { return ifExists_; }
5655
private boolean hasSignature() { return fnArgs_ != null; }
5756

fe/src/main/java/org/apache/impala/analysis/ExistsPredicate.java

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
* Class representing a [NOT] EXISTS predicate.
2929
*/
3030
public class ExistsPredicate extends Predicate {
31-
private final static Logger LOG = LoggerFactory.getLogger(
32-
ExistsPredicate.class);
3331
private boolean notExists_ = false;
3432

3533
public boolean isNotExists() { return notExists_; }

0 commit comments

Comments
 (0)