Class Formatting


  • public class Formatting
    extends Object
    Provides implementations of common formatting functions. The format specification is defined by Formatter.

    Reference the Formatter documentation for the capabilities and limitations of the formatting that is available. The format specification is not validated before being used. Therefore errors in the format specification are not discovered until execution.

    See Also:
    ScalarValuedFunction, DeriveFields
    • Constructor Detail

      • Formatting

        public Formatting()
    • Method Detail

      • formatValues

        public static ScalarValuedFunction formatValues​(String format,
                                                        String[] fieldNames)
        Format values for the fields within a record token using the given format. The format must be valid for the types of the input fields.
        Parameters:
        format - format specification indicating how to format the token values
        fieldNames - names of the fields to supply to the formatter, order is relevant
        Returns:
        a function that when applied formats input fields into a string using the given format
      • format

        public static ScalarValuedFunction format​(String format,
                                                  ScalarValuedFunction... exprs)
        Format output values of the given functions using the given format. The format must be valid for the types of the input fields.
        Parameters:
        format - format specification indicating how to format the token values
        exprs - functions providing outputs to be formatted
        Returns:
        a function that when applied formats input fields into a string using the given format
      • format

        public static ScalarValuedFunction format​(String format,
                                                  List<ScalarValuedFunction> exprs)
        Format the output values of the given functions using the given format. The format must be valid for the types of the input fields.
        Parameters:
        format - format specification indicating how to format the token values
        exprs - functions providing outputs to be formatted
        Returns:
        a function that when applied formats input fields into a string using the given format