berkaysynnada commented on PR #7793:
URL: 
https://github.com/apache/arrow-datafusion/pull/7793#issuecomment-1764521549

   > Which selectivity estimator provides an inexact point instead of a 
lower/upper bound?
   
   I can give an example of how `FilterExec::statistics()` currently works on a 
table having one column. 
   
   Let's assume that the number of rows from input statistics() is exactly 
1000, and the range of the column values is [1,100]. The predicate is 
`column_a>90`. 
   
   After the analysis, the new range of the column would become [91,100], which 
estimates the selectivity as 0.1 (intervals are assumed to be uniform, they 
cannot be treated any differently yet). 
https://github.com/apache/arrow-datafusion/blob/fa2bb6c4e80d80e3d1d26ce85f7c21232f036dd5/datafusion/physical-expr/src/analysis.rs#L218-L223
   
   Now, when we update the number of rows, we use that selectivity value and 
find the new row count as 1000*0.1=100. 
   
https://github.com/apache/arrow-datafusion/blob/fa2bb6c4e80d80e3d1d26ce85f7c21232f036dd5/datafusion/physical-plan/src/filter.rs#L233-L235
   These lines become:
   
   
https://github.com/synnada-ai/arrow-datafusion/blob/23c564b093f8a60b95bbf9f774a1afe9b2908bc7/datafusion/physical-plan/src/filter.rs#L221-L224
   
   Though the input row count is exact, we cannot take that exactness 
information further. At that point, how can we define a range for 100 rows? 
That is why we needed such Inexact implementation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to