Skip to content
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

Show security mode in SHOW CREATE VIEW #24297

Conversation

kevintang2022
Copy link
Contributor

@kevintang2022 kevintang2022 commented Dec 23, 2024

Description

T211135818

Currently, show create view does not include the security mode that was used at the time the view was defined.

Motivation and Context

Impact

Test Plan

Manual testing on maven artifact version 0.291-20241230.214957-185 on verifier cluster ftw3_verifier_t10_2

> show create view prism.di.presto_query_statistics_view;

                                                                                     Create View                                                                                    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 CREATE VIEW prism.di.presto_query_statistics_view SECURITY DEFINER AS                                                                                                             
 SELECT                                                                                                                                                                            
   query_id    
> show create view prism.di.presto_query_statistics_view_invoker;

                                  Create View                                  
-------------------------------------------------------------------------------
 CREATE VIEW prism.di.presto_query_statistics_view_invoker SECURITY INVOKER AS 
 (                                                                             
    SELECT *                                                                   
    FROM                                                                       
      presto_query_statistics_view                                             
 )                                                                             
(1 row)

Query 20241230_221014_00007_enmct, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
[Latency: client-side: 471ms, server-side: 360ms] [0 rows, 0B] [0 rows/s, 0B/s]
> show create view prism.di.presto_query_statistics_view_definer;
                                  Create View                                  
-------------------------------------------------------------------------------
 CREATE VIEW prism.di.presto_query_statistics_view_definer SECURITY DEFINER AS 
 (                                                                             
    SELECT *                                                                   
    FROM                                                                       
      presto_query_statistics_view                                             
 )                                                                             
(1 row)

Query 20241230_221046_00008_enmct, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
[Latency: client-side: 0:01, server-side: 497ms] [0 rows, 0B] [0 rows/s, 0B/s]

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* ... :pr:`12345`
* ... :pr:`12345`

Hive Connector Changes
* ... :pr:`12345`
* ... :pr:`12345`

If release note is NOT required, use:

== NO RELEASE NOTE ==

Copy link

linux-foundation-easycla bot commented Dec 23, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: kevintang2022 / name: Kevin Tang (58fe22e)

@@ -1202,7 +1202,7 @@ public void testCreateAlterTable()
public void testCreateDropView()
{
// create table with default format orc
String createViewSql = "CREATE VIEW hive.hive_test.hive_view AS\n" +
String createViewSql = "CREATE VIEW hive.hive_test.hive_view SECURITY DEFINER AS\n" +
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to add extra space after DEFINER

"SELECT *\n" +
"FROM\n" +
" orders", schemaName));
.isEqualTo(format("CREATE VIEW iceberg.\"%s\".view_orders SECURITY %s AS\n" +
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need to add extra space after %s

Copy link
Contributor

Choose a reason for hiding this comment

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

instead can you fix the formatting from the SqlFormatter so that there is only one space before/after.

@rschlussel
Copy link
Contributor

Also, please squash your commits together and improve the commit message title to be more specific e.g. Show security mode in SHOW CREATE VIEW.

@kevintang2022 kevintang2022 changed the title Tangk/show security mode create view Show security mode in SHOW CREATE VIEW Dec 30, 2024
Copy link
Contributor

@rschlussel rschlussel left a comment

Choose a reason for hiding this comment

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

Looks good! squash all the commits together to a single commit, and this is good to go.

Update test

Lint

Typo

Fix tests

Rerun CI

Rerun CI 2

Rerun CI 3

Fix spacing

Fix whitespace

Rerun CI 1
@kevintang2022 kevintang2022 force-pushed the tangk/show-security-mode-create-view branch 2 times, most recently from 3942a1a to 58fe22e Compare January 2, 2025 18:59
@kevintang2022 kevintang2022 marked this pull request as ready for review January 2, 2025 20:03
@rschlussel rschlussel merged commit 942cbbc into prestodb:master Jan 2, 2025
107 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants