Skip to content

Commit 955f70f

Browse files
authored
docs: add partitioned ClickBench SQL example (apache#23637)
Continuation of apache#23315 > It would also help (maybe as a follow on PR) to give an explicit example of the SQL required for `hits_partitioned` _Originally posted by @alamb in apache#23315 (comment)
1 parent 0840e5c commit 955f70f

1 file changed

Lines changed: 17 additions & 5 deletions

File tree

benchmarks/README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,23 +507,35 @@ The runner applies two ClickBench-specific setup steps automatically:
507507
runner enables the parquet `binary_as_string` option so those columns
508508
are read as strings.
509509

510-
If you set up ClickBench manually through SQL, use the same `EventDate`
511-
view pattern:
510+
If you set up ClickBench manually through SQL, register the single-file
511+
dataset as follows:
512512

513513
```sql
514514
CREATE EXTERNAL TABLE hits_raw
515515
STORED AS PARQUET
516516
LOCATION 'benchmarks/data/hits.parquet';
517+
```
518+
519+
For the partitioned dataset, register the directory and enable
520+
`binary_as_string`:
521+
522+
```sql
523+
CREATE EXTERNAL TABLE hits_raw
524+
STORED AS PARQUET
525+
LOCATION 'benchmarks/data/hits_partitioned'
526+
OPTIONS ('binary_as_string' 'true');
527+
```
528+
529+
After registering either dataset as `hits_raw`, create the `hits` view with
530+
the required `EventDate` conversion:
517531

532+
```sql
518533
CREATE VIEW hits AS
519534
SELECT * EXCEPT ("EventDate"),
520535
CAST(CAST("EventDate" AS INTEGER) AS DATE) AS "EventDate"
521536
FROM hits_raw;
522537
```
523538

524-
For the partitioned dataset, use `benchmarks/data/hits_partitioned` and
525-
add `OPTIONS ('binary_as_string' 'true')` to the external table statement.
526-
527539
From the repository root, download data and run the default ClickBench
528540
queries against the single parquet file:
529541

0 commit comments

Comments
 (0)