FarragoExecutionFennelOnly

From Eigenpedia

Jump to: navigation, search

This page describes proposed changes for eliminating Java code generation/execution during query preparation for plans which can be implemented entirely using a Fennel ExecStreamGraph.

NOTE jvs 4-Nov-2006: Changes have been implemented as described; integrated to the trunk in eigenchange 7965.


Changes in net.sf.farrago.runtime

We need a new class FennelJavalessResultSet (better name? FennelPureResultSet?) which will be instantiated at runtime. We have all of the pieces, but they need to be put together:

  • FarragoTupleIterResultSet is the normal hybrid implementation of the JDBC ResultSet interface. FennelJavalessResultSet should reuse all of that implementation in order to handle generic issues like autocommit, resource release, tracing, and metadata. However, we need to supply a new implementation of the superclass ColumnGetter interface since we'll be processing arbitrary Fennel tuples rather than code-generated Java tuples.
  • The implementation of the ColumnGetter interface can be factored out of net.sf.farrago.fennel.tuple.FennelTupleResultSet. Note that we can't extend this class directly because we need to inherit all of the behavior from FarragoTupleIterResultSet. Also note that package net.sf.farrago.fennel.tuple needs to remain JDK 1.4-compatible since it is designed to be used in client-side components as well.
  • For the implementation of the TupleIter interface, it may be possible to use the existing class FennelTupleIter directly.
  • The missing piece is an implementation of the FennelTupleReader interface. Normally, we code-generate this per-statement. Writing a real class shouldn't be hard: FennelTupleReader wants someone to convert some bytes into a row, and FennelTupleResultSet wants someone to unmarshal some bytes using its FennelTupleAccessor. The object returned by unmarshalTuple can be an instance of FennelTupleData (in line with the TupleIter interface contract, for efficiency the same instance can be reused for every return).

Changes in net.sf.farrago.query

  • Add class FarragoExecutableFennelStmt (have to factor out most of FarragoExecutableJavaStmt); it will instantiate FennelJavalessResultSet.
  • Change FarragoPreparingStmt.implement(PreparedResult) to instantiate this when it detects no Java in plan (other than top-level FennelToIteratorConverter, which needs to be stripped off--this is probably simpler than asking the planner to conditionally avoid generating the top-level converter). Detection involves walking the RelNode tree after optimization and looking for instances of JavaRel.

Changes in org.eigenbase.oj.stmt

  • Under Fennel-only circumstances (communicated up in some generic fashion from FarragoPreparingStmt), change OJPreparingStmt to avoid generating and compiling Java classes (also defer/suppress creation of Java compiler object).
Personal tools