cassandra: ~.cqlshrc does not work for float_precision

北城以北 提交于 2020-01-24 19:19:56

问题


I created file in .cassandra directory and changed the cqlshrc file.

[ui] float_precision = 10

But that did not work. I am using ccm with Cassandra in Ubuntu.


回答1:


Inside your cqlshrc file, you need to designate your [ui] section and define your float_precision on separate lines. In your example, it shows that you are defining them on the same line.

Here you can see that I have my cqlshrc file defined as you do. When querying a float in cqlsh, it defaults to a precision of 5.

aploetz@dockingBay94:~$ cat .cassandra/cqlshrc
[ui] float_precision = 10

aploetz@dockingBay94:~$ cqlsh -u aploetz -p aploetz
Connected to VaporTrails at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.1 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
aploetz@cqlsh> use stackoverflow ;
aploetz@cqlsh:stackoverflow> SELECT * FROm floattest;

 id                                   | value
--------------------------------------+---------
 d79fee54-e67b-4178-bfc9-155ffe6a9372 | 5.82375

(1 rows)

But when I put them on separate lines, it properly enforces my desired float precision:

aploetz@dockingBay94:~$ cat .cassandra/cqlshrc
[ui]
float_precision = 10

aploetz@dockingBay94:~$ cqlsh -u aploetz -p aploetz
Connected to VaporTrails at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.0.1 | CQL spec 3.3.1 | Native protocol v4]
Use HELP for help.
aploetz@cqlsh> use stackoverflow ;
aploetz@cqlsh:stackoverflow> SELECT * FROm floattest;

 id                                   | value
--------------------------------------+--------------
 d79fee54-e67b-4178-bfc9-155ffe6a9372 | 5.8237495422

(1 rows)


来源:https://stackoverflow.com/questions/34370958/cassandra-cqlshrc-does-not-work-for-float-precision

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!