|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.oj.stmt.OJPreparingStmt
public abstract class OJPreparingStmt
OJPreparingStmt
is an abstract base for classes which implement
the process of preparing and executing SQL expressions by generating OpenJava
code.
Nested Class Summary | |
---|---|
static class |
OJPreparingStmt.Argument
An Argument supplies a name/value pair to a statement. |
static class |
OJPreparingStmt.JavaRelFinder
Walks a RelNode tree and determines if it contains any JavaRel s. |
Field Summary | |
---|---|
protected RelOptConnection |
connection
|
static String |
connectionVariable
|
protected boolean |
containsJava
True if the statement contains java RelNodes |
protected Environment |
env
|
protected JavaCompiler |
javaCompiler
|
private String |
queryString
|
private CallingConvention |
resultCallingConvention
CallingConvention via which results should be returned by execution. |
protected EigenbaseTimingTracer |
timingTracer
|
private static Logger |
tracer
|
Constructor Summary | |
---|---|
OJPreparingStmt(RelOptConnection connection)
Creates a statement. |
Method Summary | |
---|---|
protected void |
addDecl(Statement statement,
ExpressionList exprList)
|
protected void |
bindArgument(OJPreparingStmt.Argument arg)
|
private BoundMethod |
compile(ClassDeclaration decl,
Environment env,
ParseTree parseTree,
OJPreparingStmt.Argument[] arguments)
|
private BoundMethod |
compile(String packageName,
String className,
String s,
Class[] parameterTypes,
String[] parameterNames)
|
protected BoundMethod |
compileAndBind(ClassDeclaration decl,
ParseTree parseTree,
OJPreparingStmt.Argument[] arguments)
|
protected Class |
compileClass(String packageName,
String className,
String source)
Compile a single class with the given source in the given package. |
protected JavaCompiler |
createCompiler()
|
protected abstract RelNode |
decorrelate(SqlNode query,
RelNode rootRel)
|
protected abstract RelNode |
flattenTypes(RelNode rootRel,
boolean restructure)
|
protected abstract String |
getClassRoot()
|
protected abstract String |
getCompilerClassName()
|
protected RelTraitSet |
getDesiredRootTraitSet(RelNode rootRel)
|
Environment |
getEnvironment()
|
protected abstract String |
getJavaRoot()
|
protected abstract JavaRelImplementor |
getRelImplementor(RexBuilder rexBuilder)
Protected method to allow subclasses to override construction of JavaRelImplementor. |
RelOptSchema |
getRelOptSchema()
|
protected abstract SqlToRelConverter |
getSqlToRelConverter(SqlValidator validator,
RelOptConnection connection)
Protected method to allow subclasses to override construction of SqlToRelConverter. |
protected abstract String |
getTempClassName()
|
protected abstract String |
getTempMethodName()
|
protected abstract String |
getTempPackageName()
|
private PreparedExecution |
implement(RelDataType rowType,
RelNode rootRel,
SqlKind sqlKind,
ClassDeclaration decl,
OJPreparingStmt.Argument[] args)
Implements a physical query plan. |
ClassDeclaration |
init(OJPreparingStmt.Argument[] arguments)
|
protected void |
initSub()
|
private TableModificationRelBase.Operation |
mapTableModOp(boolean isDml,
SqlKind sqlKind)
|
protected RelNode |
optimize(RelDataType logicalRowType,
RelNode rootRel)
Optimizes a query plan. |
PreparedResult |
prepareSql(RelDataType rowType,
RelNode rootRel,
SqlKind sqlKind,
boolean needOpt,
ClassDeclaration decl,
OJPreparingStmt.Argument[] args)
Prepares a statement for execution, starting from a relational expression (ie a logical or a physical query plan). |
PreparedResult |
prepareSql(SqlNode sqlQuery,
Class runtimeContextClass,
SqlValidator validator,
boolean needsValidation)
|
PreparedResult |
prepareSql(SqlNode sqlQuery,
SqlNode sqlNodeOriginal,
Class runtimeContextClass,
SqlValidator validator,
boolean needsValidation)
Prepares a statement for execution, starting from a parse tree and using a user-supplied validator. |
void |
setResultCallingConvention(CallingConvention resultCallingConvention)
|
protected abstract boolean |
shouldAlwaysWriteJavaFile()
|
protected abstract boolean |
shouldSetConnectionInfo()
|
protected boolean |
treeContainsJava(RelNode rootRel)
Determines if the RelNode tree contains Java RelNodes. |
private static Class |
visibleBaseClass(Class clazz,
String fromPackageName)
Returns the lowest ancestor of clazz which is visible from
fromPackage .fromClazz . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String connectionVariable
private static final Logger tracer
private String queryString
protected Environment env
private CallingConvention resultCallingConvention
protected JavaCompiler javaCompiler
protected final RelOptConnection connection
protected EigenbaseTimingTracer timingTracer
protected boolean containsJava
Constructor Detail |
---|
public OJPreparingStmt(RelOptConnection connection)
connection
- Connection statement belongs to; may be null, but only
if this statement implements RelOptConnection
Method Detail |
---|
public RelOptSchema getRelOptSchema()
public Environment getEnvironment()
public void setResultCallingConvention(CallingConvention resultCallingConvention)
protected BoundMethod compileAndBind(ClassDeclaration decl, ParseTree parseTree, OJPreparingStmt.Argument[] arguments)
protected void initSub()
public ClassDeclaration init(OJPreparingStmt.Argument[] arguments)
protected void bindArgument(OJPreparingStmt.Argument arg)
public PreparedResult prepareSql(SqlNode sqlQuery, Class runtimeContextClass, SqlValidator validator, boolean needsValidation)
public PreparedResult prepareSql(SqlNode sqlQuery, SqlNode sqlNodeOriginal, Class runtimeContextClass, SqlValidator validator, boolean needsValidation)
protected RelNode optimize(RelDataType logicalRowType, RelNode rootRel)
logicalRowType
- logical row type of relational expression (before
struct fields are flattened, or field names are renamed for uniqueness)rootRel
- root of a relational expression
protected RelTraitSet getDesiredRootTraitSet(RelNode rootRel)
protected boolean treeContainsJava(RelNode rootRel)
rootRel
- root of the RelNode tree
private PreparedExecution implement(RelDataType rowType, RelNode rootRel, SqlKind sqlKind, ClassDeclaration decl, OJPreparingStmt.Argument[] args)
rowType
- original rowtype returned by query validatorrootRel
- root of the relational expression.sqlKind
- SqlKind of the original statement.decl
- ClassDeclaration of the generated result.args
- argument list of the generated result.
PreparedExecution
.private TableModificationRelBase.Operation mapTableModOp(boolean isDml, SqlKind sqlKind)
public PreparedResult prepareSql(RelDataType rowType, RelNode rootRel, SqlKind sqlKind, boolean needOpt, ClassDeclaration decl, OJPreparingStmt.Argument[] args)
rowType
- rootRel
- root of the relational expression.sqlKind
- SqlKind for the relational expression: only
SqlKind.Explain and SqlKind.Dml are special cases.needOpt
- true for a logical query plan (still needs to be
optimized), false for a physical plan.decl
- openjava ClassDeclaration for the code generated to implement
the statement.args
- openjava argument list for the generated code.protected abstract SqlToRelConverter getSqlToRelConverter(SqlValidator validator, RelOptConnection connection)
protected abstract JavaRelImplementor getRelImplementor(RexBuilder rexBuilder)
protected abstract String getClassRoot()
protected abstract String getCompilerClassName()
protected abstract String getJavaRoot()
protected abstract String getTempPackageName()
protected abstract String getTempMethodName()
protected abstract String getTempClassName()
protected abstract boolean shouldAlwaysWriteJavaFile()
protected abstract boolean shouldSetConnectionInfo()
protected abstract RelNode flattenTypes(RelNode rootRel, boolean restructure)
protected abstract RelNode decorrelate(SqlNode query, RelNode rootRel)
protected JavaCompiler createCompiler()
private static Class visibleBaseClass(Class clazz, String fromPackageName)
clazz
which is visible from
fromPackage
.fromClazz
.
protected void addDecl(Statement statement, ExpressionList exprList)
private BoundMethod compile(ClassDeclaration decl, Environment env, ParseTree parseTree, OJPreparingStmt.Argument[] arguments)
private BoundMethod compile(String packageName, String className, String s, Class[] parameterTypes, String[] parameterNames)
protected Class compileClass(String packageName, String className, String source)
packageName
- package name, if null the className must be fully
qualifiedclassName
- simple class name unless packageName is nullsource
- source code for the class
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |