from .._tpc import _TPC

class TPCH(_TPC):
    """
    Class for running the TPC-H benchmark.

    This class provides functionality for running the TPC-H benchmark, including loading data,
    executing queries, and performing power tests. Supported engines are listed in the 
    `self.BENCHMARK_IMPL_REGISTRY` constant.

    Parameters
    ----------
    engine : object
        The engine to use for executing the benchmark.
    scenario_name : str
        The name of the benchmark scenario.
    query_list : list of str, optional
        List of queries to execute. Use '*' for all queries. If not specified, all queries will be run.
    parquet_mount_path : str, optional
        Path to the mounted parquet files. Must be the root directory containing a folder named after 
        each table in TABLE_REGISTRY. If not provided, `parquet_abfss_path` must be specified assuming 
        the engine supports ABFSS.
    parquet_abfss_path : str, optional
        Path to the parquet files in ABFSS. Must be the root directory containing a folder named after 
        each table in TABLE_REGISTRY.
    result_abfss_path : str, optional
        ABFSS path to the table where results will be saved. Must be specified if `save_results` is True.
    save_results : bool
        Whether to save the benchmark results. Results can also be accessed via the `self.results` 
        attribute after running the benchmark.

    Methods
    -------
    run(mode='power_test')
        Runs the benchmark in the specified mode. Valid modes are 'load', 'query', and 'power_test'.
    _run_load_test()
        Loads the data for the benchmark.
    _run_query_test()
        Executes the queries for the benchmark.
    _run_power_test()
        Runs both the load and query tests.
    """
    TPC_BENCHMARK_VARIANT = 'H'
    TABLE_REGISTRY = [
        'customer', 'lineitem', 'nation', 'orders', 'part',
        'partsupp', 'region', 'supplier'
    ]
    QUERY_REGISTRY = [
        'q1', 'q2', 'q3', 'q4', 'q5', 'q6', 'q7', 'q8', 'q9', 'q10',
        'q11', 'q12', 'q13', 'q14', 'q15', 'q16', 'q17', 'q18', 'q19', 'q20',
        'q21', 'q22'
    ]
    DDL_FILE_NAME = 'ddl_v3.0.1.sql'