Package org.teiid.translator.solr
Class SolrSQLHierarchyVistor
- java.lang.Object
-
- org.teiid.language.visitor.AbstractLanguageVisitor
-
- org.teiid.language.visitor.HierarchyVisitor
-
- org.teiid.translator.solr.SolrSQLHierarchyVistor
-
- All Implemented Interfaces:
LanguageObjectVisitor
public class SolrSQLHierarchyVistor extends HierarchyVisitor
-
-
Field Summary
Fields Modifier and Type Field Description protected StringBuilder
buffer
protected Stack<String>
onGoingExpression
-
Constructor Summary
Constructors Constructor Description SolrSQLHierarchyVistor(RuntimeMetadata metadata, SolrExecutionFactory ef)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
escapeString(String str)
Creates a SQL-safe string.static String
getColumnName(ColumnReference obj)
List<String>
getFieldNameList()
org.apache.solr.client.solrj.SolrQuery
getSolrQuery()
boolean
isCountStarInUse()
boolean
isLimitInUse()
void
visit(AggregateFunction obj)
void
visit(AndOr obj)
void
visit(ColumnReference obj)
void
visit(Comparison obj)
Note: Solr does not support <,> exclusively.void
visit(DerivedColumn obj)
void
visit(Function obj)
void
visit(In obj)
void
visit(Like obj)
void
visit(Limit obj)
void
visit(Literal obj)
void
visit(OrderBy 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, visit, visit, visit, visit, visit
-
Methods inherited from class org.teiid.language.visitor.AbstractLanguageVisitor
visit, visit, visit, visit, visitNode, visitNodes, visitNodes
-
-
-
-
Field Detail
-
buffer
protected StringBuilder buffer
-
-
Constructor Detail
-
SolrSQLHierarchyVistor
public SolrSQLHierarchyVistor(RuntimeMetadata metadata, SolrExecutionFactory ef)
-
-
Method Detail
-
visit
public void visit(DerivedColumn obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
getColumnName
public static String getColumnName(ColumnReference obj)
-
visit
public void visit(ColumnReference obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
getFieldNameList
public List<String> getFieldNameList()
- Returns:
- the full column names tableName.columnNames
-
visit
public void visit(Comparison obj)
Note: Solr does not support <,> exclusively. It is always <=, >=- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(AndOr obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(In obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(Like obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
- See Also:
Description: transforms the like statements into solor syntax
-
visit
public void visit(Literal obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classAbstractLanguageVisitor
-
escapeString
protected String escapeString(String str)
Creates a SQL-safe string. Simply replaces all occurrences of ' with ''- Parameters:
str
- the input string- Returns:
- a SQL-safe string
-
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(Function obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
visit
public void visit(AggregateFunction obj)
- Specified by:
visit
in interfaceLanguageObjectVisitor
- Overrides:
visit
in classHierarchyVisitor
-
getSolrQuery
public org.apache.solr.client.solrj.SolrQuery getSolrQuery()
-
isLimitInUse
public boolean isLimitInUse()
-
isCountStarInUse
public boolean isCountStarInUse()
-
-