hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Sherman (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-17635) Add unit tests to CompactionTxnHandler and use PreparedStatements for queries
Date Thu, 05 Oct 2017 00:13:00 GMT

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

Andrew Sherman commented on HIVE-17635:
---------------------------------------

Thanks [~alangates] for looking at the change

{quote}Why is it better to use PreparedStatements in cases where the query is only executed
once? I buy it if you're preparing them and then storing them in a static cache somewhere,
but since you're preparing them every time you run the query I don't see the advantage.{quote}
On a RDBMS like Oracle the optimization happens at prepare time. The query plan is cached
and is reused then next time the same query is prepared. So there is some small perf advantage
to using PreparedStatement.

{quote}In CompactionTxnHandler, I don't think you want to remove the quoteString calls. Those
are to make it so that table or column names that are a keyword or contain spaces, etc. still
work. I don't think the PreparedStatement solves that.{quote}

I did leave the quoteString calls around table names, I think I only removed the calls around
parameters, which I believe is safe, another benefit of PreparedStatements.

{quote}Why the changes to CompactionTxnHandler but not TxnHandler?{quote}
I had to start somewhere :-)


> Add unit tests to CompactionTxnHandler and use PreparedStatements for queries
> -----------------------------------------------------------------------------
>
>                 Key: HIVE-17635
>                 URL: https://issues.apache.org/jira/browse/HIVE-17635
>             Project: Hive
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Andrew Sherman
>            Assignee: Andrew Sherman
>         Attachments: HIVE-17635.1.patch
>
>
> It is better for jdbc code that runs against the HMS database to use PreparedStatements.
Convert CompactionTxnHandler queries to use PreparedStatement and add tests to TestCompactionTxnHandler
to test these queries, and improve code coverage.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message