Github user javadba commented on the pull request:
https://github.com/apache/spark/pull/1586#issuecomment-50936508
Hi,
I have updated the codebase to match our present level of discussions -
and to include the merge from upstream.
Takuya's test cases have been incorporated as well - but I found some
differences in my results. @ueshin please review the following, some of which
do differ from your results presented above - especially for UTF-16
checkEvaluation(OctetLength(
Literal("\uF93D\uF936\uF949\uF942", StringType), "ISO-8859-1"), 4)
// Chinese characters get truncated by ISO-8859-1 encoding
checkEvaluation(OctetLength(
Literal("\uF93D\uF936\uF949\uF942", StringType), "UTF-8"), 12) //
chinese characters
checkEvaluation(OctetLength(
Literal("\uD840\uDC0B\uD842\uDFB7", StringType), "UTF-8"), 8) // 2
surrogate pairs
checkEvaluation(OctetLength(
Literal("\uF93D\uF936\uF949\uF942", StringType), "UTF-16"), 10) //
chinese characters
checkEvaluation(OctetLength(
Literal("\uD840\uDC0B\uD842\uDFB7", StringType), "UTF-16"), 10) // 2
surrogate pairs
checkEvaluation(OctetLength(
Literal("\uF93D\uF936\uF949\uF942", StringType), "UTF-32"), 16) //
chinese characters
checkEvaluation(OctetLength(
Literal("\uD840\uDC0B\uD842\uDFB7", StringType), "UTF-32"), 8) // 2
surrogate pairs
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---