Help Center/ MapReduce Service/ Component Operation Guide (Normal)/ Using CarbonData (for MRS 3.x or Later)/ CarbonData FAQs/ Why Is Incorrect Output Displayed When I Perform Query with Filter on Decimal Data Type Values?
Updated on 2024-12-11 GMT+08:00

Why Is Incorrect Output Displayed When I Perform Query with Filter on Decimal Data Type Values?

Question

Why is incorrect output displayed when I perform query with filter on decimal data type values?

For example:

select * from carbon_table where num = 1234567890123456.22;

Output:

+------+---------------------+--+
| name |        num          |
+------+---------------------+--+
| IAA  | 1234567890123456.22 |
| IAA  | 1234567890123456.21 |
+------+---------------------+--+

Answer

To obtain accurate output, append BD to the number.

For example:

select * from carbon_table where num = 1234567890123456.22BD;

Output:

+------+---------------------+--+
| name |        num          |
+------+---------------------+--+
| IAA  | 1234567890123456.22 |
+------+---------------------+--+