Skip to content

Conversation

@BaymaxHWY
Copy link
Contributor

Which issue does this PR close?

Closes #2857

Rationale for this change

What changes are included in this PR?

  1. add information_schema.views
  2. remove definition from information_schema.tables
  3. update SHOW CREATE TABLE

Are there any user-facing changes?

@github-actions github-actions bot added core Core DataFusion crate sql SQL Planner labels Jul 17, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #2934 (f15875e) into master (9401d6d) will increase coverage by 0.04%.
The diff coverage is 94.00%.

@@            Coverage Diff             @@
##           master    #2934      +/-   ##
==========================================
+ Coverage   85.29%   85.34%   +0.04%     
==========================================
  Files         274      273       -1     
  Lines       49229    49380     +151     
==========================================
+ Hits        41991    42141     +150     
- Misses       7238     7239       +1     
Impacted Files Coverage Δ
datafusion/core/tests/sql/information_schema.rs 98.55% <ø> (ø)
datafusion/sql/src/planner.rs 81.31% <0.00%> (ø)
datafusion/core/src/catalog/information_schema.rs 94.67% <95.91%> (+0.95%) ⬆️
datafusion/expr/src/binary_rule.rs 84.65% <0.00%> (-0.39%) ⬇️
datafusion/expr/src/logical_plan/builder.rs 89.64% <0.00%> (-0.22%) ⬇️
datafusion/optimizer/src/projection_push_down.rs 98.06% <0.00%> (-0.03%) ⬇️
datafusion/core/src/physical_plan/planner.rs 81.04% <0.00%> (-0.02%) ⬇️
datafusion/core/src/config.rs 92.50% <0.00%> (ø)
datafusion/common/src/pyarrow.rs 0.00% <0.00%> (ø)
...usion/core/src/avro_to_arrow/arrow_array_reader.rs 0.00% <0.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9401d6d...f15875e. Read the comment docs.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took it for a spin. Looks great @BaymaxHWY thank you!

Looks like we can even support SHOW VIEWS now (as part of a follow on PR, no ned to add it to this one)

❯ create table foo as select column1 as id from (values ('1'), ('3'), ('2'), ('10'), ('8'));
+----+
| id |
+----+
| 1  |
| 3  |
| 2  |
| 10 |
| 8  |
+----+
5 rows in set. Query took 0.043 seconds.
❯ create view bar as select count(*) from foo;
+-----------------+
| COUNT(UInt8(1)) |
+-----------------+
| 5               |
+-----------------+
1 row in set. Query took 0.017 seconds.
❯ show views;
NotImplemented("SHOW views not implemented. Supported syntax: SHOW <TABLES>")
❯ show tables;
+---------------+--------------------+------------+------------+
| table_catalog | table_schema       | table_name | table_type |
+---------------+--------------------+------------+------------+
| datafusion    | public             | foo        | BASE TABLE |
| datafusion    | public             | bar        | VIEW       |
| datafusion    | information_schema | tables     | VIEW       |
| datafusion    | information_schema | views      | VIEW       |
| datafusion    | information_schema | columns    | VIEW       |
+---------------+--------------------+------------+------------+
5 rows in set. Query took 0.006 seconds.
❯ select * from information_schema.views;
+---------------+--------------+------------+---------------------------------------------+
| table_catalog | table_schema | table_name | definition                                  |
+---------------+--------------+------------+---------------------------------------------+
| datafusion    | public       | foo        |                                             |
| datafusion    | public       | bar        | CREATE VIEW bar AS SELECT count(*) FROM foo |
+---------------+--------------+------------+---------------------------------------------+
2 rows in set. Query took 0.002 seconds.
❯ show create table bar;
+---------------+--------------+------------+---------------------------------------------+
| table_catalog | table_schema | table_name | definition                                  |
+---------------+--------------+------------+---------------------------------------------+
| datafusion    | public       | bar        | CREATE VIEW bar AS SELECT count(*) FROM foo |
+---------------+--------------+------------+---------------------------------------------+
1 row in set. Query took 0.010 seconds.

@alamb alamb merged commit d11e28a into apache:master Jul 20, 2022
@ursabot
Copy link

ursabot commented Jul 20, 2022

Benchmark runs are scheduled for baseline = 136f27f and contender = d11e28a. d11e28a is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate sql SQL Planner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement information_schema.views

4 participants