[ https://issues.apache.org/jira/browse/HIVE-19046?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16522508#comment-16522508 ]
Hive QA commented on HIVE-19046: -------------------------------- | (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 0s{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} 8m 54s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 49s{color} | {color:green} master passed {color} | | {color:green}+1{color} | {color:green} checkstyle {color} | {color:green} 0m 23s{color} | {color:green} master passed {color} | | {color:blue}0{color} | {color:blue} findbugs {color} | {color:blue} 3m 35s{color} | {color:blue} standalone-metastore in master has 228 extant Findbugs warnings. {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 4s{color} | {color:green} master passed {color} | || || || || {color:brown} Patch Compile Tests {color} || | {color:green}+1{color} | {color:green} mvninstall {color} | {color:green} 0m 59s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} compile {color} | {color:green} 0m 48s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javac {color} | {color:green} 0m 48s{color} | {color:green} the patch passed {color} | | {color:red}-1{color} | {color:red} checkstyle {color} | {color:red} 0m 24s{color} | {color:red} standalone-metastore: The patch generated 2 new + 382 unchanged - 1 fixed = 384 total (was 383) {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} 3m 48s{color} | {color:green} the patch passed {color} | | {color:green}+1{color} | {color:green} javadoc {color} | {color:green} 1m 6s{color} | {color:green} the patch passed {color} | || || || || {color:brown} Other Tests {color} || | {color:green}+1{color} | {color:green} asflicense {color} | {color:green} 0m 14s{color} | {color:green} The patch does not generate ASF License warnings. {color} | | {color:black}{color} | {color:black} {color} | {color:black} 22m 28s{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-12100/dev-support/hive-personality.sh | | git revision | master / 33088de | | Default Java | 1.8.0_111 | | findbugs | v3.0.0 | | checkstyle | http://104.198.109.242/logs//PreCommit-HIVE-Build-12100/yetus/diff-checkstyle-standalone-metastore.txt | | modules | C: standalone-metastore U: standalone-metastore | | Console output | http://104.198.109.242/logs//PreCommit-HIVE-Build-12100/yetus.txt | | Powered by | Apache Yetus http://yetus.apache.org | This message was automatically generated. > Refactor the common parts of the HiveMetastore add_partition_core and > add_partitions_pspec_core methods > ------------------------------------------------------------------------------------------------------- > > Key: HIVE-19046 > URL: https://issues.apache.org/jira/browse/HIVE-19046 > Project: Hive > Issue Type: Improvement > Components: Metastore > Reporter: Marta Kuczora > Assignee: Marta Kuczora > Priority: Minor > Attachments: HIVE-19046.1.patch, HIVE-19046.2.patch, > HIVE-19046.3.patch, HIVE-19046.4.patch, HIVE-19046.5.patch, > HIVE-19046.6.patch, HIVE-19046.7.patch > > > This is a follow-up Jira of the > [HIVE-18696|https://issues.apache.org/jira/browse/HIVE-18696] > [review|https://reviews.apache.org/r/65716/]. > The biggest part of these methods use the same code. It would make sense to > move this code part to a common method. > This code is almost the same in the two methods: > {code} > List<Future<Partition>> partFutures = Lists.newArrayList(); > final Table table = tbl; > for (final Partition part : parts) { > if (!part.getTableName().equals(tblName) || > !part.getDbName().equals(dbName)) { > throw new MetaException("Partition does not belong to target > table " > + dbName + "." + tblName + ": " + part); > } > boolean shouldAdd = startAddPartition(ms, part, ifNotExists); > if (!shouldAdd) { > existingParts.add(part); > LOG.info("Not adding partition " + part + " as it already > exists"); > continue; > } > final UserGroupInformation ugi; > try { > ugi = UserGroupInformation.getCurrentUser(); > } catch (IOException e) { > throw new RuntimeException(e); > } > partFutures.add(threadPool.submit(new Callable<Partition>() { > @Override > public Partition call() throws Exception { > ugi.doAs(new PrivilegedExceptionAction<Object>() { > @Override > public Object run() throws Exception { > try { > boolean madeDir = createLocationForAddedPartition(table, > part); > if (addedPartitions.put(new PartValEqWrapper(part), > madeDir) != null) { > // Technically, for ifNotExists case, we could insert > one and discard the other > // because the first one now "exists", but it seems > better to report the problem > // upstream as such a command doesn't make sense. > throw new MetaException("Duplicate partitions in the > list: " + part); > } > initializeAddedPartition(table, part, madeDir); > } catch (MetaException e) { > throw new IOException(e.getMessage(), e); > } > return null; > } > }); > return part; > } > })); > } > try { > for (Future<Partition> partFuture : partFutures) { > Partition part = partFuture.get(); > if (part != null) { > newParts.add(part); > } > } > } catch (InterruptedException | ExecutionException e) { > // cancel other tasks > for (Future<Partition> partFuture : partFutures) { > partFuture.cancel(true); > } > throw new MetaException(e.getMessage()); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)