Rachelint commented on PR #12395: URL: https://github.com/apache/datafusion/pull/12395#issuecomment-2369137718
> > Thanks. I added some case to check it. And unfortunately, I found maybe we can't remove the unsafe codes currently. > > I just can't explain why pointer arithmetic is needed -- I think it is important to fix (or really understand) before merging Maybe the disscussions in https://github.com/apache/datafusion/issues/12387 can help. The logic of ` str::trim_xxx_matches` is well explained by @Kev1n8 ``` I've looked into the implementation of [general_trim](https://github.com/apache/datafusion/blob/f5c47fa274d53c1d524a1fb788d9a063bf5240ef/datafusion/functions/src/string/common.rs#L51), it uses the str::trim_xxx_matches methods the obtain the "substring". Furthermore, inside the str::trim_xxx_matches method, it first computes the [start, end) boundary and slices the str. ``` But unforunately, the needed feature `Pattern` for getting the `start` index by safe codes is still unstable... @Kev1n8 mentioned that, too. ``` The index here is useful for modifying views. Unfortunately, currently the feature Pattern it uses is unstable. ``` So eventually, we can just through the pointer arithmetic to get the start index currently... -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org