On this page

    Decimal Support

    When you connect to a new relational database source, the default is to map decimal to decimal.

    SourceDecimal Support
    Relational databases: See Data Type Mappings for External Sources for the current list of supported relational sources.Decimal-to-decimal
    Parquet (AWS Glue)Decimal data types
    Text (CSV), JSON filesCast strings and integers to decimals with decimal precision and scale.

    Mixed Decimal Types

    Dremio Cloud supports mixed decimal types for AWS Glue datasets that are either in Parquet files or Optimized Row Columnar (ORC) files.

    A DECIMAL type has precision (p) and scale (s): DECIMAL(p,s). For example, DECIMAL(9,2). Precision is the total number of digits. Scale is the number of digits to the right of the decimal point.

    When you perform arithmetic on DECIMAL types that have different precision and/or scale, the return value will have sufficient precision and scale to hold the result of the operation.

    Limitations

    The following are decimal limitations:

    • Decimal numeric literals in SQL queries cannot be larger than the maximum possible long value.

    • Queries that do arithmetic on a column and literal may cause errors.

      For example, SELECT CAST(12345 as DOUBLE) * CAST(A as DOUBLE) fails. The workaround is to use a string value such as SELECT CAST('12345' as DOUBLE) * CAST(A as DOUBLE).

    • Queries casting numeric literals to decimal should use specific precision. Precision of literal cannot be lowered.

      For example, CAST(123.23 as DECIMAL(2,0)) returns the same number as the output since the given number cannot be represented using a precision of 2.

    • When there is an overflow with the decimal arithmetic output, the returned result will overflow.