Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4DC0F181C6 for ; Mon, 14 Sep 2015 08:22:32 +0000 (UTC) Received: (qmail 93666 invoked by uid 500); 14 Sep 2015 08:22:24 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 93567 invoked by uid 500); 14 Sep 2015 08:22:24 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 92701 invoked by uid 99); 14 Sep 2015 08:22:24 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2015 08:22:24 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2A615E0282; Mon, 14 Sep 2015 08:22:24 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: prasanthj@apache.org To: commits@hive.apache.org Date: Mon, 14 Sep 2015 08:22:29 -0000 Message-Id: <67490bb38f414e1f93ee0d1fe6376a3e@git.apache.org> In-Reply-To: <2f5cd33dc39d4766ac55a0a8a4295db3@git.apache.org> References: <2f5cd33dc39d4766ac55a0a8a4295db3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [06/24] hive git commit: HIVE-11510 : Metatool updateLocation warning on views (Wei Zheng via Sushanth Sowmyan) HIVE-11510 : Metatool updateLocation warning on views (Wei Zheng via Sushanth Sowmyan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/27bf8f0f Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/27bf8f0f Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/27bf8f0f Branch: refs/heads/llap Commit: 27bf8f0f70af198ce2c5d939046ca61ab7414585 Parents: b4be31f Author: Sushanth Sowmyan Authored: Thu Sep 10 12:01:38 2015 -0700 Committer: Sushanth Sowmyan Committed: Thu Sep 10 12:14:57 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hive/metastore/ObjectStore.java | 19 +++++++++++++++++-- .../hive/metastore/tools/HiveMetaTool.java | 5 +++++ 2 files changed, 22 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/27bf8f0f/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java ---------------------------------------------------------------------- diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java index d165fc8..4d6bfcc 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -5930,11 +5930,13 @@ public class ObjectStore implements RawStore, Configurable { public class UpdateMStorageDescriptorTblURIRetVal { private List badRecords; private Map updateLocations; + private int numNullRecords; UpdateMStorageDescriptorTblURIRetVal(List badRecords, - Map updateLocations) { + Map updateLocations, int numNullRecords) { this.badRecords = badRecords; this.updateLocations = updateLocations; + this.numNullRecords = numNullRecords; } public List getBadRecords() { @@ -5952,6 +5954,14 @@ public class ObjectStore implements RawStore, Configurable { public void setUpdateLocations(Map updateLocations) { this.updateLocations = updateLocations; } + + public int getNumNullRecords() { + return numNullRecords; + } + + public void setNumNullRecords(int numNullRecords) { + this.numNullRecords = numNullRecords; + } } /** The following APIs @@ -5967,6 +5977,7 @@ public class ObjectStore implements RawStore, Configurable { Query query = null; Map updateLocations = new HashMap(); List badRecords = new ArrayList(); + int numNullRecords = 0; UpdateMStorageDescriptorTblURIRetVal retVal = null; try { openTransaction(); @@ -5976,6 +5987,10 @@ public class ObjectStore implements RawStore, Configurable { for (MStorageDescriptor mSDS : mSDSs) { URI locationURI = null; String location = mSDS.getLocation(); + if (location == null) { // This can happen for View or Index + numNullRecords++; + continue; + } try { locationURI = new Path(location).toUri(); } catch (IllegalArgumentException e) { @@ -5995,7 +6010,7 @@ public class ObjectStore implements RawStore, Configurable { } committed = commitTransaction(); if (committed) { - retVal = new UpdateMStorageDescriptorTblURIRetVal(badRecords, updateLocations); + retVal = new UpdateMStorageDescriptorTblURIRetVal(badRecords, updateLocations, numNullRecords); } return retVal; } finally { http://git-wip-us.apache.org/repos/asf/hive/blob/27bf8f0f/metastore/src/java/org/apache/hadoop/hive/metastore/tools/HiveMetaTool.java ---------------------------------------------------------------------- diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/tools/HiveMetaTool.java b/metastore/src/java/org/apache/hadoop/hive/metastore/tools/HiveMetaTool.java index 411ac21..e4e9e3a 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/tools/HiveMetaTool.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/tools/HiveMetaTool.java @@ -222,6 +222,11 @@ public class HiveMetaTool { System.err.println("bad location URI: " + badRecord); } } + int numNullRecords = retVal.getNumNullRecords(); + if (numNullRecords != 0) { + LOG.debug("Number of NULL location URI: " + numNullRecords + + ". This can happen for View or Index."); + } } }