Round number

Supported in: Batch, Streaming

Round number to 'scale' decimal places.

Expression categories: Numeric

Declared arguments

  • Column - The column to apply round on.
    Expression<Decimal | Double | Float>
  • optional Scale - Decimal points to round to, defaults as 0.
    Literal<Integer>

Output type: Decimal | Double | Float

Examples

Example 1: Base case

Argument values:

  • Column: 10.123
  • Scale: 2

Output: 10.12


Example 2: Base case

Argument values:

  • Column: 10.123
  • Scale: null

Output: 10.0


Example 3: Base case

Argument values:

  • Column: number
  • Scale: 2
numberOutput
nullnull

Example 4: Base case

Argument values:

  • Column: number
  • Scale: 0
numberOutput
3235236688123456789012345678901234567832352366881234567890123456789012345678

Example 5: Base case

Argument values:

  • Column: number
  • Scale: -38
numberOutput
100000000000000000000000000000000000780

Example 6: Base case

Argument values:

  • Column: number
  • Scale: -1
numberOutput
1000000000000000000000000000000000007810000000000000000000000000000000000080