mzabaluev opened a new issue, #1318: URL: https://github.com/apache/auron/issues/1318
**Describe the bug** The optimized helper function for finding the common prefix length is incorrect. **To Reproduce** 1. Add this test to [`sort_exec.rs`](https://github.com/apache/auron/blob/99496ab5e8ee550eee2ec89f6495c85036efeeb6/native-engine/datafusion-ext-plans/src/sort_exec.rs): ```rust #[test] fn has_common_prefix_len_been_optimized_into_bogusness() { let cpl = common_prefix_len(&[0; 8], &[0; 8]); assert_eq!(cpl, 8); let cpl = common_prefix_len(&[0; 4], &[0; 4]); assert_eq!(cpl, 4); let cpl = common_prefix_len(&[0; 2], &[0; 2]); assert_eq!(cpl, 2); let cpl = common_prefix_len(&[0; 1], &[0; 1]); assert_eq!(cpl, 1); } ``` 2. Run the test. **Proposed fix** Change the `< min_len` comparisons to `<= min_len`. Or just replace with a simple implementation and benchmark if the tweaky one really regresses perf, e.g.: ```rust fn common_prefix_len(a: &[u8], b: &[u8]) -> usize { std::iter::zip(a, b) .position(|(x, y)| x != y) .unwrap_or_else(|| min(a.len(), b.len())) } ``` -- 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]
