Skip to content

sql: inconsistent printing of decimals #13384

@RaduBerinde

Description

@RaduBerinde

When using distsql I noticed that decimal results sometimes print differently when a query is distributed. This probably has to do with them going through an encoding and decoding cycle over the wire.

query RRRR
SELECT AVG(k::decimal), AVG(v::decimal), SUM(k::decimal), SUM(v::decimal) FROM kv
----
5.0000000000000000 2.8000000000000000 30 14

    		expected:
    		    5.0000000000000000 2.8000000000000000 30 14
    		    
    		but found (query options: "") :
    		    5  2.8  30  14  

Haven't looked at the details but I'm guessing we end up with a different but equivalent inf.Dec (different scale I guess?). Perhaps a sufficient solution is to always trim away any unnecessary 0s when printing.

Blocks #13377.
CC @nvanbenschoten @mjibson

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions