pitrou commented on a change in pull request #11298:
URL: https://github.com/apache/arrow/pull/11298#discussion_r721353442
##########
File path: cpp/src/arrow/compute/kernels/scalar_string.cc
##########
@@ -592,6 +592,70 @@ struct Utf8ReverseTransform : public StringTransformBase {
template <typename Type>
using Utf8Reverse = StringTransformExec<Type, Utf8ReverseTransform>;
+struct Utf8NfTransformBase : public StringTransformBase {
+ int64_t MaxCodeunits(int64_t ninputs, int64_t input_ncodeunits) override {
+ // Section 5.18 of the Unicode spec claims that the number of codepoints
for case
Review comment:
Answer: there are really pathological cases, so I think it would be
better to dynamically resize the output:
```python
>>> s = "\ufdfa"
>>> len(s)
1
>>> len(unicodedata.normalize("NFKD", s))
18
>>> len(unicodedata.normalize("NFD", s))
1
>>> len(unicodedata.normalize("NFKC", s))
18
>>> len(unicodedata.normalize("NFC", s))
1
```
--
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]