BiteTheDDDDt opened a new pull request, #59906:
URL: https://github.com/apache/doris/pull/59906
### What problem does this PR solve?
This pull request refactors the codebase by removing the legacy `udf`
directory and its related files, consolidating user-defined function (UDF)
functionality into the new `vec/exprs/function_context` implementation. It also
updates all relevant includes and references throughout the codebase to use the
new location. Additionally, it removes the unused `_stale_expr_ctxs` logic from
several classes and modules, simplifying resource management for expression
contexts.
### UDF Refactoring and Directory Cleanup
* Removed the `udf` subdirectory from the build system and deleted its CMake
configuration and source files, fully deprecating the legacy UDF
implementation. (`be/CMakeLists.txt`, `be/src/udf/CMakeLists.txt`)
[[1]](diffhunk://#diff-3507aac2aff9b5fe5f66d28967f3aa848491d4ced2466f6bf201ab3a97531837L832)
[[2]](diffhunk://#diff-dea6b1a2f72c10f4fc0cc4c48152c415c60541077fd035c6627bd0b5adec0f9cL1-L26)
* Renamed and migrated `udf/udf.h` and `udf/udf.cpp` to
`vec/exprs/function_context.h` and `vec/exprs/function_context.cpp`, updating
all code comments and references to reflect the new structure.
[[1]](diffhunk://#diff-5a085fa9fc24ba20e16e56569ed72532be93709b43e36e7149121ea7ae351fa8L17-R23)
[[2]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccL17-L19)
### Codebase-wide Include Updates
* Replaced all `#include "udf/udf.h"` directives with `#include
"vec/exprs/function_context.h"` in affected modules, ensuring consistency and
future maintainability.
[[1]](diffhunk://#diff-adf4fada3277f58a65b283770d1309969d0d0167bd4a5aae58b31807d4e7c4e5L21-R22)
[[2]](diffhunk://#diff-b14814962710a0ff9710b6141b3fc2c5a492fb3284254966cdfd1b0a28de0553L32-R33)
[[3]](diffhunk://#diff-ba47d784a52d375a969014eac3244b1d56c7302d09bd184bcac4a15117fe50bbL21-R23)
[[4]](diffhunk://#diff-42bfdbb7f380191848ab3078380ab28d1b93177c189f2a0fffdee0d69da13494L45)
[[5]](diffhunk://#diff-66e6f23e815b6c5f952dabc06cde8ec7a5d20144b500c523890127085fdd667cL42)
[[6]](diffhunk://#diff-25ded31ac19678798c2a499d2635fe2c68ed86e41d2d5f6e64cb7fc1811f5d66L26)
[[7]](diffhunk://#diff-3f379e2eb89e851f445dc67d09353a48756faa5020a04e59cf4d3508f2c06aa5L63)
[[8]](diffhunk://#diff-917cff4d9270b2fd219b5d32a0198cb5759ad4196897c4415663f371f2d79845L32)
[[9]](diffhunk://#diff-d571ee8d57e4a0536cfd97ab954c8607bcd3d155058c33fed3da8c4e4f
5d1debL27-R27)
[[10]](diffhunk://#diff-49cc84a21912031949401756043d8fa3ba7511928f93751623333b686a057fd9L25-R25)
### Expression Context Resource Management Simplification
* Removed the `_stale_expr_ctxs` member and all related logic from
`ScanLocalState`, `ScanOperatorX`, and `Scanner` classes, as well as their
usage in `scan_operator.cpp` and `scanner.cpp`, streamlining expression context
lifecycle management.
[[1]](diffhunk://#diff-ac38473f151ccd99db4ed80dfbfa176f4f957ae2f5335ce8fbb4f5dbb0e932e9L186-L189)
[[2]](diffhunk://#diff-ac38473f151ccd99db4ed80dfbfa176f4f957ae2f5335ce8fbb4f5dbb0e932e9L298)
[[3]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2L311-L313)
[[4]](diffhunk://#diff-f5a0db9faf0b649227b0126cca493d8dce22c9d497116fd480d7d018ce1696d2L421-L423)
[[5]](diffhunk://#diff-2c575051a29b06200611882d17cb4c0fea6df46659e8ea953c705aaca2c2b5a4L241-L243)
[[6]](diffhunk://#diff-17432beb88ab0d918d9bbe41b3ba500e3f5102645896e89587a4dc43bcab2125L74)
[[7]](diffhunk://#diff-17432beb88ab0d918d9bbe41b3ba500e3f5102645896e89587a4dc43bcab2125L227-L230)
### Minor Improvements and Cleanups
* Updated comments and documentation in the new `function_context.h` to
clarify UDF usage and semantics, and made minor improvements to code style and
naming.
[[1]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccL46-R61)
[[2]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccL123-R123)
[[3]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccL152-R154)
[[4]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccL203-R200)
[[5]](diffhunk://#diff-18893ab85e5c3bb4a2d0b01e0d62434f3f4f86c47a5221d600d3a8254dbe59ccR216)
* Added missing includes for `vec/common/arena.h` where necessary to support
string buffer and column operations.
[[1]](diffhunk://#diff-59ad32ff05a22e3c0750589ed971a2cab922a7d91d3ad526acace6f6dcad20b8R36)
[[2]](diffhunk://#diff-fc4e983dc58b2ef7fbced53547a021834db711969e048ee533cf7f1f827c46beR24)
[[3]](diffhunk://#diff-3f379e2eb89e851f445dc67d09353a48756faa5020a04e59cf4d3508f2c06aa5R86)
These changes collectively modernize and simplify the handling of
user-defined functions in the codebase, reducing technical debt and improving
maintainability.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [ ] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason <!-- Add your reason? -->
- Behavior changed:
- [ ] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [ ] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]