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

Vihang Karajgaonkar commented on HIVE-16771:
--------------------------------------------

Thanks for the review [~ngangam] My comments inline below.
bq. 1) However, it seems a bit odd to have it take a boolean to determine if 
the query needs quotes or not. Can the implementation detect it without a whole 
lot of code duplication? The impl should be able to determine the DBTYPE just 
as easily.
In order to fetch schema version from DB without providing the connection 
object, it will need to create its own connection. The information needed and 
the utility class {{HiveSchemaHelper}} is in the BeeLine module and cannot be 
used in Metastore module.
bq. 2) The connection and the statement are not closed. This is will certainly 
cause a memory leak and a potentially a connection leak to the DB.
This is just a refactor of the existing code so the connection leak possbility 
was pre-existing. Let me update the patch to fix it.
bq. 3) Same with the need to have an active SQL connection passed in. But then 
is there a better means to do this?
We can either pass the username, password, url, driver to the class to make its 
own connection or just pass the row information from the Version table. Let me 
know if you have any better ideas.
bq. 4) Ideally, the HMS schema version should only be fetched from DB just 
once. This implementation fetches it every time. Are there scenarios where the 
value would be changed after initialization that makes it necessary every time?
HiveSchemaTool calls it multiple times eg. before upgrade and after upgrade to 
validate if the schema is correct after the update. Not sure if we can cache 
this information due to this reason.

> Schematool should use MetastoreSchemaInfo to get the metastore schema version 
> from database
> -------------------------------------------------------------------------------------------
>
>                 Key: HIVE-16771
>                 URL: https://issues.apache.org/jira/browse/HIVE-16771
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Vihang Karajgaonkar
>            Assignee: Vihang Karajgaonkar
>            Priority: Minor
>         Attachments: HIVE-16771.01.patch
>
>
> HIVE-16723 gives the ability to have a custom MetastoreSchemaInfo 
> implementation to manage schema upgrades and initialization if needed. In 
> order to make HiveSchemaTool completely agnostic it should depend on 
> IMetastoreSchemaInfo implementation which is configured to get the metastore 
> schema version information from the database. It should also not assume the 
> scripts directory and hardcode it itself. It would rather ask 
> MetastoreSchemaInfo class to get the metastore scripts directory.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to