Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9E4E2200B84 for ; Tue, 20 Sep 2016 23:41:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9CE0C160AC5; Tue, 20 Sep 2016 21:41:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E31A7160AC0 for ; Tue, 20 Sep 2016 23:41:35 +0200 (CEST) Received: (qmail 90014 invoked by uid 500); 20 Sep 2016 21:41:30 -0000 Mailing-List: contact dev-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list dev@drill.apache.org Received: (qmail 90002 invoked by uid 99); 20 Sep 2016 21:41:29 -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; Tue, 20 Sep 2016 21:41:29 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AA4F3E0252; Tue, 20 Sep 2016 21:41:29 +0000 (UTC) From: parthchandra To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #592: DRILL-4826: Query against INFORMATION_SCHEMA.TABLES... Content-Type: text/plain Message-Id: <20160920214129.AA4F3E0252@git1-us-west.apache.org> Date: Tue, 20 Sep 2016 21:41:29 +0000 (UTC) archived-at: Tue, 20 Sep 2016 21:41:36 -0000 Github user parthchandra commented on a diff in the pull request: https://github.com/apache/drill/pull/592#discussion_r79719219 --- Diff: contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/schema/HiveDatabaseSchema.java --- @@ -78,17 +79,34 @@ public String getTypeName() { } @Override - public List> getTablesByNamesByBulkLoad(final List tableNames) { + public List> getTablesByNamesByBulkLoad(final List tableNames, final int bulkSize) { + final int totalTables = tableNames.size(); final String schemaName = getName(); - final List> tableNameToTable = Lists.newArrayList(); - List tables; - try { - tables = DrillHiveMetaStoreClient.getTableObjectsByNameHelper(mClient, schemaName, tableNames); - } catch (TException e) { - logger.warn("Exception occurred while trying to list tables by names from {}: {}", schemaName, e.getCause()); - return tableNameToTable; + final List tables = Lists.newArrayList(); + + // In each round, Drill asks for a sub-list of all the requested tables + for(int fromIndex = 0; fromIndex < totalTables; fromIndex += bulkSize) { + final int toIndex = Math.min(fromIndex + bulkSize, totalTables); + final List eachBulkofTableNames = tableNames.subList(fromIndex, toIndex); + List eachBulkofTables; + // Retries once if the first call to fetch the metadata fails + synchronized(mClient) { --- End diff -- This is refactored code from the fix for DRILL-4577. (https://github.com/apache/drill/pull/461) I didn't really change it. Going thru the code, it appears that m_client may be cached and reused and so probably should be synchronized. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---