HappenLee opened a new pull request, #68772:
URL: https://github.com/apache/doris/pull/68772

   ### What problem does this PR solve?
   
   Related PR: #49210, #49048
   
   Problem Summary:
   
   `printf` is not registered on master. Its original implementation was merged 
into `branch-c108335-hive-sql` in #49210; the corresponding master PR #49048 
was closed without merging.
   
   Restore the implementation from commit 
`fcab5d6bf213fca1ddd3e690d94e9ce4b7fa445a` and adapt it to the current BE 
function layout and primitive types. For example, `SELECT printf('%d-%s-%.2f', 
100, 'test', 3.14)` now returns `100-test-3.14`.
   
   The function accepts a format string followed by mixed string and numeric 
arguments. It uses `fmt::vsprintf`, handles constant and ordinary columns, 
accepts CHAR/VARCHAR/STRING, propagates NULL, and retains the original 
Decimal-to-Double coercion. Invalid format strings and unsupported argument 
types produce an error.
   
   Add BE tests for formatting, constant column combinations and errors, FE 
tests for binding and type coercion, and regression coverage.
   
   ### Release note
   
   Add `PRINTF(format_string[, args...])` for printf-style string formatting.
   
   ### Check List (For Author)
   
   - Test:
       - [x] Regression test: `test_printf`, generated output with 
`-forceGenOut` and then reran comparison; both passed.
       - [x] Unit Test: 7 BE `function_string_test.function_printf*` tests and 
3 FE `PrintfTest` tests passed.
       - [x] Manual test: ASAN BE/FE build, Checkstyle, clang-tidy, C++ 
formatting and BE build hygiene checks passed.
   
   Validation used `ENABLE_PCH=OFF` because the current toolchain reports an 
incomplete `wide::integer` instantiation in the existing PCH build. No build 
environment changes are included in this PR.
   
   - Behavior changed:
       - [x] Yes. Register the PRINTF scalar function.
   
   - Does this need documentation?
       - [x] No. PRINTF already has a function reference in the Doris 
documentation.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
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]

Reply via email to