Class ChTable

All Implemented Interfaces:
IHashable, IOptionContainer, IRelation, ISearchPath, IStatement, IStatementContainer
Direct Known Subclasses:
ChTableLog

public class ChTable extends AbstractTable
Represents a ClickHouse table with engine configuration and projections. Supports ClickHouse-specific features like table engines, projections, and specialized DDL operations.
  • Constructor Details

    • ChTable

      public ChTable(String name)
      Creates a new ClickHouse table with the specified name.
      Parameters:
      name - the name of the table
  • Method Details

    • addProjection

      public void addProjection(String key, String expression)
      Adds a projection to this table.
      Parameters:
      key - the projection name
      expression - the projection expression
    • setEngine

      public void setEngine(ChEngine engine)
    • setPkExpr

      public void setPkExpr(String pkExpr)
    • getCreationSQL

      public void getCreationSQL(SQLScript script)
      Description copied from class: PgStatement
      Generates 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:
      getCreationSQL in class PgStatement
      Parameters:
      script - the SQL script to append creation statements to
    • appendAlterSQL

      public ObjectState appendAlterSQL(PgStatement newCondition, SQLScript script)
      Description copied from class: PgStatement
      Fill script with object changes and return change type
      Specified by:
      appendAlterSQL in class PgStatement
      Parameters:
      newCondition - new object state
      script - script to collect changes
      Returns:
      object change type
    • getAlterTable

      public String getAlterTable(boolean only)
      Description copied from class: AbstractTable
      Generates beginning of alter table statement.
      Specified by:
      getAlterTable in class AbstractTable
      Parameters:
      only - if true, append 'ONLY' to statement
      Returns:
      alter table statement beginning in String format
    • getDbType

      public DatabaseType getDbType()
      Overrides:
      getDbType in class PgStatement
    • computeHash

      public void computeHash(Hasher hasher)
      Description copied from interface: IHashable
      Computes the hash of the implementing object using the provided hasher. The implementation should call appropriate put methods on the hasher for all fields that should contribute to the hash value.
      Specified by:
      computeHash in interface IHashable
      Overrides:
      computeHash in class AbstractTable
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(PgStatement obj)
      Description copied from class: PgStatement
      This method does not account for nested child PgStatements. Shallow version of PgStatement.equals(Object)
      Overrides:
      compare in class AbstractTable
    • appendComments

      public void appendComments(SQLScript script)
      Description copied from class: PgStatement
      Appends comment SQL to the script if this statement has comments.
      Overrides:
      appendComments in class PgStatement
      Parameters:
      script - the SQL script to append comments to
    • compareOptions

      public void compareOptions(IOptionContainer newContainer, SQLScript script)
      Description copied from interface: IOptionContainer
      Compares options between this container and a new container, generating SQL to update differences.
      Parameters:
      newContainer - the new container to compare against
      script - the script to append changes to