-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql: support ordering by JSON (pq: unable to encode table key: *tree.DJSON) #35706
Comments
@rohany @RaduBerinde I think the recent key encoding for arrays will solve this issue? |
No, the key encoding for arrays will just be for arrays -- i think json ordering is a different beast. |
This was on a deprecated project board. It can go in the longer-term backlog. For reference, it's in the top 10 on unimplemented feature by cluster count |
@awoods187 have we heard directly from customers that this is a strongly desired feature? I can't think of a legitimate case where ordering by JSON would be useful or required. Perhaps some ORMs are doing it for reasons. |
one reason i could imagine would be to make the output deterministic in tests |
Currently, cockroachdb#97928 outlines the scheme for JSONB encoding and decoding for forward indexes. However, the PR doesn't enable this feature to our users. This current PR aims to allow forward indexes on JSONB columns. The presence of a lexicographical ordering, as described in cockroachdb#97928, shall now allow primary and secondary indexes on JSONB columns along with the ability to use ORDER BY filter in their queries. Additionally, JSON values consist of decimal numbers and containers, such as Arrays and Objects, which can contain these decimal numbers. In order to preserve the values after the decimal, JSONB columns are now required to be composite in nature. This shall enable such values to be stored in both the key and the value side of a K/V pair in hopes of receiving the exact value. Fixes: cockroachdb#35706 Release note (sql change): This PR adds support for enabling forward indexes and ordering on JSON values. Epic: CRDB-24501
99275: sql: enabling forward indexes and ORDERBY on JSONB columns r=celiala a=Shivs11 Currently, #97928 outlines the scheme for JSONB encoding and decoding for forward indexes. However, the PR doesn't enable this feature to our users. This current PR aims to allow forward indexes on JSONB columns. The presence of a lexicographical ordering, as described in #97928, shall now allow primary and secondary indexes on JSONB columns along with the ability to use `ORDER BY` filter in their queries. Additionally, JSON values consist of decimal numbers and containers, such as Arrays and Objects, which can contain these decimal numbers. In order to preserve the values after the decimal, JSONB columns are now required to be composite in nature. This shall enable such values to be stored in both the key and the value side of a K/V pair in hopes of receiving the exact value. Fixes: #35706 Release note (sql change): This PR adds support for enabling forward indexes and ordering on JSON values. Epic: [CRDB-24501](https://cockroachlabs.atlassian.net/browse/CRDB-24501) 100942: kvserver: add metrics to track snapshot queue size r=kvoli a=miraradeva Previously, we had metrics to track the number of snapshots waiting in the snapshot queue; however, snapshots may be of different sizes, so it is also helpful to track the size of all snapshots in the queue. This change adds the following metrics to track the total size of all snapshots waiting in the queue: range.snapshots.send-queue-bytes range.snapshots.recv-queue-bytes Informs: #85528 Release note (ops change): Added two new metrics, range.snapshots.(send|recv)-queue-bytes, to track the total size of all snapshots waiting in the snapshot queue. 101220: roachtest: prevent shared mutable state across c2c roachtest runs r=benbardin a=msbutler Previously, all `c2c/*` roachtests run with `--count` would provide incomprehensible results because multiple roachtest runs of the same test would override each other's state. Specifically, the latest call of `test_spec.Run()`, would override the `test.Test` harness, and `syncedCluster.Cluster` used by all other tests with the same registration. This patch fixes this problem by moving all fields in `replicationSpec` that are set during test execution (i.e. a `test_spec.Run` call), to a new `replicationDriver` struct. Now, `replicationSpec` gets defined during test registration and is shared across test runs, while `replicationDriver` gets set within a test run. Epic: None Release note: None Co-authored-by: Shivam Saraf <[email protected]> Co-authored-by: Mira Radeva <[email protected]> Co-authored-by: Michael Butler <[email protected]>
Previously, cockroachdb#99275 and cockroachdb#97298 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns. Fixes: cockroachdb#35706
Previously, cockroachdb#99275 and cockroachdb#97298 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns. Fixes: cockroachdb#35706
Previously, cockroachdb#99275 and cockroachdb#97298 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns. Fixes: cockroachdb#35706
Previously, cockroachdb#99275 and cockroachdb#97298 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns. Fixes: cockroachdb#35706
Previously, cockroachdb#99275 and cockroachdb#97928 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Fixes: cockroachdb#35706 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns.
Previously, cockroachdb#99275 and cockroachdb#97928 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Fixes: cockroachdb#35706 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns.
Previously, cockroachdb#99275 and cockroachdb#97928 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Fixes: cockroachdb#35706 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns.
Previously, cockroachdb#99275 and cockroachdb#97928 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: CRDB-24501 Fixes: cockroachdb#35706 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns.
101932: sql: adding version gates for changes related to JSON forward indexes r=fqazi a=Shivs11 Previously, #99275 and #97928 were responsible for laying the foundations of a JSON lexicographical order as well as enabling JSON forward indexes in CRDB. However, these commits did not account for version gates. In a given cluster, all of its nodes are required to be at a certain version number for creating JSON forward indexes as well as for ordering JSON columns. Thus, this PR aims to enable version gates for ensuring all nodes in a given cluster meet this requirement. Epic: [CRDB-24501](https://cockroachlabs.atlassian.net/browse/CRDB-24501) Fixes: #35706 Release note (sql change): This PR adds version gates which requires all nodes in a given cluster to have a minimum binary version number which in turn is required for creating forward indexes on JSON columns and for ordering JSON columns. Co-authored-by: Shivam Saraf <[email protected]>
Currently it's not possible to order a table by a JSON column or create a primary index on a JSON column.
This is because JSON does not have a valid lexicographic ordering.
This is incidentally the issue underlying #24436 and #35260.
for reference, PostgreSQL supports it.
See also #35730
Epic: CRDB-24501
Jira issue: CRDB-4564
The text was updated successfully, but these errors were encountered: