Class ChFunction

All Implemented Interfaces:
IStatement, IHashable

public class ChFunction extends ChAbstractStatement
Represents a ClickHouse user-defined function. ClickHouse functions are lambda expressions with parameters and a body.
  • Constructor Details

    • ChFunction

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

    • getStatementType

      public DbObjType getStatementType()
      Description copied from interface: IStatement
      Gets the type of this database object.
      Returns:
      the database object type
    • getCreationSQL

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

      public ObjectState appendAlterSQL(IStatement newCondition, SQLScript script)
      Description copied from interface: IStatement
      Fill script with object changes and return change type
      Parameters:
      newCondition - new object state
      script - script to collect changes
      Returns:
      object change type
    • getBody

      public String getBody()
      Returns the function body expression.
      Returns:
      the function body
    • setBody

      public void setBody(String body)
    • getArguments

      public List<IArgument> getArguments()
    • addArgument

      public void addArgument(Argument argument)
      Adds an argument to this function.
      Parameters:
      argument - the argument to add
    • 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.
      Parameters:
      hasher - the hasher instance to use for hash computation
    • compare

      public boolean compare(IStatement obj)
      Description copied from class: AbstractStatement
      This method does not account for nested child PgStatements. Shallow version of AbstractStatement.equals(Object)
      Specified by:
      compare in interface IStatement
      Overrides:
      compare in class AbstractStatement