Skip to content

Commit

Permalink
fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
msbt committed Feb 23, 2015
1 parent bd7ba41 commit 7deb93a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
package io.crate.analyze;

import io.crate.analyze.relations.QueriedRelation;
import io.crate.analyze.relations.RelationAnalysisContext;
import io.crate.analyze.relations.RelationAnalyzer;
import io.crate.sql.tree.DefaultTraversalVisitor;
import io.crate.sql.tree.Query;
Expand All @@ -41,9 +40,7 @@ public SelectStatementAnalyzer(RelationAnalyzer relationAnalyzer) {

@Override
protected SelectAnalyzedStatement visitQuery(Query node, Analysis analysis) {
// TODO: make RelationAnalyzer a singleton
RelationAnalysisContext relationAnalysisContext = new RelationAnalysisContext(analysis.parameterContext());
QueriedRelation relation = (QueriedRelation) relationAnalyzer.process(node.getQueryBody(), relationAnalysisContext);
QueriedRelation relation = (QueriedRelation) relationAnalyzer.analyze(node.getQueryBody(), analysis);
if (relation == null) {
throw new UnsupportedOperationException(String.format("Unsupported SELECT statement %s", node));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
import io.crate.analyze.*;
import io.crate.analyze.expressions.ExpressionAnalysisContext;
import io.crate.analyze.expressions.ExpressionAnalyzer;
import io.crate.analyze.relations.select.SelectAnalyzer;
import io.crate.analyze.validator.GroupBySymbolValidator;
import io.crate.analyze.validator.HavingSymbolValidator;
Expand Down Expand Up @@ -94,10 +92,6 @@ protected AnalyzedRelation visitQuerySpecification(QuerySpecification node, Rela
for (Relation relation : node.getFrom()) {
process(relation, context);
}
FieldProvider fieldProvider = new FullQualifedNameFieldProvider(context.sources());
expressionAnalyzer = new ExpressionAnalyzer(analysisMetaData, context.parameterContext(), fieldProvider);
expressionAnalysisContext = new ExpressionAnalysisContext();

WhereClause whereClause = analyzeWhere(node.getWhere(), context);
if (whereClause.hasQuery()) {
WhereClauseValidator whereClauseValidator = new WhereClauseValidator();
Expand All @@ -106,7 +100,7 @@ protected AnalyzedRelation visitQuerySpecification(QuerySpecification node, Rela
SelectAnalyzer.SelectAnalysis selectAnalysis = SelectAnalyzer.analyzeSelect(node.getSelect(), context);
List<Symbol> groupBy = analyzeGroupBy(selectAnalysis, node.getGroupBy(), context);

if (!node.getGroupBy().isEmpty() || expressionAnalysisContext.hasAggregates) {
if (!node.getGroupBy().isEmpty() || context.expressionAnalysisContext().hasAggregates) {
ensureNonAggregatesInGroupBy(selectAnalysis.outputSymbols(), groupBy);
}
if (node.getSelect().isDistinct() && groupBy.isEmpty()) {
Expand All @@ -121,7 +115,7 @@ protected AnalyzedRelation visitQuerySpecification(QuerySpecification node, Rela
.outputs(selectAnalysis.outputSymbols())
.where(whereClause)
.groupBy(groupBy)
.hasAggregates(expressionAnalysisContext.hasAggregates);
.hasAggregates(context.expressionAnalysisContext().hasAggregates);

if (context.sources().size()==1){
Map.Entry<QualifiedName, AnalyzedRelation> entry = Iterables.getOnlyElement(context.sources().entrySet());
Expand Down

0 comments on commit 7deb93a

Please sign in to comment.