Setting decimal precision in SparkSQL 

Setting decision precision in SparkSQL when creating tables with the DECIMAL datatype.

SparkSQL uses Hive 0.13 which supports specifying scale and precision when creating tables with the DECIMAL data type.

Use DECIMAL(precision, scale) syntax to specify precision and scale. For example, to specify a precision of 8 and a scale of 3 when creating tables with the DECIMAL data type:
CREATE TABLE test_decimal_table (pkey DECIMAL(8,3), ckey1 DECIMAL(8,3), data1 DECIMAL(8,3)) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS TEXTFILE;

When scale is not specified, the default scale is 0 with no fractional digits.

When precision is not specified, the default precision is 10.