Comments (3)
We probably need some fast way to have a rough estimate on the number of distinct values in the aggregate keys, maybe dynamically based on the first batch(es).
Does your TableProvider
column stats work provide any useful base for this in situations where we're running aggregations on original table columns (as opposed to computed exprs) or is that too coarse?
from arrow-datafusion.
We probably need some fast way to have a rough estimate on the number of distinct values in the aggregate keys, maybe dynamically based on the first batch(es).
Does your
TableProvider
column stats work provide any useful base for this in situations where we're running aggregations on original table columns (as opposed to computed exprs) or is that too coarse?
I think yes, for cases where the table is queried directly and we have statistics for distinct values available, those could be using heuristics for group by
expressions based on cardinality statistics (say if you use column a and b maybe distinct(a)*distinct(b) would be an OK heuristic).
We also need the same support of distinct values per column for generalizing the join order optimization rule to more complicated joins and with more expressions than those directly on tables.
Support for collecting those statistics (i.e. ANALYZE TABLE
) would need to be added too.
To support the more general case we probably need a way to estimate the cardinality of the intermediate results, based on sampling one or a couple of batches with the particular group by expression.
I added this requirement in this design doc:
https://docs.google.com/document/d/17DCBe_HygkjsoMzC4Znw-t8i1okLGlBkf0kp8DfLBhk/edit?usp=drivesdk
from arrow-datafusion.
I also realize I may have implemented this in an inefficient way. Looking at Spark it does first a partial aggregate followed by a hash repartition followed by another aggregation. I think this will not slow down the low cardinality query that much (as the result set will be small already after first aggregate) while being fast - maybe even faster - for high cardinality aggregates.
from arrow-datafusion.
Related Issues (20)
- Improve create_initial_plan to get rid of "stack overflow" issues on complex queries
- Support backwards compatible / un prefixed config options (`compression` rather than `parquet.compression`) HOT 3
- Keep track of common sub-expression across logical plan nodes HOT 5
- Replace `Box`es with `Arc` in the `Expr` `enum`. HOT 17
- Fix publish to allow for dev-dependencies to have circular references HOT 3
- Support `AtTimeZone` node in `SqlToRel` HOT 4
- ApproxPercentileAccumulator returns execution error when no values
- make UDFs in datafusion-functions public
- Regression: Wrong result when there are 2 count(distinct) HOT 8
- add an alias to unnest() raise error HOT 6
- Unnest function is the subexpression in the projection
- Blog post with DataFusion Jan - June 2024 HOT 4
- Support build right with HashJoin in DataFusion HOT 4
- to_timestamp benchmark doesn't actually run the test HOT 2
- Eliminate constant columns from sort requirements HOT 4
- Use object_store:BufWriter instead of put_multipart HOT 5
- Port `ArrayPosition` and `ArrayPositions` to `functions-array` subcrate HOT 1
- `/benchmark` command seems not to work HOT 9
- Port `ArrayExcept` to `functions-array` subcrate HOT 1
- Port `ArrayRemove`, `ArrayRemoveN`, `ArrayRemoveAll` to `functions-array` subcrate HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arrow-datafusion.