You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Hyukjin Kwon (JIRA)" <ji...@apache.org> on 2019/05/21 04:21:30 UTC

[jira] [Updated] (SPARK-16889) Add formatMessage Column expression for formatting strings in java.text.MessageFormat style in Scala API

     [ https://issues.apache.org/jira/browse/SPARK-16889?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hyukjin Kwon updated SPARK-16889:
---------------------------------
    Labels: bulk-closed  (was: )

> Add formatMessage Column expression for formatting strings in java.text.MessageFormat style in Scala API 
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: SPARK-16889
>                 URL: https://issues.apache.org/jira/browse/SPARK-16889
>             Project: Spark
>          Issue Type: New Feature
>          Components: SQL
>            Reporter: Kapil Singh
>            Priority: Major
>              Labels: bulk-closed
>
> format_string formats the arguments in printf-style and has following major cons compared to proposed function for formatting java.text.MessageFormat:
> 1. MessageFormat syntax is more readable since it is more explicit
> java.util.Formatter syntax: "Argument '%s' shall not be negative. The given value was %f."
> java.text.MessageFormat syntax: "Argument '{0}' shall not be negative. The given value was {1}."
> 2. Formatter forces user to declare the argument type (e.g. "%s" or "%f"), while MessageFormat infers it from the object type. For example if the argument could be a string or a number, then Formatter forces us to use the "%s" type (passing a string to "%f" causes an exception). However a number formatted with "%s" is formatted using Number.toString(), which produce an unlocalized value. By contrast, MessageFormat produces localized values dynamically for all recognized types.
> To address these drawbacks, a MessageFormat function should be added.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org