Class ConglomerateDescriptor
- java.lang.Object
-
- org.apache.derby.iapi.sql.dictionary.TupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.UniqueTupleDescriptor
-
- org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor
-
- All Implemented Interfaces:
Dependable,Provider
public final class ConglomerateDescriptor extends UniqueTupleDescriptor implements Provider
The ConglomerateDescriptor class is used to get information about conglomerates for the purpose of optimization. A ConglomerateDescriptor can map to a base table, an index or a index backing a constraint. Multiple ConglomerateDescriptors can map to a single underlying store conglomerate, such as when multiple index definitions share a physical file. NOTE: The language module does not have to know much about conglomerates with this architecture. To get the cost of using a conglomerate, all it has to do is pass the ConglomerateDescriptor to the access methods, along with the predicate. What the access methods need from a ConglomerateDescriptor remains to be seen.- Version:
- 0.1
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String[]columnNamesprivate longconglomerateNumberprivate booleanforConstraintprivate booleanindexableprivate IndexRowGeneratorindexRowGeneratorprivate java.lang.Stringnameprivate UUIDschemaIDprivate UUIDtableIDprivate UUIDuuid-
Fields inherited from interface org.apache.derby.catalog.Dependable
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
-
-
Constructor Summary
Constructors Constructor Description ConglomerateDescriptor(DataDictionary dataDictionary, long conglomerateNumber, java.lang.String name, boolean indexable, IndexRowGenerator indexRowGenerator, boolean forConstraint, UUID uuid, UUID tableID, UUID schemaID)Constructor for a conglomerate descriptor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConglomerateDescriptordescribeSharedConglomerate(ConglomerateDescriptor[] descriptors, boolean ignoreThis)This method searches the received array of conglom descriptors to find all descriptors that currently share a physical conglom with "this".ConglomerateDescriptordrop(LanguageConnectionContext lcc, TableDescriptor td)Drop this ConglomerateDescriptor when it represents an index.java.lang.StringgetClassType()Get the provider's type.java.lang.String[]getColumnNames()Get the column names for this conglomerate descriptor.java.lang.StringgetConglomerateName()Gets the name of the conglomerate.longgetConglomerateNumber()Gets the number for the conglomerate.DependableFindergetDependableFinder()Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.java.lang.StringgetDescriptorName()java.lang.StringgetDescriptorType()Each descriptor must identify itself with its type; i.e index, check constraint whatever.IndexRowGeneratorgetIndexDescriptor()Gets the index row generator for this conglomerate, null if the conglomerate is not an index.UUIDgetObjectID()Get the provider's UUIDjava.lang.StringgetObjectName()Return the name of this Provider.UUIDgetSchemaID()Gets the UUID for the schema that the conglomerate belongs to.UUIDgetTableID()Gets the UUID for the table that the conglomerate belongs to.UUIDgetUUID()Gets the UUID String for the conglomerate.booleanisConstraint()Tells whether the conglomerate is an index backing up a constraint.booleanisIndex()Tells whether the conglomerate can be used as an index.voidsetColumnNames(java.lang.String[] columnNames)Set the column names for this conglomerate descriptor.voidsetConglomerateName(java.lang.String newName)Set the name of the conglomerate.voidsetConglomerateNumber(long conglomerateNumber)Set the conglomerate number.java.lang.StringtoString()Convert the conglomerate descriptor to a String-
Methods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, isPersistent, setDataDictionary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.derby.catalog.Dependable
isPersistent
-
-
-
-
Field Detail
-
conglomerateNumber
private long conglomerateNumber
-
name
private java.lang.String name
-
columnNames
private transient java.lang.String[] columnNames
-
indexable
private final boolean indexable
-
forConstraint
private final boolean forConstraint
-
indexRowGenerator
private final IndexRowGenerator indexRowGenerator
-
uuid
private final UUID uuid
-
tableID
private final UUID tableID
-
schemaID
private final UUID schemaID
-
-
Constructor Detail
-
ConglomerateDescriptor
ConglomerateDescriptor(DataDictionary dataDictionary, long conglomerateNumber, java.lang.String name, boolean indexable, IndexRowGenerator indexRowGenerator, boolean forConstraint, UUID uuid, UUID tableID, UUID schemaID)
Constructor for a conglomerate descriptor.- Parameters:
dataDictionary- The data dictionary that this descriptor lives inconglomerateNumber- The number for the conglomerate we're interested inname- The name of the conglomerate, if anyindexable- TRUE means the conglomerate is indexable, FALSE means it isn'tindexRowGenerator- The descriptor of the index if it's not a heapforConstraint- TRUE means the conglomerate is an index backing up a constraint, FALSE means it isn'tuuid- UUID for this conglomeratetableID- UUID for the table that this conglomerate belongs toschemaID- UUID for the schema that this conglomerate belongs to
-
-
Method Detail
-
getConglomerateNumber
public long getConglomerateNumber()
Gets the number for the conglomerate.- Returns:
- A long identifier for the conglomerate
-
setConglomerateNumber
public void setConglomerateNumber(long conglomerateNumber)
Set the conglomerate number. This is useful when swapping conglomerates, like for bulkInsert.- Parameters:
conglomerateNumber- The new conglomerate number.
-
getUUID
public UUID getUUID()
Gets the UUID String for the conglomerate.- Specified by:
getUUIDin classUniqueTupleDescriptor- Returns:
- The UUID String for the conglomerate
-
getTableID
public UUID getTableID()
Gets the UUID for the table that the conglomerate belongs to.- Returns:
- The UUID String for the conglomerate
-
getSchemaID
public UUID getSchemaID()
Gets the UUID for the schema that the conglomerate belongs to.- Returns:
- The UUID String for the schema that the conglomerate belongs to
-
isIndex
public boolean isIndex()
Tells whether the conglomerate can be used as an index.- Returns:
- TRUE if the conglomerate can be used as an index, FALSE if not
-
isConstraint
public boolean isConstraint()
Tells whether the conglomerate is an index backing up a constraint.- Returns:
- TRUE if the conglomerate is an index backing up a constraint, FALSE if not
-
getConglomerateName
public java.lang.String getConglomerateName()
Gets the name of the conglomerate. For heaps, this is null. For indexes, it is the index name.- Returns:
- The name of the conglomerate, null if it's the heap for a table.
-
setConglomerateName
public void setConglomerateName(java.lang.String newName)
Set the name of the conglomerate. Used only by rename index.- Parameters:
newName- The new name of the conglomerate.
-
getIndexDescriptor
public IndexRowGenerator getIndexDescriptor()
Gets the index row generator for this conglomerate, null if the conglomerate is not an index.- Returns:
- The index descriptor for this conglomerate, if any.
-
setColumnNames
public void setColumnNames(java.lang.String[] columnNames)
Set the column names for this conglomerate descriptor. This is useful for tracing the optimizer.- Parameters:
columnNames- 0-based array of column names.
-
getColumnNames
public java.lang.String[] getColumnNames()
Get the column names for this conglomerate descriptor. This is useful for tracing the optimizer.- Returns:
- the column names for the conglomerate descriptor.
-
getDependableFinder
public DependableFinder getDependableFinder()
Description copied from interface:DependableGet an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.- Specified by:
getDependableFinderin interfaceDependable- Returns:
- the stored form of this provider
-
getObjectName
public java.lang.String getObjectName()
Return the name of this Provider. (Useful for errors.)- Specified by:
getObjectNamein interfaceDependable- Returns:
- String The name of this provider.
-
getObjectID
public UUID getObjectID()
Get the provider's UUID- Specified by:
getObjectIDin interfaceDependable- Returns:
- The provider's UUID
-
getClassType
public java.lang.String getClassType()
Get the provider's type.- Specified by:
getClassTypein interfaceDependable- Returns:
- char The provider's type.
-
toString
public java.lang.String toString()
Convert the conglomerate descriptor to a String- Overrides:
toStringin classjava.lang.Object- Returns:
- The conglomerate descriptor as a String
-
getDescriptorType
public java.lang.String getDescriptorType()
Description copied from class:TupleDescriptorEach descriptor must identify itself with its type; i.e index, check constraint whatever.- Overrides:
getDescriptorTypein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorType()
-
getDescriptorName
public java.lang.String getDescriptorName()
- Overrides:
getDescriptorNamein classTupleDescriptor- See Also:
TupleDescriptor.getDescriptorName()
-
drop
public ConglomerateDescriptor drop(LanguageConnectionContext lcc, TableDescriptor td) throws StandardException
Drop this ConglomerateDescriptor when it represents an index. If this is the last desciptor for a physical index then the physical index (conglomerate) and its descriptor will be dropped.- Parameters:
lcc- Connection context to use for droppingtd- TableDescriptor for the table to which this conglomerate belongs- Returns:
- If the conglomerate described by this descriptor is an index conglomerate that is shared by multiple constraints/indexes, then we may have to create a new conglomerate to satisfy the constraints/indexes which remain after we drop the existing conglomerate. If that's needed then we'll return a conglomerate descriptor which describes what the new conglomerate must look like. It is then up to the caller of this method to create a new corresponding conglomerate. We don't create the index here because depending on who called us, it might not make sense to create it--esp. if we get here because of a DROP TABLE.
- Throws:
StandardException
-
describeSharedConglomerate
public ConglomerateDescriptor describeSharedConglomerate(ConglomerateDescriptor[] descriptors, boolean ignoreThis) throws StandardException
This method searches the received array of conglom descriptors to find all descriptors that currently share a physical conglom with "this". The method then searches within those sharing descriptors to find one that fully describes what a physical conglom would have to look like in order to support _all_ of the sharing descriptors in the array--esp. one that correctly enforces the uniqueness requirements for those descriptors.- Parameters:
descriptors- Array of conglomerate descriptors in which to search; the array may include an entry for "this"; it should not be null.ignoreThis- If true then we will NOT consider "this" conglomerate descriptor in our search. That is, we will find a descriptor to describe what a physical conglomerate would have to look like in order to support all sharing descriptors OTHER THAN this one.- Returns:
- A conglomerate descriptor, pulled from the received array, that describes what a physical conglomerate would have to look to like in order to support all sharing descriptors (minus "this" if ignoreThis is true).
- Throws:
StandardException
-
-