class CreateIndexConstantAction extends IndexConstantAction
Modifier and Type | Field and Description |
---|---|
private java.lang.String[] |
columnNames |
private UUID |
conglomerateUUID |
private long |
conglomId
Conglomerate number for the conglomerate created by this
constant action; -1L if this constant action has not been
executed.
|
private int |
constraintType
The constraint type, see
DataDictionary
definition of constants. |
private long |
droppedConglomNum
Conglomerate number of the physical conglomerate that we
will "replace" using this constant action.
|
private boolean |
forCreateTable
Is this for a CREATE TABLE, i.e. it is
for a constraint declared in a CREATE TABLE
statement that requires a backing index.
|
private boolean |
hasDeferrableChecking
The index duplicate checking is deferrable.
|
private ExecRow |
indexTemplateRow |
private java.lang.String |
indexType |
private boolean |
initiallyDeferred
Used to determine sorting behavior for existing rows if any
|
private boolean[] |
isAscending |
private boolean |
isConstraint |
private java.util.Properties |
properties |
private boolean |
unique |
private boolean |
uniqueDeferrable
The index represents a PRIMARY KEY or a UNIQUE NOT NULL constraint which
is deferrable.
|
private boolean |
uniqueWithDuplicateNulls |
constraintID, indexName, schemaName, tableName
tableId
WHEN_MATCHED_THEN_DELETE, WHEN_MATCHED_THEN_UPDATE, WHEN_NOT_MATCHED_THEN_INSERT
Constructor and Description |
---|
CreateIndexConstantAction(boolean forCreateTable,
boolean unique,
boolean uniqueWithDuplicateNulls,
boolean hasDeferrableChecking,
boolean initiallyDeferred,
int constraintType,
java.lang.String indexType,
java.lang.String schemaName,
java.lang.String indexName,
java.lang.String tableName,
UUID tableId,
java.lang.String[] columnNames,
boolean[] isAscending,
boolean isConstraint,
UUID conglomerateUUID,
java.util.Properties properties)
Make the ConstantAction to create an index.
|
CreateIndexConstantAction(ConglomerateDescriptor srcCD,
TableDescriptor td,
java.util.Properties properties)
Make a ConstantAction that creates a new physical conglomerate
based on index information stored in the received descriptors.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
addStatistics(DataDictionary dd,
IndexRowGenerator irg,
long numRows)
Determines if a statistics entry is to be added for the index.
|
void |
executeConstantAction(Activation activation)
This is the guts of the Execution-time logic for
creating an index.
|
(package private) long |
getCreatedConglomNumber()
Get the conglomerate number for the conglomerate that was
created by this constant action.
|
(package private) UUID |
getCreatedUUID()
Get the UUID for the conglomerate descriptor that was created
(or re-used) by this constant action.
|
(package private) ExecRow |
getIndexTemplateRow() |
(package private) long |
getReplacedConglomNumber()
If the purpose of this constant action was to "replace" a
dropped physical conglomerate, then this method returns the
conglomerate number of the dropped conglomerate.
|
private RowLocationRetRowSource |
loadSorter(ExecRow[] baseRows,
ExecIndexRow[] indexRows,
TransactionController tc,
GroupFetchScanController scan,
long sortId,
RowLocation[] rl)
Scan the base conglomerate and insert the keys into a sorter,
returning a rowSource on the sorter.
|
java.lang.String |
toString() |
getIndexName, setConstraintID, setIndexName
dropConglomerate, dropConglomerate, dropConstraint, dropConstraint, dropConstraint, executeConglomReplacement, getConglomReplacementAction, recreateUniqueConstraintBackingIndexAsUniqueWhenNotNull
addColumnDependencies, adjustUDTDependencies, adjustUDTDependencies, constructToString, getAndCheckSchemaDescriptor, getSchemaDescriptorForCreate, lockTableForDDL, storeConstraintDependenciesOnPrivileges, storeViewTriggerDependenciesOnPrivileges
private final boolean forCreateTable
private boolean unique
private boolean uniqueWithDuplicateNulls
private boolean uniqueDeferrable
true
implies unique == false
and
uniqueWithDuplicateNulls == false
and
hasDeferrableChecking == true
.private final boolean hasDeferrableChecking
true
implies unique == false
and (uniqueDeferrable ||
uniqueWithDuplicateNulls)
.private final boolean initiallyDeferred
private final int constraintType
DataDictionary
definition of constants.private java.lang.String indexType
private java.lang.String[] columnNames
private boolean[] isAscending
private boolean isConstraint
private UUID conglomerateUUID
private java.util.Properties properties
private ExecRow indexTemplateRow
private long conglomId
private long droppedConglomNum
CreateIndexConstantAction(boolean forCreateTable, boolean unique, boolean uniqueWithDuplicateNulls, boolean hasDeferrableChecking, boolean initiallyDeferred, int constraintType, java.lang.String indexType, java.lang.String schemaName, java.lang.String indexName, java.lang.String tableName, UUID tableId, java.lang.String[] columnNames, boolean[] isAscending, boolean isConstraint, UUID conglomerateUUID, java.util.Properties properties)
forCreateTable
- Being executed within a CREATE TABLE
statementunique
- True means it will be a unique indexuniqueWithDuplicateNulls
- True means index check and disallow
any duplicate key if key has no
column with a null value. If any
column in the key has a null value,
no checking is done and insert will
always succeed.hasDeferrableChecking
- True means this index backs a
deferrable constraint. isConstraint
will be true.initiallyDeferred
- True means the index represents
a deferred constraint. Implies
hasDeferrableChecking.indexType
- type of index (BTREE, for example)schemaName
- schema that table (and index)
lives in.indexName
- Name of the indextableName
- Name of table the index will be ontableId
- UUID of tablecolumnNames
- Names of the columns in the index,
in orderisAscending
- Array of booleans telling asc/desc
on each columnisConstraint
- TRUE if index is backing up a
constraint, else FALSEconglomerateUUID
- ID of conglomerateproperties
- The optional properties list
associated with the index.CreateIndexConstantAction(ConglomerateDescriptor srcCD, TableDescriptor td, java.util.Properties properties)
public java.lang.String toString()
toString
in class java.lang.Object
public void executeConstantAction(Activation activation) throws StandardException
A index is represented as:
activation
- The execution environment for this constant action.StandardException
- Thrown on failureConglomerateDescriptor
,
SchemaDescriptor
,
ConstantAction.executeConstantAction(org.apache.derby.iapi.sql.Activation)
private boolean addStatistics(DataDictionary dd, IndexRowGenerator irg, long numRows) throws StandardException
As an optimization, it may be better to not write a statistics entry to SYS.SYSSTATISTICS. If it isn't needed by Derby as part of query optimization there is no reason to spend resources keeping the statistics up to date.
dd
- the data dictionaryirg
- the index row generatornumRows
- the number of rows in the indextrue
if statistics should be written to
SYS.SYSSTATISTICS, false
otherwise.StandardException
- if accessing the data dictionary failsExecRow getIndexTemplateRow()
long getCreatedConglomNumber()
long getReplacedConglomNumber()
UUID getCreatedUUID()
private RowLocationRetRowSource loadSorter(ExecRow[] baseRows, ExecIndexRow[] indexRows, TransactionController tc, GroupFetchScanController scan, long sortId, RowLocation[] rl) throws StandardException
StandardException
- thrown on errorApache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.