|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.rel.AbstractRelNode org.eigenbase.rel.jdbc.JdbcQuery
public class JdbcQuery
A JdbcQuery
is a relational expression whose source is a SQL
statement executed against a JDBC data source. It has result set calling convention
.
Field Summary | |
---|---|
protected RelOptConnection |
connection
The expression which yields the connection object. |
private DataSource |
dataSource
|
(package private) SqlDialect |
dialect
|
protected String |
queryString
For debug. |
(package private) SqlSelect |
sql
|
Fields inherited from class org.eigenbase.rel.AbstractRelNode |
---|
digest, id, rowType, traits |
Fields inherited from interface org.eigenbase.rel.RelNode |
---|
emptyArray |
Constructor Summary | |
---|---|
JdbcQuery(RelOptCluster cluster,
RelDataType rowType,
RelOptConnection connection,
SqlDialect dialect,
SqlSelect sql,
DataSource dataSource)
Creates a JdbcQuery . |
Method Summary | |
---|---|
JdbcQuery |
clone()
Clones this RelNode. |
RelOptCost |
computeSelfCost(RelOptPlanner planner)
Returns the cost of this plan (not including children). |
void |
explain(RelOptPlanWriter pw)
|
RelOptConnection |
getConnection()
Returns the connection |
DataSource |
getDataSource()
Returns the JDBC data source |
String |
getForeignSql()
Returns the SQL that this query will execute against the foreign database, in the SQL dialect of that database. |
SqlSelect |
getSql()
Returns the parse tree of the SQL statement which populates this query. |
ParseTree |
implement(JavaRelImplementor implementor)
Creates a plan for this expression according to a calling convention. |
void |
onRegister(RelOptPlanner planner)
Receives notification that this expression is about to be registered. |
static void |
register(RelOptPlanner planner)
Registers any planner rules needed to implement queries using JdbcQuery objects. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.eigenbase.rel.RelNode |
---|
childrenAccept, collectVariablesSet, collectVariablesUsed, getChildExps, getCluster, getCollationList, getConvention, getCorrelVariable, getDescription, getDigest, getExpectedInputRowType, getId, getInput, getInputs, getOrCreateCorrelVariable, getQuery, getRelTypeName, getRows, getRowType, getTable, getTraits, getVariablesStopped, isAccessTo, isDistinct, isValid, recomputeDigest, registerCorrelVariable, replaceInput, setCorrelVariable |
Field Detail |
---|
private final DataSource dataSource
protected RelOptConnection connection
SqlDialect dialect
SqlSelect sql
protected String queryString
Constructor Detail |
---|
public JdbcQuery(RelOptCluster cluster, RelDataType rowType, RelOptConnection connection, SqlDialect dialect, SqlSelect sql, DataSource dataSource)
JdbcQuery
.
cluster
- RelOptCluster
this relational expression belongs
toconnection
- a RelOptConnection
; must also implement DataSource
, because that's how we will acquire the JDBC connectionsql
- SQL parse tree, may be null, otherwise must be a SELECT
statementdataSource
- Provides a JDBC connection to run this query against.
In saffron, if the query is implementing a JDBC table, then the
connection's schema will implement
net.sf.saffron.ext.JdbcSchema
, and data source will typically be
the same as calling the getDataSource()
method on that
schema. But non-JDBC schemas are also acceptable.
Method Detail |
---|
public RelOptConnection getConnection()
public DataSource getDataSource()
public void explain(RelOptPlanWriter pw)
explain
in interface RelNode
explain
in class AbstractRelNode
public String getForeignSql()
getSql()
public JdbcQuery clone()
RelNode
Traits of the RelNode must be explicitly cloned, using AbstractRelNode.inheritTraitsFrom(AbstractRelNode)
, as the RelNode may
have traits of which it has no knowledge. Example implementation:
public MyRelNode clone() { MyRelNode clone = new MyRelNode(...); clone.inheritTraitsFrom(this); return clone; }N.B.: This method must be overridden whenever an existing, concrete RelNode is extended. Otherwise, calling clone() will produce a differently typed RelNode, resulting in invalid or incorrect query plans.
clone
in interface RelNode
clone
in class AbstractRelNode
public RelOptCost computeSelfCost(RelOptPlanner planner)
RelNode
NOTE jvs 29-Mar-2006: Don't call this method directly. Instead, use
RelMetadataQuery.getNonCumulativeCost(org.eigenbase.rel.RelNode)
, which gives plugins a
chance to override the rel's default ideas about cost.
computeSelfCost
in interface RelNode
computeSelfCost
in class AbstractRelNode
public void onRegister(RelOptPlanner planner)
RelNode
onRegister
in interface RelNode
onRegister
in class AbstractRelNode
public static void register(RelOptPlanner planner)
planner
- Plannerpublic ParseTree implement(JavaRelImplementor implementor)
JavaRel
implement
in interface JavaRel
implementor
- implementorpublic SqlSelect getSql()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |