def hive_table_exists(spark, database: str, table: str) -> bool:
    """Checks the Spark catalog and returns True if a table exists."""
    return spark._jsparkSession.catalog().tableExists(database, table)