Github user maropu commented on a diff in the pull request:
https://github.com/apache/spark/pull/22048#discussion_r213537424
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala ---
@@ -294,23 +294,29 @@ class Dataset[T] private[sql](
// We set a minimum column width at '3'
val minimumColWidth = 3
+ // Regular expression matching full width characters
+ val fullWidthRegex =
"""[\u1100-\u115F\u2E80-\uA4CF\uAC00-\uD7A3\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE6F\uFF00-\uFF60\uFFE0-\uFFE6]""".r
+ // The number of half width of a string
+ def stringHalfWidth = (str: String) => {
+ str.length + fullWidthRegex.findAllIn(str).size
+ }
--- End diff --
better to move this method into `util.Utils` or something as a helper
function?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]