Kapil Singh created SPARK-16889: ----------------------------------- Summary: 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
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 (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org