Skip to content

sql: make SPLIT AT output be consistent with SHOW EXPERIMENTAL_RANGES #24740

@rmloveland

Description

@rmloveland

This is a feature request.

On version 2.0.0, the pretty-printed key output format differs between SHOW TESTING_RANGES and SPLIT AT as shown below.

This is a bit confusing when you are trying to learn the key output format so you can understand what is happening under the hood when you execute these statements.

The feature request is for SPLIT AT to use the same "short form" as SHOW TESTING_RANGES to make it easier to visually compare the outputs.

(The table t below is taken from the SQL tests for the SHOW TESTING_RANGES PR.)


    > SELECT version();
    +-----------------------------------------------------------------------------------+
    |                                      version                                      |
    +-----------------------------------------------------------------------------------+
    | CockroachDB CCL v2.0.0 (x86_64-apple-darwin13, built 2018/04/03 20:52:33, go1.10) |
    +-----------------------------------------------------------------------------------+
    (1 row)

    > SHOW CREATE TABLE t;
    +-------+------------------------------------------------------------+
    | Table |                        CreateTable                         |
    +-------+------------------------------------------------------------+
    | t     | CREATE TABLE t (                                          +|
    |       |         k1 INT NOT NULL,                                  +|
    |       |         k2 INT NOT NULL,                                  +|
    |       |         v INT NULL,                                       +|
    |       |         w INT NULL,                                       +|
    |       |         CONSTRAINT "primary" PRIMARY KEY (k1 ASC, k2 ASC),+|
    |       |         INDEX idx (v ASC, w ASC),                         +|
    |       |         FAMILY "primary" (k1, k2, v, w)                   +|
    |       | )                                                          |
    +-------+------------------------------------------------------------+
    (1 row)

    > ALTER TABLE t SPLIT AT VALUES (1), (10);
    +----------+----------------+
    |   key    |     pretty     |
    +----------+----------------+
    | \xbc8989 | /Table/52/1/1  |
    | \xbc8992 | /Table/52/1/10 |
    +----------+----------------+
    (2 rows)

    root=> SHOW TESTING_RANGES FROM TABLE t;
    +-----------+---------+----------+----------+--------------+
    | Start Key | End Key | Range ID | Replicas | Lease Holder |
    +-----------+---------+----------+----------+--------------+
    |           | /1      |       33 | {1,3,4}  |            3 |
    | /1        | /10     |       34 | {1,3,5}  |            3 |
    | /10       |         |       35 | {1,3,5}  |            3 |
    +-----------+---------+----------+----------+--------------+
    (3 rows)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-sql-executionRelating to SQL execution.C-enhancementSolution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)E-easyEasy issue to tackle, requires little or no CockroachDB experienceS-3-ux-surpriseIssue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.good first issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions