This is an automated email from the ASF dual-hosted git repository. dzamo pushed a commit to branch gh-pages in repository https://gitbox.apache.org/repos/asf/drill.git
commit f5f4d2f52701141b6c6b6c9ef3ef6c6e9683a069 Author: James Turton <[email protected]> AuthorDate: Mon Feb 15 12:02:16 2021 +0200 Fix Drill output formatting in 053-describe.md --- _docs/sql-reference/sql-commands/053-describe.md | 199 ++++++++++++----------- 1 file changed, 103 insertions(+), 96 deletions(-) diff --git a/_docs/sql-reference/sql-commands/053-describe.md b/_docs/sql-reference/sql-commands/053-describe.md index 08162cc..a66b9e8 100644 --- a/_docs/sql-reference/sql-commands/053-describe.md +++ b/_docs/sql-reference/sql-commands/053-describe.md @@ -8,10 +8,11 @@ The DESCRIBE command returns information about columns in a table, view, or sche ## Syntax The DESCRIBE command supports the following syntax: - - DESCRIBE [workspace.]table_name|view_name [column_name] - DESCRIBE SCHEMA|DATABASE <name>[.workspace] - DESCRIBE (query) +```sql +DESCRIBE [workspace.]table_name|view_name [column_name] +DESCRIBE SCHEMA|DATABASE <name>[.workspace] +DESCRIBE (query) +``` @@ -65,99 +66,105 @@ and HBase tables. Complete the following steps to use the DESCRIBE command: - 1. Issue the USE command to switch to a particular schema. - - 0: jdbc:drill:zk=drilldemo:5181> use hive; - |------|----------------------------------| - | ok | summary | - |------|----------------------------------| - | true | Default schema changed to 'hive' | - |------|----------------------------------| - 1 row selected (0.025 seconds) - - 2. Issue the SHOW TABLES command to see the existing tables in the schema. - - 0: jdbc:drill:zk=drilldemo:5181> show tables; - |--------------|------------| - | TABLE_SCHEMA | TABLE_NAME | - |--------------|------------| - | hive.default | orders | - | hive.default | products | - |--------------|------------| - 2 rows selected (0.438 seconds) - - 3. Issue the DESCRIBE command on a table. - - 0: jdbc:drill:zk=drilldemo:5181> describe orders; - |-------------|-----------|-------------| - | COLUMN_NAME | DATA_TYPE | IS_NULLABLE | - |-------------|-----------|-------------| - | order_id | BIGINT | YES | - | month | VARCHAR | YES | - | purchdate | TIMESTAMP | YES | - | cust_id | BIGINT | YES | - | state | VARCHAR | YES | - | prod_id | BIGINT | YES | - | order_total | INTEGER | YES | - |-------------|-----------|-------------| - 7 rows selected (0.64 seconds) - - 4. Issue the DESCRIBE command on a table in another schema from the current schema. - - 0: jdbc:drill:zk=drilldemo:5181> describe hbase.customers; - |-------------|-----------------------|-------------| - | COLUMN_NAME | DATA_TYPE | IS_NULLABLE | - |-------------|-----------------------|-------------| - | row_key | ANY | NO | - | address | (VARCHAR(1), ANY) MAP | NO | - | loyalty | (VARCHAR(1), ANY) MAP | NO | - | personal | (VARCHAR(1), ANY) MAP | NO | - |-------------|-----------------------|-------------| - 4 rows selected (0.671 seconds) - - 5. Issue the DESCRIBE command on a view in another schema from the current schema. - - 0: jdbc:drill:zk=drilldemo:5181> describe dfs.views.customers_vw; - |-------------|-----------|-------------| - | COLUMN_NAME | DATA_TYPE | IS_NULLABLE | - |-------------|-----------|-------------| - | cust_id | BIGINT | NO | - | name | VARCHAR | NO | - | address | VARCHAR | NO | - | gender | VARCHAR | NO | - | age | VARCHAR | NO | - | agg_rev | VARCHAR | NO | - | membership | VARCHAR | NO | - |-------------|-----------|-------------| - 7 rows selected (0.403 seconds) - -6. Issue the DESCRIBE SCHEMA command on `dfs.tmp` (the `dfs` schema and `tmp` workspace configured within the `dfs` schema) from the current schema. - - 0: jdbc:drill:zk=drilldemo:5181> describe schema dfs.tmp; - - { - "type" : "file", - "enabled" : true, - "connection" : "file:///", - "config" : null, - "formats" : { - "psv" : { - "type" : "text", - "extensions" : [ "tbl" ], - "delimiter" : "|" - }, - "csv" : { - "type" : "text", - "extensions" : [ "csv", "bcp" ], - "delimiter" : "," - }, - ... - }, - "location" : "/tmp", - "writable" : true, - "defaultInputFormat" : null - } +1. Issue the USE command to switch to a particular schema. +``` +0: jdbc:drill:zk=drilldemo:5181> use hive; +|------|----------------------------------| +| ok | summary | +|------|----------------------------------| +| true | Default schema changed to 'hive' | +|------|----------------------------------| +1 row selected (0.025 seconds) +``` + +2. Issue the SHOW TABLES command to see the existing tables in the schema. +``` +0: jdbc:drill:zk=drilldemo:5181> show tables; +|--------------|------------| +| TABLE_SCHEMA | TABLE_NAME | +|--------------|------------| +| hive.default | orders | +| hive.default | products | +|--------------|------------| +2 rows selected (0.438 seconds) +``` + +3. Issue the DESCRIBE command on a table. +``` +0: jdbc:drill:zk=drilldemo:5181> describe orders; +|-------------|-----------|-------------| +| COLUMN_NAME | DATA_TYPE | IS_NULLABLE | +|-------------|-----------|-------------| +| order_id | BIGINT | YES | +| month | VARCHAR | YES | +| purchdate | TIMESTAMP | YES | +| cust_id | BIGINT | YES | +| state | VARCHAR | YES | +| prod_id | BIGINT | YES | +| order_total | INTEGER | YES | +|-------------|-----------|-------------| +7 rows selected (0.64 seconds) +``` + +4. Issue the DESCRIBE command on a table in another schema from the current schema. +``` +0: jdbc:drill:zk=drilldemo:5181> describe hbase.customers; +|-------------|-----------------------|-------------| +| COLUMN_NAME | DATA_TYPE | IS_NULLABLE | +|-------------|-----------------------|-------------| +| row_key | ANY | NO | +| address | (VARCHAR(1), ANY) MAP | NO | +| loyalty | (VARCHAR(1), ANY) MAP | NO | +| personal | (VARCHAR(1), ANY) MAP | NO | +|-------------|-----------------------|-------------| +4 rows selected (0.671 seconds) +``` + +5. Issue the DESCRIBE command on a view in another schema from the current schema. +``` +0: jdbc:drill:zk=drilldemo:5181> describe dfs.views.customers_vw; +|-------------|-----------|-------------| +| COLUMN_NAME | DATA_TYPE | IS_NULLABLE | +|-------------|-----------|-------------| +| cust_id | BIGINT | NO | +| name | VARCHAR | NO | +| address | VARCHAR | NO | +| gender | VARCHAR | NO | +| age | VARCHAR | NO | +| agg_rev | VARCHAR | NO | +| membership | VARCHAR | NO | +|-------------|-----------|-------------| +7 rows selected (0.403 seconds) +``` +6. Issue the DESCRIBE SCHEMA command on `dfs.tmp` (the `dfs` schema and `tmp` workspace configured within the `dfs` schema) from the current schema. +``` +0: jdbc:drill:zk=drilldemo:5181> describe schema dfs.tmp; +``` +```json +{ + "type" : "file", + "enabled" : true, + "connection" : "file:///", + "config" : null, + "formats" : { + "psv" : { + "type" : "text", + "extensions" : [ "tbl" ], + "delimiter" : "|" + }, + "csv" : { + "type" : "text", + "extensions" : [ "csv", "bcp" ], + "delimiter" : "," + }, + ... + }, + "location" : "/tmp", + "writable" : true, + "defaultInputFormat" : null +} +```
