15 package com.cloudera.impala.analysis;
17 import java.util.ArrayList;
18 import java.util.List;
23 import com.google.common.base.Joiner;
24 import com.google.common.base.Preconditions;
25 import com.google.common.collect.Lists;
46 private final ArrayList<View>
views_;
49 Preconditions.checkNotNull(views);
50 Preconditions.checkState(!views.isEmpty());
58 Preconditions.checkNotNull(other);
59 views_ = Lists.newArrayList();
76 Analyzer withClauseAnalyzer = Analyzer.createWithNewGlobalState(analyzer);
77 if (analyzer.isExplain()) withClauseAnalyzer.
setIsExplain();
81 view.getQueryStmt().
analyze(viewAnalyzer);
83 withClauseAnalyzer.registerLocalView(view);
87 analyzer.registerLocalView(localView);
91 analyzer.getAccessEvents().addAll(withClauseAnalyzer.
getAccessEvents());
95 analyzer.registerPrivReq(req);
99 if (analyzer.isRootAnalyzer()) {
100 analyzer.getMissingTbls().addAll(withClauseAnalyzer.
getMissingTbls());
110 List<String> viewStrings = Lists.newArrayList();
114 String aliasSql = ToSqlUtils.getIdentSql(view.getName());
115 viewStrings.add(aliasSql +
" AS (" + view.getQueryStmt().
toSql() +
")");
117 return "WITH " + Joiner.on(
",").join(viewStrings);
Set< TAccessEvent > getAccessEvents()
WithClause(ArrayList< View > views)
Set< TableName > getMissingTbls()
WithClause(WithClause other)
Map< String, View > getLocalViews()
ImmutableList< PrivilegeRequest > getPrivilegeReqs()
void analyze(Analyzer analyzer)
final ArrayList< View > views_