Package org.teiid.translator.mongodb
Class MongoDBSelectVisitor
- java.lang.Object
-
- org.teiid.language.visitor.AbstractLanguageVisitor
-
- org.teiid.language.visitor.HierarchyVisitor
-
- org.teiid.translator.mongodb.MongoDBSelectVisitor
-
- All Implemented Interfaces:
LanguageObjectVisitor
- Direct Known Subclasses:
MongoDBUpdateVisitor
public class MongoDBSelectVisitor extends HierarchyVisitor
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList<TranslatorException>
exceptions
protected MongoDBExecutionFactory
executionFactory
protected ConcurrentHashMap<Object,org.teiid.translator.mongodb.ColumnDetail>
expressionMap
protected com.mongodb.BasicDBObject
group
protected com.mongodb.DBObject
having
protected LinkedList<org.teiid.translator.mongodb.MongoDocument>
joinedDocuments
protected Integer
limit
protected com.mongodb.DBObject
match
protected MergePlanner
mergePlanner
protected RuntimeMetadata
metadata
protected org.teiid.translator.mongodb.MongoDocument
mongoDoc
protected Stack<Object>
onGoingExpression
protected ArrayList<Condition>
pendingConditions
protected com.mongodb.BasicDBObject
project
protected boolean
projectBeforeMatch
protected ArrayList<String>
selectColumnReferences
protected ArrayList<String>
selectColumns
protected Integer
skip
protected com.mongodb.DBObject
sort
-
Constructor Summary
Constructors Constructor Description MongoDBSelectVisitor(MongoDBExecutionFactory executionFactory, RuntimeMetadata metadata)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
append(List<? extends LanguageObject> items)
Simple utility to append a list of language objects to the current buffer by creating a comma-separated list.void
append(LanguageObject obj)
Appends the string form of the LanguageObject to the current buffer.protected void
append(LanguageObject[] items)
Simple utility to append an array of language objects to the current buffer by creating a comma-separated list.protected void
buildComparisionQuery(Comparison obj, Object rightExpr, com.mongodb.QueryBuilder query)
protected com.mongodb.BasicDBObject
buildFunctionQuery(Comparison obj, com.mongodb.BasicDBObject leftExpr, Object rightExpr)
protected com.mongodb.QueryBuilder
buildInQuery(In obj, com.mongodb.QueryBuilder query)
protected com.mongodb.QueryBuilder
buildIsNullQuery(IsNull obj, com.mongodb.QueryBuilder query)
protected com.mongodb.QueryBuilder
buildLikeQuery(Like obj, com.mongodb.QueryBuilder query)
String
getColumnName(ColumnReference obj)
void
visit(AggregateFunction obj)
void
visit(AndOr obj)
void
visit(Array array)
void
visit(ColumnReference obj)
void
visit(Comparison obj)
void
visit(DerivedColumn obj)
void
visit(Function obj)
void
visit(GroupBy obj)
void
visit(In obj)
void
visit(IsNull obj)
void
visit(Join obj)
void
visit(Like obj)
void
visit(Limit obj)
void
visit(Literal obj)
void
visit(NamedTable obj)
void
visit(OrderBy obj)
void
visit(Select obj)
void
visit(SortSpecification obj)
-
Methods inherited from class org.teiid.language.visitor.HierarchyVisitor
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
-
Methods inherited from class org.teiid.language.visitor.AbstractLanguageVisitor
visit, visit, visit, visitNode, visitNodes, visitNodes
-
-
-
-
Field Detail
-
executionFactory
protected MongoDBExecutionFactory executionFactory
-
metadata
protected RuntimeMetadata metadata
-
exceptions
protected ArrayList<TranslatorException> exceptions
-
expressionMap
protected ConcurrentHashMap<Object,org.teiid.translator.mongodb.ColumnDetail> expressionMap
-
mongoDoc
protected org.teiid.translator.mongodb.MongoDocument mongoDoc
-
project
protected com.mongodb.BasicDBObject project
-
limit
protected Integer limit
-
skip
protected Integer skip
-
sort
protected com.mongodb.DBObject sort
-
match
protected com.mongodb.DBObject match
-
having
protected com.mongodb.DBObject having
-
group
protected com.mongodb.BasicDBObject group
-
projectBeforeMatch
protected boolean projectBeforeMatch
-
mergePlanner
protected MergePlanner mergePlanner
-
joinedDocuments
protected LinkedList<org.teiid.translator.mongodb.MongoDocument> joinedDocuments
-
-
Constructor Detail
-
MongoDBSelectVisitor
public MongoDBSelectVisitor(MongoDBExecutionFactory executionFactory, RuntimeMetadata metadata)
-
-
Method Detail
-
append
public void append(LanguageObject obj)
Appends the string form of the LanguageObject to the current buffer.- Parameters:
obj
- the language object instance
-
append
protected void append(List<? extends LanguageObject> items)
Simple utility to append a list of language objects to the current buffer by creating a comma-separated list.- Parameters:
items
- a list of LanguageObjects
-
append
protected void append(LanguageObject[] items)
Simple utility to append an array of language objects to the current buffer by creating a comma-separated list.- Parameters:
items
- an array of LanguageObjects
-
getColumnName
public String getColumnName(ColumnReference obj)
-
visit
public void visit(DerivedColumn obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(ColumnReference obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
visit
public void visit(AggregateFunction obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Function obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(NamedTable obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
visit
public void visit(Join obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Select obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Comparison obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
buildFunctionQuery
protected com.mongodb.BasicDBObject buildFunctionQuery(Comparison obj, com.mongodb.BasicDBObject leftExpr, Object rightExpr)
-
buildComparisionQuery
protected void buildComparisionQuery(Comparison obj, Object rightExpr, com.mongodb.QueryBuilder query)
-
visit
public void visit(AndOr obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Array array)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Literal obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
visit
public void visit(In obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
buildInQuery
protected com.mongodb.QueryBuilder buildInQuery(In obj, com.mongodb.QueryBuilder query)
-
visit
public void visit(IsNull obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
buildIsNullQuery
protected com.mongodb.QueryBuilder buildIsNullQuery(IsNull obj, com.mongodb.QueryBuilder query)
-
visit
public void visit(Like obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
buildLikeQuery
protected com.mongodb.QueryBuilder buildLikeQuery(Like obj, com.mongodb.QueryBuilder query)
-
visit
public void visit(Limit obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
visit
public void visit(OrderBy obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(SortSpecification obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(GroupBy obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
-