[go: nahoru, domu]

Skip to content

Commit

Permalink
feat: add "initcap" function (#656)
Browse files Browse the repository at this point in the history
Initcap is like
"[title](https://github.com/Blizzara/substrait/blob/70d1eb71623ca0754157dd5d87348bae51d420c4/extensions/functions_string.yaml#L1023)",
but while "title" defines articles
 are not to be capitalized, initcap capitalizes also articles.

Initcap is supported by basically all DB systems, including Spark and
DataFusion
  • Loading branch information
Blizzara committed Jul 3, 2024
1 parent 7dbbf04 commit 95bc6ba
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions extensions/functions_string.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,34 @@ scalar_functions:
char_set:
values: [ UTF8, ASCII_ONLY ]
return: "fixedchar<L1>"
-
name: initcap
description: >-
Capitalizes the first character of each word in the input string, including articles,
and lowercases the rest. Implementation should follow the utf8_unicode_ci collations
according to the Unicode Collation Algorithm described at http://www.unicode.org/reports/tr10/.
impls:
- args:
- value: "string"
name: "input"
options:
char_set:
values: [ UTF8, ASCII_ONLY ]
return: "string"
- args:
- value: "varchar<L1>"
name: "input"
options:
char_set:
values: [ UTF8, ASCII_ONLY ]
return: "varchar<L1>"
- args:
- value: "fixedchar<L1>"
name: "input"
options:
char_set:
values: [ UTF8, ASCII_ONLY ]
return: "fixedchar<L1>"
-
name: char_length
description: >-
Expand Down

0 comments on commit 95bc6ba

Please sign in to comment.