-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[YCQL] add support for toJSON(), fromJSON() built-ins #992
Comments
For examples: See http://cassandra.apache.org/doc/4.0/cql/json.html#the-tojson-function As reported by @hreidar - the DataGrip tool seems to rely on the toJSON() in the SELECT clause. It would be nice for us to add this support and allow folks to access YCQL via DataGrip. |
Another user reported:
|
Summary: Fix for #992: [YCQL] add support for toJSON(), fromJSON() built-ins - added function toJson() only (in the current implementation) for all types with exception of UDT & FROZEN. Test Plan: ybd --java-test org.yb.cql.TestSelect#testToJson ybd --cxx-test ql-select-expr-test --gtest_filter QLTestSelectedExpr.TestQLSelectToJson ybd --cxx-test bfql-test --gtest_filter BfqlTest.TestBuiltinToJson Selecting values from the system tables: CASSANDRA: ``` cqlsh:a> select tojson(replication) from system_schema.keyspaces where keyspace_name='system_auth'; system.tojson(replication) ------------------------------------------------------------------------------------- {"class": "org.apache.cassandra.locator.SimpleStrategy", "replication_factor": "1"} (1 rows) ``` YUGABYTE: ``` cqlsh:a> select tojson(replication) from system_schema.keyspaces where keyspace_name='system_auth'; tojson(replication) ---------------------------------------------------------------------------------- {"class":"org.apache.cassandra.locator.SimpleStrategy","replication_factor":"1"} (1 rows) ``` EQUAL FORMAT: ``` Types/Values | Yugabyte | Cassandra | ------------------------------------------------------------------ TEXT | "string"| "string"| Integer types: TINYINT,| | | SMALLINT,INT, BIGINT | -123| -123| DOUBLE, FLOAT | -1.125| -1.125| DOUBLE, FLOAT - | | | NaN, Infinity | null| null| DATE | 2018-02-14| 2018-02-14| TIME | 01:02:03.123456789| 01:02:03.123456789| BLOB | 0xdeadbeaf| 0xdeadbeaf| INET | "1.2.3.4"| "1.2.3.4"| VARINT | -123456| -123456| DECIMAL | -1024.25| -1024.25| BOOLEAN | true| true| UUID |"87654321-dead-beaf-|"87654321-dead-beaf-| | 0000-deadbeaf0000"| 0000-deadbeaf0000"| ``` NOT EQUAL FORMAT: ``` Types/Values | Yugabyte | Cassandra | ------------------------------------------------------------------ TIMESTAMP |2018-02-14T12:24:56.|2018-02-14 12:24:56.| | 987000+0000| 987Z| MAP | {"1":2,"2":3}| {"1": 2, "2": 3}| SET, LIST | [4,5,6]| [4, 5, 6]| UDT | NOT SUPPORTED| {"v1": 1, "v2": 2}| FROZEN<type> | NOT SUPPORTED| same as <type>| ``` Reviewers: neil, alex Reviewed By: alex Subscribers: kannan, eng Differential Revision: https://phabricator.dev.yugabyte.com/D6751
|
Hi, I'm getting the following error when I try to access ybdb cassandra API with Jetbrains DataGrip tool. It is able to connect but not get any data.
Could this be related ?
Originally posted by @hreidar in #778 (comment)
The text was updated successfully, but these errors were encountered: