dongjoon-hyun opened a new pull request, #461: URL: https://github.com/apache/spark-connect-swift/pull/461
### What changes were proposed in this pull request? This PR aims to add string functions in a new file, `StringFunctions.swift`. The function names and signatures follow Scala's `org.apache.spark.sql.functions` (`@group string_funcs`), covering 72 functions (111 overloads including `Column`-based and literal-based signatures). | Category | Functions | | --- | --- | | Case and basic conversion | `lower`/`lcase`, `upper`/`ucase`, `initcap`, `ascii`, `char`, `chr`, `soundex`, `quote` | | Length | `length`, `len`, `char_length`, `character_length`, `bit_length`, `octet_length` | | Trim and pad | `trim`, `ltrim`, `rtrim` (each with trim-string overloads), `btrim`, `lpad`, `rpad` | | Search and comparison | `instr`, `locate`, `position`, `contains`, `startswith`, `endswith`, `find_in_set`, `levenshtein` (with a `threshold` overload), `jaro_winkler_similarity` | | Transformation | `concat_ws`, `format_number`, `format_string`, `printf`, `elt`, `repeat`, `replace`, `translate`, `overlay`, `left`, `right`, `substr`, `substring`, `substring_index`, `split_part`, `mask`, `sentences`, `randstr` | | Regular expression | `regexp_count`, `regexp_extract`, `regexp_extract_all`, `regexp_instr`, `regexp_replace`, `regexp_substr`, `split` | | Encoding and conversion | `base64`, `unbase64`, `encode`, `decode`, `to_binary`, `try_to_binary`, `to_char`, `to_varchar`, `to_number`, `try_to_number` | | UTF-8 validation | `is_valid_utf8`, `make_valid_utf8`, `validate_utf8`, `try_validate_utf8` | | Collation | `collate`, `collation` | The following are excluded intentionally. | Excluded | Reason | | --- | --- | | `concat` | It belongs to `collection_funcs` in Scala and will be handled by a separate PR. | | `lpad`/`rpad` with `Array[Byte]` pad | Binary literals are not supported by `lit()` in this client yet. | ### Why are the changes needed? To improve the usability of the column-based `DataFrame` API by providing string functions in the same shape as Scala/PySpark, so users can write queries without falling back to `selectExpr` or raw SQL strings. ### Does this PR introduce _any_ user-facing change? Yes, this adds new public functions. There is no behavior change to existing APIs. ### How was this patch tested? Pass the CIs with a newly added test suite. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 5 -- 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]
