File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,8 @@ fn register_clickbench_hits_table(rt: &Runtime) -> SessionContext {
130130 format ! ( "{BENCHMARKS_PATH_2}{CLICKBENCH_DATA_PATH}" )
131131 } ;
132132
133- let sql = format ! ( "CREATE EXTERNAL TABLE hits STORED AS PARQUET LOCATION '{path}'" ) ;
133+ let sql =
134+ format ! ( "CREATE EXTERNAL TABLE hits_raw STORED AS PARQUET LOCATION '{path}'" ) ;
134135
135136 // ClickBench partitioned dataset was written by an ancient version of pyarrow that
136137 // that wrote strings with the wrong logical type. To read it correctly, we must
@@ -139,6 +140,17 @@ fn register_clickbench_hits_table(rt: &Runtime) -> SessionContext {
139140 . unwrap ( ) ;
140141 rt. block_on ( ctx. sql ( & sql) ) . unwrap ( ) ;
141142
143+ // ClickBench stores EventDate as UInt16 (days since 1970-01-01). Create a view
144+ // that exposes it as SQL DATE so that queries comparing it with date literals
145+ // (e.g. "EventDate >= '2013-07-01'") work correctly during planning.
146+ rt. block_on ( ctx. sql (
147+ "CREATE VIEW hits AS \
148+ SELECT * EXCEPT (\" EventDate\" ), \
149+ CAST(CAST(\" EventDate\" AS INTEGER) AS DATE) AS \" EventDate\" \
150+ FROM hits_raw",
151+ ) )
152+ . unwrap ( ) ;
153+
142154 let count =
143155 rt. block_on ( async { ctx. table ( "hits" ) . await . unwrap ( ) . count ( ) . await . unwrap ( ) } ) ;
144156 assert ! ( count > 0 ) ;
You can’t perform that action at this time.
0 commit comments