Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inner (Hash) Join benchmark #408

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,12 @@
" total_time += round(end - start, 2)\n",
" count = count + 1\n",
" print(\"Retry times : {}, \".format(count) + appName + \" Microbenchmark takes {} seconds\".format(round(end - start, 2)))\n",
" print(appName + \" Microbenchmark takes average {} seconds after {} retries\".format(round(total_time/retryTimes),retryTimes))\n",
" "
" print(appName + \" Microbenchmark takes average {} seconds after {} retries\".format(round(total_time/retryTimes),retryTimes))\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 23,
"id": "682c67b1",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -86,6 +85,7 @@
"spark = SparkSession.builder.config(conf=conf).getOrCreate()\n",
"# Load dataframe and create tempView\n",
"spark.read.parquet(dataRoot + \"/tpcds/store_sales\").createOrReplaceTempView(\"store_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/store_returns\").createOrReplaceTempView(\"store_returns\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/catalog_sales\").createOrReplaceTempView(\"catalog_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/web_sales\").createOrReplaceTempView(\"web_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/item\").createOrReplaceTempView(\"item\")\n",
Expand Down Expand Up @@ -231,7 +231,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 7,
"id": "68169e7f",
"metadata": {},
"outputs": [
Expand All @@ -258,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 8,
"id": "f4d1d9ea",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -298,7 +298,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 11,
"id": "12ec99fb",
"metadata": {},
"outputs": [
Expand All @@ -324,7 +324,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 12,
"id": "86e12b88",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -364,7 +364,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 66,
"id": "30c8eb8e",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -397,7 +397,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 68,
"id": "d4f9f669",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -437,7 +437,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 17,
"id": "56af3f00",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -476,7 +476,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 18,
"id": "ae9cdc08",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -505,7 +505,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 22,
"id": "0571d861",
"metadata": {},
"outputs": [
Expand All @@ -529,9 +529,70 @@
"runMicroBenchmark(spark,\"Crossjoin\",query ,1)"
]
},
{
"cell_type": "markdown",
"id": "03d2f5e8",
"metadata": {},
"source": [
"### InnerJoin\n",
"This is a microbenchmark for inner join, one that has a small build table and one with a large build table. These joins are picked from the TPC-DS queries, while isolating join performance."
]
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 69,
"id": "c9e43255",
"metadata": {},
"outputs": [],
"source": [
"query = '''\n",
"select count(*)\n",
"from store_sales,\n",
" date_dim\n",
"where ss_sold_date_sk = d_date_sk\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8484e9bf",
"metadata": {},
"outputs": [],
"source": [
"runMicroBenchmark(spark,\"Inner Join - Small Build table\",query ,1)"
]
},
{
"cell_type": "code",
"execution_count": 73,
"id": "b7a60e67",
"metadata": {},
"outputs": [],
"source": [
"\n",
"query = '''\n",
"select count(*)\n",
"from store_sales, store_returns\n",
"where \n",
" ss_item_sk = sr_item_sk and\n",
" sr_ticket_number = ss_ticket_number\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b84ec32a",
"metadata": {},
"outputs": [],
"source": [
"runMicroBenchmark(spark,\"Inner Join - Large Build table\",query ,1)"
]
},
{
"cell_type": "code",
"execution_count": 75,
"id": "7c118cc9",
"metadata": {},
"outputs": [],
Expand All @@ -542,7 +603,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c9e43255",
"id": "0072624a",
"metadata": {},
"outputs": [],
"source": []
Expand All @@ -564,7 +625,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "975717da",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -113,6 +113,7 @@
"dataRoot = os.getenv(\"DATA_ROOT\", \"/data\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/customer\").createOrReplaceTempView(\"customer\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/store_sales\").createOrReplaceTempView(\"store_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/store_returns\").createOrReplaceTempView(\"store_returns\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/catalog_sales\").createOrReplaceTempView(\"catalog_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/web_sales\").createOrReplaceTempView(\"web_sales\")\n",
"spark.read.parquet(dataRoot + \"/tpcds/item\").createOrReplaceTempView(\"item\")\n",
Expand Down Expand Up @@ -541,13 +542,65 @@
"runMicroBenchmark(spark,\"Crossjoin\",query,2)"
]
},
{
"cell_type": "markdown",
"id": "67743d33",
"metadata": {},
"source": [
"### Inner join\n",
"This is a microbenchmark for inner join, one that has a small build table and one with a large build table. These joins are picked from the TPC-DS queries, while isolating inner join performance. When using GPUs this will be use a hash join to perform the inner join."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fc2092e8",
"metadata": {},
"outputs": [],
"source": []
"source": [
"query = '''\n",
"select count(*)\n",
"from store_sales,\n",
" date_dim\n",
"where ss_sold_date_sk = d_date_sk\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "53fdd3e5",
"metadata": {},
"outputs": [],
"source": [
"runMicroBenchmark(spark,\"Inner Join - Small Build table\",query ,2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "67ac6f79",
"metadata": {},
"outputs": [],
"source": [
"query = '''\n",
"select count(*)\n",
"from store_sales, store_returns\n",
"where \n",
" ss_item_sk = sr_item_sk and\n",
" sr_ticket_number = ss_ticket_number\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6bfeb978",
"metadata": {},
"outputs": [],
"source": [
"runMicroBenchmark(spark,\"Inner Join - Large Build table\",query ,2)"
]
}
],
"metadata": {
Expand All @@ -566,7 +619,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.2"
"version": "3.11.9"
}
},
"nbformat": 4,
Expand Down