You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Austin Nobis (Code Review)" <ge...@cloudera.org> on 2019/03/20 20:35:11 UTC

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Austin Nobis has uploaded this change for review. ( http://gerrit.cloudera.org:8080/12817


Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................

IMPALA-8328: Add missing ToSql test cases for authorization statements

ToSql test cases were added for the following authorization
statement classes: ShowRolesStmt, ShowGrantPrincipalStmt,
GrantRevokeRoleStmt, GrantRevokePrivStmt. In addition, the
ShowGrantPrincipalStmt::toSql and GrantRevokeRoleStmt::toSql
statements were found to be incorrect during testing and were
updated to align with the grammar.

Testing:
- Ran all FE tests
- Added new tests to ToSqlTest for the listed statements

Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
---
M fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
M fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
M fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
4 files changed, 109 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/12817/1
-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Nobis <an...@cloudera.com>

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 1:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/2490/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Wed, 20 Mar 2019 21:09:15 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 4: Verified+1


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 4
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Fri, 22 Mar 2019 02:02:07 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................

IMPALA-8328: Add missing ToSql test cases for authorization statements

ToSql test cases were added for the following authorization
statement classes: ShowRolesStmt, ShowGrantPrincipalStmt,
GrantRevokeRoleStmt, GrantRevokePrivStmt. In addition, the
ShowGrantPrincipalStmt::toSql, GrantRevokeRoleStmt::toSql, and
PrivilegeSpec::toSql statements were found to be incorrect during
testing and were updated to align with the grammar.

Testing:
- Ran all FE tests
- Added new tests to ToSqlTest for the listed statements

Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Reviewed-on: http://gerrit.cloudera.org:8080/12817
Reviewed-by: Fredy Wijaya <fw...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
M fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
M fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
4 files changed, 176 insertions(+), 10 deletions(-)

Approvals:
  Fredy Wijaya: Looks good to me, approved
  Impala Public Jenkins: Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 5
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Fredy Wijaya (Code Review)" <ge...@cloudera.org>.
Fredy Wijaya has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 1:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
File fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java@44
PS1, Line 44:     if (isGrantStmt_) {
            :       return String.format("GRANT ROLE %s TO GROUP %s", roleName_, groupName_);
            :     } else {
            :       return String.format("REVOKE ROLE %s FROM GROUP %s", roleName_, groupName_);
            :     }
nit: can be simplified by using ternary operation.


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
File fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java@297
PS1, Line 297:   public TPrivilegeScope getScope_() {
             :     return scope_;
             :   }
             : 
             :   public TableName getTableName_() {
             :     return tableName_;
             :   }
             : 
             :   public HdfsUri getUri_() {
             :     return uri_;
             :   }
             : 
             :   public String getDbName_() {
             :     return dbName_;
             :   }
             : 
             :   public String getServerName_() {
             :     return serverName_;
             :   }
nit: method names should not have _ at the end. Impala code style is to put the methods into a single line if possible.


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
File fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java@93
PS1, Line 93:       switch (privilegeSpec_.getScope_()) {
            :         case SERVER:
            :           break;
            :         case DATABASE:
            :           sb.append(String.format(" %s", privilegeSpec_.getDbName_()));
            :           break;
            :         case TABLE:
            :           sb.append(String.format(" %s", privilegeSpec_.getTableName_()));
            :           break;
            :         case URI:
            :           sb.append(String.format(" '%s'", privilegeSpec_.getUri_()));
            :           break;
            :       }
add default or else the compiler may give a warning.


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
File fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1478
PS1, Line 1478:     try {
              :       catalog_.addRole(testRole);
              :       testToSql(ctx, String.format("GRANT SELECT ON SERVER server1 TO %s", testRole));
              :       testToSql(ctx, String.format("GRANT SELECT ON SERVER TO %s", testRole),
              :           String.format("GRANT SELECT ON SERVER server1 TO %s", testRole));
              :       testToSql(ctx, String.format(
              :           "GRANT ALL ON SERVER server1 TO %s WITH GRANT OPTION", testRole));
              : 
              :       testToSql(ctx, String.format("REVOKE SELECT ON SERVER server1 FROM %s", testRole));
              :       testToSql(ctx, String.format("REVOKE SELECT ON SERVER FROM %s", testRole),
              :           String.format("REVOKE SELECT ON SERVER server1 FROM %s", testRole));
              :       testToSql(ctx, String.format(
              :           "REVOKE GRANT OPTION FOR ALL ON SERVER server1 FROM %s", testRole));
              :     } finally {
              :       catalog_.removeRole(testRole);
              :     }
We can have a better coverage by iterating this code over list of privileges via Privilege.values(). Can we also test all the supported objects, i.e. server, database, table, column, uri?


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1520
PS1, Line 1520:       testToSql(ctx, String.format("SHOW GRANT ROLE %s", testRole));
              :       testToSql(ctx, String.format("SHOW GRANT USER %s", testUser));
              :       testToSql(ctx, String.format("SHOW GRANT ROLE %s ON SERVER", testRole));
              :       testToSql(ctx, String.format("SHOW GRANT ROLE %s ON DATABASE functional",
              :           testRole));
              :       testToSql(ctx, String.format("SHOW GRANT ROLE %s ON TABLE functional.alltypes",
              :           testRole));
              :       testToSql(ctx, String.format("SHOW GRANT ROLE %s ON URI '%s'",
              :           testRole, testUri));
do we support ON COLUMN?



-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 1
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Wed, 20 Mar 2019 21:49:01 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Austin Nobis (Code Review)" <ge...@cloudera.org>.
Austin Nobis has uploaded a new patch set (#2). ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................

IMPALA-8328: Add missing ToSql test cases for authorization statements

ToSql test cases were added for the following authorization
statement classes: ShowRolesStmt, ShowGrantPrincipalStmt,
GrantRevokeRoleStmt, GrantRevokePrivStmt. In addition, the
ShowGrantPrincipalStmt::toSql, GrantRevokeRoleStmt::toSql, and
PrivilegeSpec::toSql statements were found to be incorrect during
testing and were updated to align with the grammar.

Testing:
- Ran all FE tests
- Added new tests to ToSqlTest for the listed statements

Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
---
M fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
M fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
M fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
4 files changed, 175 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/12817/2
-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 2
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Austin Nobis (Code Review)" <ge...@cloudera.org>.
Austin Nobis has uploaded a new patch set (#3). ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................

IMPALA-8328: Add missing ToSql test cases for authorization statements

ToSql test cases were added for the following authorization
statement classes: ShowRolesStmt, ShowGrantPrincipalStmt,
GrantRevokeRoleStmt, GrantRevokePrivStmt. In addition, the
ShowGrantPrincipalStmt::toSql, GrantRevokeRoleStmt::toSql, and
PrivilegeSpec::toSql statements were found to be incorrect during
testing and were updated to align with the grammar.

Testing:
- Ran all FE tests
- Added new tests to ToSqlTest for the listed statements

Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
---
M fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
M fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
M fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
4 files changed, 176 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/12817/3
-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 3
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 2:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/2499/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 2
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 13:53:54 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Fredy Wijaya (Code Review)" <ge...@cloudera.org>.
Fredy Wijaya has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 4: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 4
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 21:20:42 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Austin Nobis (Code Review)" <ge...@cloudera.org>.
Austin Nobis has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 3:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/12817/2/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
File fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java:

http://gerrit.cloudera.org:8080/#/c/12817/2/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1529
PS2, Line 1529:       }
> line too long (91 > 90)
Done



-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 3
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 13:26:34 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 4:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/2507/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 4
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 20:38:51 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Austin Nobis (Code Review)" <ge...@cloudera.org>.
Austin Nobis has uploaded a new patch set (#4). ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................

IMPALA-8328: Add missing ToSql test cases for authorization statements

ToSql test cases were added for the following authorization
statement classes: ShowRolesStmt, ShowGrantPrincipalStmt,
GrantRevokeRoleStmt, GrantRevokePrivStmt. In addition, the
ShowGrantPrincipalStmt::toSql, GrantRevokeRoleStmt::toSql, and
PrivilegeSpec::toSql statements were found to be incorrect during
testing and were updated to align with the grammar.

Testing:
- Ran all FE tests
- Added new tests to ToSqlTest for the listed statements

Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
---
M fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
M fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
M fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
M fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
4 files changed, 176 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/17/12817/4
-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 4
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Austin Nobis (Code Review)" <ge...@cloudera.org>.
Austin Nobis has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 2:

(5 comments)

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java
File fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/GrantRevokeRoleStmt.java@44
PS1, Line 44:     return String.format("%s ROLE %s %s GROUP %s",
            :         isGrantStmt_ ? "GRANT" : "REVOKE", roleName_,
            :         isGrantStmt_ ? "TO" : "FROM", groupName_);
            :   }
            : 
> nit: can be simplified by using ternary operation.
Done


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java
File fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/PrivilegeSpec.java@297
PS1, Line 297:   }
             : 
             :   public TPrivilegeScope getScope() { return scope_; }
             : 
             :   public TableName getTableName() { return tableName_; }
             : 
             :   public HdfsUri getUri() { return uri_; }
             : 
             :   public String getDbName() { return dbName_; }
             : 
             :   public String getServerName() { return serverName_; }
             : }
             : 
             : 
             : 
             : 
             : 
             : 
             : 
> nit: method names should not have _ at the end. Impala code style is to put
Done


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java
File fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/main/java/org/apache/impala/analysis/ShowGrantPrincipalStmt.java@93
PS1, Line 93:       switch (privilegeSpec_.getScope()) {
            :         case SERVER:
            :           break;
            :         case DATABASE:
            :           sb.append(String.format(" %s", privilegeSpec_.getDbName()));
            :           break;
            :         case TABLE:
            :           sb.append(String.format(" %s", privilegeSpec_.getTableName()));
            :           break;
            :         case URI:
            :           sb.append(String.format(" '%s'", privilegeSpec_.getUri()));
            :           break;
            :        
> add default or else the compiler may give a warning.
Done


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
File fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java:

http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1478
PS1, Line 1478:   @Test
              :   public void testGrantRevokePrivStmt() {
              :     AnalysisContext ctx = createAnalysisCtx(createAuthorizationConfig());
              :     String testRole = "test_role";
              :     String testUri = "hdfs://localhost:20500/test-warehouse";
              : 
              :     try {
              :       catalog_.addRole(testRole);
              :       List<Privilege> privileges = Arrays.stream(Privilege.values())
              :           .filter(p -> p != Privilege.OWNER &&
              :               p != Privilege.VIEW_METADATA &&
              :               p != Privilege.ANY)
              :           .collect(Collectors.toList());
              : 
              :       for (Privilege p : privileges) {
              :      
> We can have a better coverage by iterating this code over list of privilege
Done


http://gerrit.cloudera.org:8080/#/c/12817/1/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1520
PS1, Line 1520:               p != Privilege.VIEW_METADATA &&
              :               p != Privilege.ANY)
              :           .collect(Collectors.toList());
              : 
              :       for (Privilege p : privileges) {
              :         // Table
              :         testToSql(ctx, String.format("GRANT %s ON TABLE functional.alltypes TO %s",
              :             p, testRole));
              :         testToSql(ctx, String.
> do we support ON COLUMN?
Checking the grammar in the .cup file I see support for the following Privilege Specifications:

- null (not sure how this works)
- ALL on SERVER
- ALL on DATABASE
- ALL on TABLE
- ALL on HdfsUri



-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 2
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 13:12:58 +0000
Gerrit-HasComments: Yes

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 4:

Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/3941/ DRY_RUN=false


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 4
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 21:23:56 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 3:

Build Successful 

https://jenkins.impala.io/job/gerrit-code-review-checks/2500/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.


-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 3
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 14:09:19 +0000
Gerrit-HasComments: No

[Impala-ASF-CR] IMPALA-8328: Add missing ToSql test cases for authorization statements

Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/12817 )

Change subject: IMPALA-8328: Add missing ToSql test cases for authorization statements
......................................................................


Patch Set 2:

(1 comment)

http://gerrit.cloudera.org:8080/#/c/12817/2/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java
File fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java:

http://gerrit.cloudera.org:8080/#/c/12817/2/fe/src/test/java/org/apache/impala/analysis/ToSqlTest.java@1529
PS2, Line 1529:             "GRANT %s ON TABLE functional.alltypes TO %s WITH GRANT OPTION", p, testRole));
line too long (91 > 90)



-- 
To view, visit http://gerrit.cloudera.org:8080/12817
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I828d0459b6c92f7f15006e2353ce108093aa9dab
Gerrit-Change-Number: 12817
Gerrit-PatchSet: 2
Gerrit-Owner: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Austin Nobis <an...@cloudera.com>
Gerrit-Reviewer: Fredy Wijaya <fw...@cloudera.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Thu, 21 Mar 2019 13:13:45 +0000
Gerrit-HasComments: Yes