gianm commented on PR #15694: URL: https://github.com/apache/druid/pull/15694#issuecomment-1897600865
Personally, I like the `Expr#singleThreaded` approach, since it may be useful in the future for other purposes. Some other Exprs could benefit from singlethreadedness: - `timestamp_floor` could cache the last-seen timestamp and result of flooring that timestamp, so when the underlying data has a run of the same timestamps, it doesn't need to keep recomputing the floor. - `concat` allocates a new StringBuilder on every call to `apply`; instead it could allocate a reusable buffer once on `singleThreaded` - we might in the future want a utf-8 constant expr holding a ByteBuffer, which would need to `duplicate()` the ByteBuffer on each call to `apply`, unless it's `singleThreaded`, in which case it could skip the duplicate. It also is safe to use: if a caller forgets to call `singleThreaded()`, nothing breaks terribly, things are just somewhat less efficient due to having more allocations on `apply`. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
