Closed
Labels
bugSomething isn't working
Description
Describe the bug
I converted tpch csv files to parquet and found that I cannot query with simple predicate on a string column.
> create external table customer stored as parquet location '/mnt/bigdata/tpch-sf1000-parquet/customer';
0 rows in set. Query took 0.000 seconds.
> SELECT c_mktsegment, COUNT(*) FROM customer GROUP BY c_mktsegment;
+--------------+-----------------+
| c_mktsegment | COUNT(UInt8(1)) |
+--------------+-----------------+
| HOUSEHOLD | 30003565 |
| BUILDING | 29998146 |
| FURNITURE | 29999758 |
| MACHINERY | 30003128 |
| AUTOMOBILE | 29995355 |
+--------------+-----------------+
5 rows in set. Query took 0.758 seconds.
> SELECT concat('[', c_mktsegment, ']') from customer limit 5;
+------------------------------------------+
| concat(Utf8("["),c_mktsegment,Utf8("]")) |
+------------------------------------------+
| [MACHINERY] |
| [HOUSEHOLD] |
| [BUILDING] |
| [AUTOMOBILE] |
| [HOUSEHOLD] |
+------------------------------------------+
5 rows in set. Query took 0.028 seconds.
> SELECT COUNT(*) FROM customer WHERE c_mktsegment = 'BUILDING';
+-----------------+
| COUNT(UInt8(1)) |
+-----------------+
| 0 |
+-----------------+
1 row in set. Query took 0.398 seconds.
> SELECT COUNT(*) FROM customer WHERE c_mktsegment = 'HOUSEHOLD';
+-----------------+
| COUNT(UInt8(1)) |
+-----------------+
| 0 |
+-----------------+
1 row in set. Query took 0.386 seconds.
> SELECT COUNT(*) FROM customer WHERE c_mktsegment LIKE 'HOUSEHOLD';
+-----------------+
| COUNT(UInt8(1)) |
+-----------------+
| 30003565 |
+-----------------+
1 row in set. Query took 0.663 seconds.
The odd thing is that I see the behavior when querying from Spark, so I guess something is wrong with the parquet file.
scala> spark.sql("SELECT c_mktsegment, COUNT(*) FROM customer GROUP BY c_mktsegment").show
+------------+--------+
|c_mktsegment|count(1)|
+------------+--------+
| MACHINERY|30003128|
| AUTOMOBILE|29995355|
| BUILDING|29998146|
| HOUSEHOLD|30003565|
| FURNITURE|29999758|
+------------+--------+
scala> spark.sql("SELECT COUNT(*) FROM customer WHERE c_mktsegment = 'BUILDING'").show
+--------+
|count(1)|
+--------+
| 0|
+--------+
To Reproduce
Run the above queries in datafusion-cli
Expected behavior
Simple predicates should work.
Additional context
The parquet files were generated by the conversion utility in the tpch benchmarks.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
[-]Simple predicates against Parquet relations are not working[/-][+]tpch conversion generates parquet files that cannot be queried on simple predicates[/+]andygrove commentedon Aug 12, 2021
If I comment out the code in our parquet reader that filters out row groups based on predicates then I see the expected results.
My conclusion is that we have a bug in our DataFusion/Parquet writer where we are writing incorrect statistics somehow.
houqp commentedon Aug 12, 2021
Might be related to apache/arrow-rs#643. Have you tried running it with arrow master?
andygrove commentedon Aug 12, 2021
Thanks @houqp yes that is it. I tested with Arrow master and it works. Perhaps we can put out a patch release on DataFusion/Ballista at some point soon with this fix.
houqp commentedon Aug 12, 2021
Yep, once arrow 5.2 release is out, i will start a patch release for datafusion.
alamb commentedon Aug 12, 2021
I plan to make an arrow-rs 5.2.0 RC this afternoon. The cool thing about using sem-ver versioning is that
cargo updateshould be sufficient to get the fix for arrow without any changes to datafusionIf we want to ensure anyone running datafuson is also using at least arrow 5.2.0 (and thus has the fix for apache/arrow-rs#643) we would need a new datafusion release
houqp commentedon Aug 13, 2021
That's a very good point @alamb :D This certainly makes me less stressed about the patch release.
UPDATE: actually, i take it back, looks like datafusion currently has arrow pinned to 5.1 :(
perf: Add benchmarks for Spark Scan + Comet Exec (apache#863)