Class ChIndex
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
org.pgcodekeeper.core.database.ch.schema.ChIndex
- All Implemented Interfaces:
IIndex,IOptionContainer,ISearchPath,ISimpleColumnContainer,ISimpleOptionContainer,IStatement,ISubElement,IHashable
Represents a ClickHouse table index.
ClickHouse's indexes are used for data skipping and include expression, type, and granularity settings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumn(SimpleColumn column) Adds a column reference to this container.voidaddInclude(String column) Adds an included column to this container.voidAdds an option to this container.appendAlterSQL(IStatement newCondition, SQLScript script) Fill script with object changes and return change typebooleancompare(IStatement obj) This method does not account for nested child PgStatements.booleancompareColumns(Collection<String> refs) Compares the columns of this index with a collection of column references.voidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.voidgetCreationSQL(SQLScript script) Generates the SQL statements needed to create this database object.voidgetDropSQL(SQLScript script, boolean optionExists) Generates DROP SQL for this statement.Gets all options for this container.booleanbooleanisUnique()voidsetClustered(boolean isClustered) voidvoidsetGranVal(int granVal) voidsetTablespace(String tableSpace) voidvoidsetUnique(boolean unique) voidMethods inherited from class org.pgcodekeeper.core.database.ch.schema.ChAbstractStatement
appendComments, appendOwnerSQL, formatSql, getQuoter, getRenameCommandMethods inherited from class org.pgcodekeeper.core.database.base.schema.AbstractStatement
addDependency, addPrivilege, appendAlterComments, appendPrivileges, canDrop, canDropBeforeCreate, checkComments, clearPrivileges, compareChildren, deepCopy, equals, fillChildrenList, fillDescendantsList, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getDropSQL, getLibName, getLocation, getName, getObjectState, getObjectState, getOwner, getParent, getPrivileges, getQualifiedName, getSeparator, getSQL, getTwin, hasChildren, hashCode, isLib, setAuthor, setComment, setLibName, setLocation, setOwner, setParent, shallowCopy, toStringMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IIndex
getStatementType, toObjectReferenceMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISearchPath
getDatabase, getSchemaNameMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISimpleOptionContainer
appendOptions, compareOptionsMethods inherited from interface org.pgcodekeeper.core.database.api.schema.IStatement
addDependency, appendOwnerSQL, canDrop, canDropBeforeCreate, clearPrivileges, deepCopy, formatSql, getAuthor, getBareName, getChildren, getComment, getDependencies, getDescendants, getLibName, getLocation, getName, getOwner, getParent, getPrivileges, getQualifiedName, getQuotedName, getQuoter, getRenameCommand, getSeparator, getSQL, getTwin, getTypeName, hasChildren, isLib, isOwned, quote, setComment, setLibName, setLocation, setOwner, shallowCopyMethods inherited from interface org.pgcodekeeper.core.database.api.schema.ISubElement
getContainingSchema
-
Constructor Details
-
ChIndex
Creates a new ClickHouse index with the specified name.- Parameters:
name- the name of the index
-
-
Method Details
-
getCreationSQL
Description copied from interface:IStatementGenerates the SQL statements needed to create this database object. This is an abstract method that must be implemented by subclasses to provide the specific CREATE SQL for each object type.- Specified by:
getCreationSQLin interfaceIStatement- Parameters:
script- the SQL script to append creation statements to
-
appendAlterSQL
Description copied from interface:IStatementFill script with object changes and return change type- Specified by:
appendAlterSQLin interfaceIStatement- Parameters:
newCondition- new object statescript- script to collect changes- Returns:
- object change type
-
getDropSQL
Description copied from interface:IStatementGenerates DROP SQL for this statement.- Specified by:
getDropSQLin interfaceIStatement- Overrides:
getDropSQLin classAbstractStatement- Parameters:
script- the SQL script to append the DROP statement tooptionExists- whether to include "IF EXISTS" in the DROP statement
-
compareColumns
Description copied from interface:IIndexCompares the columns of this index with a collection of column references.- Specified by:
compareColumnsin interfaceIIndex- Parameters:
refs- the collection of column references to compare against- Returns:
- true if the columns match in order and count
-
setClustered
public void setClustered(boolean isClustered) -
isClustered
public boolean isClustered() -
addColumn
Description copied from interface:ISimpleColumnContainerAdds a column reference to this container.- Specified by:
addColumnin interfaceISimpleColumnContainer- Parameters:
column- the simple column to add
-
addInclude
Description copied from interface:ISimpleColumnContainerAdds an included column to this container.- Specified by:
addIncludein interfaceISimpleColumnContainer- Parameters:
column- the column name to include
-
isUnique
public boolean isUnique() -
setUnique
public void setUnique(boolean unique) -
setWhere
-
getTablespace
-
setTablespace
-
getOptions
Description copied from interface:IOptionContainerGets all options for this container.- Specified by:
getOptionsin interfaceIOptionContainer- Returns:
- a map of option keys to values
-
addOption
Description copied from interface:IOptionContainerAdds an option to this container.- Specified by:
addOptionin interfaceIOptionContainer- Parameters:
key- the option keyvalue- the option value
-
setExpr
-
setType
-
setGranVal
public void setGranVal(int granVal) -
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
compare
Description copied from class:AbstractStatementThis method does not account for nested child PgStatements. Shallow version ofAbstractStatement.equals(Object)- Specified by:
comparein interfaceIStatement- Overrides:
comparein classAbstractStatement
-