[ https://issues.apache.org/jira/browse/HIVE-20977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16732303#comment-16732303 ]
Hive QA commented on HIVE-20977: -------------------------------- | (x) *{color:red}-1 overall{color}* | \\ \\ || Vote || Subsystem || Runtime || Comment || || || || || {color:brown} Prechecks {color} || | {color:green}+1{color} | {color:green} @author {color} | {color:green} 0m 1s{color} | {color:green} The patch does not contain any @author tags. {color} | || || || || {color:brown} master Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 7m 50s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 23s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 6s{color} | {color:green} master passed {color} | | {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue} 1m 3s{color} | {color:blue} standalone-metastore/metastore-server in master has 188 extant Findbugs warnings. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 17s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 26s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 24s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 24s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 6s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} whitespace {color} | {color:green} 0m 0s{color} | {color:green} The patch has no whitespace issues. {color} | | {color:green}+1{color} | {color:green} findbugs {color} | {color:green} 1m 12s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 0m 19s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:red}-1{color} | {color:red} asflicense {color} | {color:red} 0m 12s{color} | {color:red} The patch generated 1 ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 12m 42s{color} | {color:black} {color} | \\ \\ || Subsystem || Report/Notes || | Optional Tests | asflicense javac javadoc findbugs checkstyle compile | | uname | Linux hiveptest-server-upstream 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u1 (2016-09-03) x86_64 GNU/Linux | | Build tool | maven | | Personality | /data/hiveptest/working/yetus_PreCommit-HIVE-Build-15455/dev-support/hive-personality.sh | | git revision | master / 926c1e8 | | Default Java | 1.8.0_111 | | findbugs | v3.0.0 | | asflicense | http://104.198.109.242/logs//PreCommit-HIVE-Build-15455/yetus/patch-asflicense-problems.txt | | modules | C: standalone-metastore/metastore-server U: standalone-metastore/metastore-server | | Console output | http://104.198.109.242/logs//PreCommit-HIVE-Build-15455/yetus.txt | | Powered by | Apache Yetus http://yetus.apache.org | This message was automatically generated. > Lazy evaluate the table object in PreReadTableEvent to improve get_partition > performance > ---------------------------------------------------------------------------------------- > > Key: HIVE-20977 > URL: https://issues.apache.org/jira/browse/HIVE-20977 > Project: Hive > Issue Type: Improvement > Reporter: Karthik Manamcheri > Assignee: Karthik Manamcheri > Priority: Minor > Attachments: HIVE-20977.1.patch, HIVE-20977.2.patch > > > The PreReadTableEvent is generated for non-table operations (such as > get_partitions), but only if there is an event listener attached. However, > this is also not necessary if the event listener is not interested in the > read table event. > For example, the TransactionalValidationListener's onEvent looks like this > {code:java} > @Override > public void onEvent(PreEventContext context) throws MetaException, > NoSuchObjectException, > InvalidOperationException { > switch (context.getEventType()) { > case CREATE_TABLE: > handle((PreCreateTableEvent) context); > break; > case ALTER_TABLE: > handle((PreAlterTableEvent) context); > break; > default: > //no validation required.. > } > }{code} > > Note that for read table events it is a no-op. The problem is that the > get_table is evaluated when creating the PreReadTableEvent finally to be just > ignored! > Look at the code below.. {{getMS().getTable(..)}} is evaluated irrespective > of if the listener uses it or not. > {code:java} > private void fireReadTablePreEvent(String catName, String dbName, String > tblName) > throws MetaException, NoSuchObjectException { > if(preListeners.size() > 0) { > // do this only if there is a pre event listener registered (avoid > unnecessary > // metastore api call) > Table t = getMS().getTable(catName, dbName, tblName); > if (t == null) { > throw new NoSuchObjectException(TableName.getQualified(catName, dbName, > tblName) > + " table not found"); > } > firePreEvent(new PreReadTableEvent(t, this)); > } > } > {code} > This can be improved by using a {{Supplier}} and lazily evaluating the table > when needed (once when the first time it is called, memorized after that). > *Motivation* > Whenever a partition call occurs (get_partition, etc.), we fire the > PreReadTableEvent. This affects performance since it fetches the table even > if it is not being used. This change will improve performance on the > get_partition calls. > -- This message was sent by Atlassian JIRA (v7.6.3#76005)