Fredy Wijaya has posted comments on this change. ( http://gerrit.cloudera.org:8080/10850 )
Change subject: IMPALA-6086: Use of permanent function should require SELECT privilege on DB ...................................................................... Patch Set 1: (1 comment) http://gerrit.cloudera.org:8080/#/c/10850/1/fe/src/test/java/org/apache/impala/analysis/AuthorizationStmtTest.java File fe/src/test/java/org/apache/impala/analysis/AuthorizationStmtTest.java: http://gerrit.cloudera.org:8080/#/c/10850/1/fe/src/test/java/org/apache/impala/analysis/AuthorizationStmtTest.java@2071 PS1, Line 2071: authorize("create function to_lower(string) returns string location " + As mentioned in the previous review, this code doesn't create a function in the catalog. You can create a helper function like below. private ScalarFunction addFunction(String db, String fnName, ArrayList<Type> argTypes, Type retType, String uriPath, String symbolName) { ScalarFunction fn = ScalarFunction.createForTesting(db, fnName, argTypes, retType, uriPath, symbolName, null, null, TFunctionBinaryType.NATIVE); authzCatalog_.addFunction(fn); return fn; } You can then use the new addFunction to create a function in the catalog. fn = addFunction("functional", "to_lower", ....); try { TQueryOptions options = new TQueryOptions(); options.setEnable_expr_rewrites(true); for (AuthzTest test: new AuthzTest[]{ authorize("select to_lower('ABCDEF')"), // SQL rewrite enabled. authorize(createAnalysisContext(options), "select to_lower('ABCDEF')")}) { test.ok(...) .error(...); } } finally { removeFunction(fn); } You can chain bunch of ok() and error() methods to test on different level of hierarchies, i.e. server, database and table. See other test cases as a reference. -- To view, visit http://gerrit.cloudera.org:8080/10850 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Iee70f15e4c04f7daaed9cac2400ec626e1fb0e57 Gerrit-Change-Number: 10850 Gerrit-PatchSet: 1 Gerrit-Owner: Zoram Thanga <[email protected]> Gerrit-Reviewer: Fredy Wijaya <[email protected]> Gerrit-Reviewer: Vuk Ercegovac <[email protected]> Gerrit-Comment-Date: Mon, 02 Jul 2018 21:16:24 +0000 Gerrit-HasComments: Yes
