Skip to content

Commit

Permalink
Add documentation for SHOW FUNCTIONS (#13868)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored Dec 21, 2024
1 parent 8c48a8c commit 2639fe0
Showing 1 changed file with 53 additions and 3 deletions.
56 changes: 53 additions & 3 deletions docs/source/user-guide/sql/information_schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
DataFusion supports showing metadata about the tables and views available. This information can be accessed using the
views of the ISO SQL `information_schema` schema or the DataFusion specific `SHOW TABLES` and `SHOW COLUMNS` commands.

To show tables in the DataFusion catalog, use the `SHOW TABLES` command or the `information_schema.tables` view:
## `SHOW TABLES`

To show tables in the DataFusion catalog, use the `SHOW TABLES` command or the
`information_schema.tables` view:

```sql
> show tables;
Expand All @@ -39,7 +42,10 @@ or

```

To show the schema of a table in DataFusion, use the `SHOW COLUMNS` command or the `information_schema.columns` view:
## `SHOW COLUMNS`

To show the schema of a table in DataFusion, use the `SHOW COLUMNS` command or
the `information_schema.columns` view.

```sql
> show columns from t;
Expand All @@ -52,7 +58,10 @@ or
+---------------+--------------+------------+-------------+-----------+-------------+
```

To show the current session configuration options, use the `SHOW ALL` command or the `information_schema.df_settings` view:
## `SHOW ALL` (configuration options)

To show the current session configuration options, use the `SHOW ALL` command or
the `information_schema.df_settings` view:

```sql
select * from information_schema.df_settings;
Expand All @@ -65,7 +74,48 @@ select * from information_schema.df_settings;
| datafusion.execution.time_zone | UTC |
| datafusion.explain.logical_plan_only | false |
| datafusion.explain.physical_plan_only | false |
...
| datafusion.optimizer.filter_null_join_keys | false |
| datafusion.optimizer.skip_failed_rules | true |
+-------------------------------------------------+---------+
```

## `SHOW FUNCTIONS`

To show the list of functions available, use the `SHOW FUNCTIONS` command or the

- `information_schema.information_schema.routines` view: functions and descriptions
- `information_schema.information_schema.parameters` view: parameters and descriptions

Syntax:

```sql
SHOW FUNCTIONS [ LIKE <pattern> ];
```

Example output

```sql
> show functions like '%datetrunc';
+---------------+-------------------------------------+-------------------------+-------------------------------------------------+---------------+-------------------------------------------------------+-----------------------------------+
| function_name | return_type | parameters | parameter_types | function_type | description | syntax_example |
+---------------+-------------------------------------+-------------------------+-------------------------------------------------+---------------+-------------------------------------------------------+-----------------------------------+
| datetrunc | Timestamp(Microsecond, Some("+TZ")) | [precision, expression] | [Utf8, Timestamp(Microsecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Nanosecond, None) | [precision, expression] | [Utf8View, Timestamp(Nanosecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Second, Some("+TZ")) | [precision, expression] | [Utf8View, Timestamp(Second, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Microsecond, None) | [precision, expression] | [Utf8View, Timestamp(Microsecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Second, None) | [precision, expression] | [Utf8View, Timestamp(Second, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Microsecond, None) | [precision, expression] | [Utf8, Timestamp(Microsecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Second, None) | [precision, expression] | [Utf8, Timestamp(Second, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Microsecond, Some("+TZ")) | [precision, expression] | [Utf8View, Timestamp(Microsecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Nanosecond, Some("+TZ")) | [precision, expression] | [Utf8, Timestamp(Nanosecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Millisecond, None) | [precision, expression] | [Utf8, Timestamp(Millisecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Millisecond, Some("+TZ")) | [precision, expression] | [Utf8, Timestamp(Millisecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Second, Some("+TZ")) | [precision, expression] | [Utf8, Timestamp(Second, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Nanosecond, None) | [precision, expression] | [Utf8, Timestamp(Nanosecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Millisecond, None) | [precision, expression] | [Utf8View, Timestamp(Millisecond, None)] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Millisecond, Some("+TZ")) | [precision, expression] | [Utf8View, Timestamp(Millisecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
| datetrunc | Timestamp(Nanosecond, Some("+TZ")) | [precision, expression] | [Utf8View, Timestamp(Nanosecond, Some("+TZ"))] | SCALAR | Truncates a timestamp value to a specified precision. | date_trunc(precision, expression) |
+---------------+-------------------------------------+-------------------------+-------------------------------------------------+---------------+-------------------------------------------------------+-----------------------------------+
16 row(s) fetched.
```

0 comments on commit 2639fe0

Please sign in to comment.