Skip to main content

Running TPCDS on Databricks

This document describes how to run TPCDS on Databricks. The TPCDS benchmark is a decision support benchmark that models several generally applicable aspects of a decision support system, including queries and data maintenance. The benchmark provides a representative evaluation of performance as a general purpose decision support system. The benchmark is the result of a partnership between the Transaction Processing Performance Council (TPC) and the decision support group (DS) of the Association for Computing Machinery (ACM).

Pre-requisites

  1. Databricks workspace
  2. Databricks metastore configured to workspace
  3. Databricks cluster (jobs/all purpose etc)

Install from PyPI

Install the package directly in a Databricks notebook:

%pip install databricks-tpcds

The package provides the DatabricksTPCDS library. You drive it from an entrypoint script like the Delta Lake example below.

Delta Lake entrypoint example

Fill in the placeholder catalog_name, bucket_name, prefix, and schema_name with your own values, then run it on your Databricks cluster.

from pyspark.sql import SparkSession
from databricks_tpcds.databricks_tpcds import DatabricksTPCDS


def main():
    catalog_name = 'my_catalog'
    bucket_name = 'my-bucket'
    prefix = 'path/to/tpcds-datasets/1TB'
    schema_name = 'my_schema'

    # Initialize Spark session
    spark = SparkSession.builder.appName("TPCDS Query Runner").getOrCreate()

    # Enable/disable cache
    spark.conf.set("spark.databricks.io.cache.enabled", "false")

    databricks_tpcds = DatabricksTPCDS(spark, schema_name=schema_name, catalog_name=catalog_name)

    # Create catalog
    databricks_tpcds.create_catalog()

    # Create schema
    databricks_tpcds.create_schema()

    # Create a single table, provide the table name
    # databricks_tpcds.create_table(bucket_name, prefix, "call_center")

    # Create multiple tables, provide the list of table names
    # databricks_tpcds.create_tables(bucket_name, prefix, ["call_center", "catalog_page"])

    # Create all tables, provide the bucket name and prefix, it'll create all the tables
    databricks_tpcds.create_all_tables(bucket_name, prefix)

    # Run all queries
    for i in range(3):
        time_taken_by_queries = databricks_tpcds.run_all_queries(should_warmup=False)
        print("QUERY_NUMBER,TIME_TAKEN")
        for query_no, time_taken in time_taken_by_queries.items():
            print(f"{query_no},{time_taken}")


if __name__ == "__main__":
    main()

Developing locally

  1. Modify the code if necessary in src/databricks_tpcds/databricks_tpcds.py
  2. Take a look or modify the queries in src/resources/queries/
  3. Build the package:
cd tpcds/databricks
python3.10 -m build
  1. Upload the built .whl to your Databricks workspace and install it in a notebook:
%pip install path/to/databricks_tpcds-0.4.0-py3-none-any.whl --force-reinstall
  1. Run the benchmark using the Delta Lake entrypoint example above.

Metadata

Release files for databricks-tpcds 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for databricks-tpcds 0.6.0
File Size Uploaded Provenance Actions
databricks_tpcds-0.6.0.tar.gz 44.5 kB Without provenance Details for databricks_tpcds-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for databricks-tpcds 0.6.0
File Interpreter ABI Platform Actions
databricks_tpcds-0.6.0-py3-none-any.whl Python 3 none any Details for databricks_tpcds-0.6.0-py3-none-any.whl

Total release size: 120.1 kB

Release files / databricks_tpcds-0.6.0.tar.gz

Download URL databricks_tpcds-0.6.0.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83ec49d4dbbfdaa7a524061d3296483761477eac2d2d48fe9a50c8447ba69571
BLAKE2b-256 checksum
How to use checksums
2eacf2fc2d49a731ddaabc91cdc3f6148697dc1d101730ce14756fe6feae91da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Release files / databricks_tpcds-0.6.0-py3-none-any.whl

Download URL databricks_tpcds-0.6.0-py3-none-any.whl
Size 75.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
59fa7eb6340414a8c423808e81f7531425473bc9415a93a08bfb2a557f2c31bf
BLAKE2b-256 checksum
How to use checksums
186ba9d462150b039a2aced775c697f2226fc24a942983ac998189950ae915a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for databricks-tpcds 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page