[ 
https://issues.apache.org/jira/browse/RANGER-5487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18123681#comment-18123681
 ] 

Aleksander Nek commented on RANGER-5487:
----------------------------------------

h2. [GitHub Pull Request #1280|https://github.com/apache/ranger/pull/1280]
h2. What changes were proposed in this pull request?

Use JDBC metadata for Hive database and table resource lookup instead of 
{{{}SHOW DATABASES/TABLES LIKE{}}}. Translate Ranger {{*}} and {{?}} patterns 
to JDBC {{%}} and {{{}_{}}}, then apply the original Ranger wildcard locally to 
preserve literal characters such as {{_}} in resource names. This lets 
connection testing and resource lookup use the same path with Hive 3.1.3 and 
Hive 4.0.1. The Hive Metastore API path and column lookup are unchanged.
h2. How was this patch tested?

{{mvn -pl hive-agent -am 
-Dtest=TestHiveClientDatabaseLookup,TestAllHiveOperationInRanger 
-Dsurefire.failIfNoSpecifiedTests=false test}} on JDK 11: 4 tests passed. The 
new tests cover connection test pattern {{{}*{}}}, database and table prefix 
lookup, exclusions, and literal {{_}} filtering.

Live JDBC checks against HiveServer2 3.1.3 and 4.0.1 confirmed 
{{DatabaseMetaData.getSchemas()}} and {{getTables()}} return the expected 
databases and tables with {{%}} patterns. Hive 4.0.1 returned no rows for the 
old {{SHOW DATABASES LIKE '*'}} and {{SHOW TABLES LIKE 'test*'}} queries, while 
the metadata calls returned the resources.

> Ranger Hive service functionality, including connection testing and resource 
> search functionality.
> --------------------------------------------------------------------------------------------------
>
>                 Key: RANGER-5487
>                 URL: https://issues.apache.org/jira/browse/RANGER-5487
>             Project: Ranger
>          Issue Type: Bug
>          Components: Ranger
>    Affects Versions: 2.6.0, 2.7.0, 2.8.0, 2.9.0
>            Reporter: Aleksander Nek
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Validate ranger hive service test connection and resourcelookup functionality 
> as well
> Hive     4.0.1
> Ranger     2.6.0
> These versions should be compatible according to Bigtop 3.4.0
> [https://cwiki.apache.org/confluence/display/BIGTOP/Bigtop+3.4.0+Release]
> But I see this in the logs in hive-server2.err logs:
>  
> {noformat}
> POSTHOOK: type: SHOWDATABASES
> POSTHOOK: query: show databases like "*"{noformat}
>  
> There is a mention in the Hive document  
> ([https://hive.apache.org/docs/latest/language/languagemanual-ddl/#show-databases])
> {panel:title=Show Databases}
> SHOW (DATABASES|SCHEMAS) [LIKE 'identifier_with_wildcards'];
> SHOW DATABASES or SHOW SCHEMAS lists all of the databases defined in the 
> metastore. The uses of SCHEMAS and DATABASES are interchangeable – they mean 
> the same thing.
> The optional LIKE clause allows the list of databases to be filtered using a 
> regular expression. Wildcards in the regular expression can only be ‘’ for 
> any character(s) or ‘|’ for a choice. Examples are ’employees’, ’emp’, 
> ’emp*|*ees’, all of which will match the database named ’employees’.
> Version information: SHOW DATABASES
> *Starting from 4.0.0 we accept only SQL type like expressions containing ‘%’ 
> for any character(s), and ‘_’ for a single character. Examples are 
> ’employees’, ’emp%’, ’emplo_ees’, all of which will match the database named 
> ’employees’.*
> {panel}
>  
> Checked the functionality of the Ranger Hive service, as well as the 
> functionality of checking the connection and searching for resources?
> https://issues.apache.org/jira/browse/RANGER-4952?focusedCommentId=17894106&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17894106



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to