|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.oj.util.OJClassMap
public class OJClassMap
An OJClassMap
is ...
Field Summary | |
---|---|
private boolean |
defineValueConstructors
Do generated classes need value constructors? This can blow the Java virtual machine's limit on number of parameters per method, and in Farrago we don't actually use anything but the default constructor. |
private int |
id
Sequence generator for generated class names. |
private Hashtable<String,OJSyntheticClass> |
mapKey2SyntheticClass
Map a HashableArray (which is just a wrapper around an array of
classes and names to the OJSyntheticClass which implements that
array of types. |
private Class |
syntheticSuperClass
Class from which synthetic classes should be subclassed. |
private static Logger |
tracer
|
Constructor Summary | |
---|---|
OJClassMap(Class<SyntheticObject> syntheticSuperClass)
|
|
OJClassMap(Class syntheticSuperClass,
boolean defineValueConstructors)
|
Method Summary | |
---|---|
private static void |
addAtomicClasses(Vector<OJClass> classesVector,
OJClass clazz)
|
private OJClass |
create(OJClass declarer,
OJClass[] classes,
String[] fieldNames,
boolean isJoin)
|
OJClass |
createJoin(OJClass declarer,
OJClass[] classes)
Creates a OJSyntheticClass , or if there is already one with
the same number and type of fields, returns that. |
OJClass |
createProject(OJClass declarer,
OJClass[] classes,
String[] fieldNames)
Creates a OJSyntheticClass with named fields. |
private ClassDeclaration |
makeDeclaration(String className,
OJClass[] classes,
String[] fieldNames)
|
OJClass |
makeJoinType(OJClass declarer,
OJClass left,
OJClass right)
Makes the type of a join. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger tracer
private Hashtable<String,OJSyntheticClass> mapKey2SyntheticClass
HashableArray
(which is just a wrapper around an array of
classes and names to the OJSyntheticClass
which implements that
array of types.
private Class syntheticSuperClass
private int id
private final boolean defineValueConstructors
Constructor Detail |
---|
public OJClassMap(Class<SyntheticObject> syntheticSuperClass)
public OJClassMap(Class syntheticSuperClass, boolean defineValueConstructors)
Method Detail |
---|
public OJClass createProject(OJClass declarer, OJClass[] classes, String[] fieldNames)
OJSyntheticClass
with named fields. We don't check
whether there is an equivalent class -- all classes with named fields are
different.
private OJClass create(OJClass declarer, OJClass[] classes, String[] fieldNames, boolean isJoin)
private ClassDeclaration makeDeclaration(String className, OJClass[] classes, String[] fieldNames)
public OJClass createJoin(OJClass declarer, OJClass[] classes)
OJSyntheticClass
, or if there is already one with
the same number and type of fields, returns that.
public OJClass makeJoinType(OJClass declarer, OJClass left, OJClass right)
Makes the type of a join. There are two kinds of classes. A real class exists in the developer's environment. A synthetic class is constructed by the system to describe the intermediate and final results of a query. We are at liberty to modify synthetic classes.
If we join class C1 to class C2, the result is a synthetic class:
class SC1 { C1 $f0; C2 $f1; }Suppose that we now join class C3 to this; you would expect the result type to be a new synthetic class:
class SC2 { class SC1 { C1 $f0; C2 $f1; } $f0; class C3 $f1; }Now imagine the type resulting from a 6-way join. It will be very difficult to unpick the nesting in order to reference fields or to permute the join order. Therefore when one or both of the inputs to a join are synthetic, we break them apart and re-construct them. Type of synthetic class SC1 joined to class C3 above is
class SC3 { C1 $f0; C2 $f1; C3 $f2; }
There are also row classes, which are synthetic classes arising from projections. The type of
select from (select deptno from dept) join emp join (select loc.nation, loc.zipcode from loc)is
class SC { int $f0; Emp $f1; class RC { String nation; int zipcode; } $f2; }
This deals with nesting; we still need to deal with the field permutations which occur when we re-order joins. A permutation operator moves fields back to their original positions, so that join transforms preserve type.
private static void addAtomicClasses(Vector<OJClass> classesVector, OJClass clazz)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |