Skip to main content

Run the TPC-DS benchmark on Databricks (Delta Lake).

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

databricks_tpcds-0.4.0.tar.gz (39.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

databricks_tpcds-0.4.0-py3-none-any.whl (70.3 kB view details)

Uploaded Python 3

File details

Details for the file databricks_tpcds-0.4.0.tar.gz.

File metadata

  • Download URL: databricks_tpcds-0.4.0.tar.gz
  • Upload date:
  • Size: 39.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for databricks_tpcds-0.4.0.tar.gz
Algorithm Hash digest
SHA256 affbe22b9309a27f094faa67e9c498091fb76add48fcb04e734b83a00ef7abca
MD5 8eda1603347b7c0a22166f0745934f50
BLAKE2b-256 7ef2f7dedc46276bc77360991096d26f3bdcd853d9dab8e85433d37522de3e3a

See more details on using hashes here.

File details

Details for the file databricks_tpcds-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for databricks_tpcds-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 152d36bbbe6d9852cb1884697353b92947b36fcdb97d09bfdde727b255c30874
MD5 2958ef7b6e440b7fec350450d7ba6436
BLAKE2b-256 e3eae82a55363507118193fd8e54caaba2c0f8c89d50d003ca1ad8c355e2b713

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page