Skip to content

Conversation

@slfan1989
Copy link
Contributor

@slfan1989 slfan1989 commented Nov 1, 2025

Which issue does this PR close?

Closes #1549.

Rationale for this change

  • Align our SQL string functions with Apache Spark by adding initcap(str).
  • Provide a native for better performance on large columns.
  • Ensure Unicode-aware, locale-independent behavior consistent with Spark semantics.

What changes are included in this PR?

  • Implement Unicode-aware word capitalization: first letter uppercase, remaining letters lowercase; non-letters preserved as delimiters.
  • Handle null/empty inputs (initcap(NULL) → NULL, initcap('') → '').
  • Wire up function registration and planner mapping so INITCAP resolves to the native kernel.
  • Add comprehensive unit tests (ASCII, Unicode, delimiters, mixed case, nulls, empties, long strings).

Are there any user-facing changes?

  • New function available: initcap(str).

How was this patch tested?

Junit Test & CI.

Signed-off-by: slfan1989 <slfan1989@apache.org>
@github-actions github-actions bot added the spark label Nov 1, 2025
@slfan1989 slfan1989 changed the title [AURON #1549] Implement native function of InitCap. [AURON #1549] Implement native function of InitCap. Nov 1, 2025
@slfan1989 slfan1989 marked this pull request as ready for review November 1, 2025 07:43
@slfan1989 slfan1989 changed the title [AURON #1549] Implement native function of InitCap. [AURON #1549] Implement native function of initcap. Nov 1, 2025
@guixiaowen
Copy link
Contributor

LGTM

@richox richox merged commit 5014b75 into apache:master Nov 3, 2025
98 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement native function of initcap

3 participants