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 1CAE1200BC8 for ; Wed, 19 Oct 2016 00:58:00 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1BA20160AF7; Tue, 18 Oct 2016 22:58:00 +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 43517160AE5 for ; Wed, 19 Oct 2016 00:57:59 +0200 (CEST) Received: (qmail 36508 invoked by uid 500); 18 Oct 2016 22:57:58 -0000 Mailing-List: contact commits-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list commits@hawq.incubator.apache.org Received: (qmail 36475 invoked by uid 99); 18 Oct 2016 22:57:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Oct 2016 22:57:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 09E10C245F for ; Tue, 18 Oct 2016 22:57:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id SGj-vmZ8q0JN for ; Tue, 18 Oct 2016 22:57:56 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 192505F230 for ; Tue, 18 Oct 2016 22:57:54 +0000 (UTC) Received: (qmail 36450 invoked by uid 99); 18 Oct 2016 22:57:54 -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, 18 Oct 2016 22:57:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 26E14DFE60; Tue, 18 Oct 2016 22:57:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: odiachenko@apache.org To: commits@hawq.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-hawq git commit: HAWQ-1057. Skip SARG_PUSHDOWN parameter if any of filters isn't supported. Date: Tue, 18 Oct 2016 22:57:54 +0000 (UTC) archived-at: Tue, 18 Oct 2016 22:58:00 -0000 Repository: incubator-hawq Updated Branches: refs/heads/master c8ef3a0ac -> 6e921df29 HAWQ-1057. Skip SARG_PUSHDOWN parameter if any of filters isn't supported. Project: http://git-wip-us.apache.org/repos/asf/incubator-hawq/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-hawq/commit/6e921df2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-hawq/tree/6e921df2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-hawq/diff/6e921df2 Branch: refs/heads/master Commit: 6e921df29d25d846b5d4916994c807b8b619662a Parents: c8ef3a0 Author: Oleksandr Diachenko Authored: Tue Oct 18 15:57:02 2016 -0700 Committer: Oleksandr Diachenko Committed: Tue Oct 18 15:57:20 2016 -0700 ---------------------------------------------------------------------- .../hawq/pxf/plugins/hive/HiveORCAccessor.java | 37 +++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/6e921df2/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java ---------------------------------------------------------------------- diff --git a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java index ab2f96e..1cea9c7 100644 --- a/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java +++ b/pxf/pxf-hive/src/main/java/org/apache/hawq/pxf/plugins/hive/HiveORCAccessor.java @@ -20,6 +20,8 @@ package org.apache.hawq.pxf.plugins.hive; */ +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.hive.ql.io.orc.OrcInputFormat; import org.apache.hadoop.hive.ql.io.sarg.SearchArgument; import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory; @@ -41,6 +43,8 @@ import static org.apache.hawq.pxf.plugins.hive.HiveInputFormatFragmenter.PXF_HIV */ public class HiveORCAccessor extends HiveAccessor { + private static final Log LOG = LogFactory.getLog(HiveORCAccessor.class); + private final String READ_COLUMN_IDS_CONF_STR = "hive.io.file.readcolumn.ids"; private final String READ_ALL_COLUMNS = "hive.io.file.read.all.columns"; private final String READ_COLUMN_NAMES_CONF_STR = "hive.io.file.readcolumn.names"; @@ -106,18 +110,23 @@ public class HiveORCAccessor extends HiveAccessor { * need special case logic to make sure to still wrap the filter in a * startAnd() & end() block */ - if (filter instanceof LogicalFilter) - buildExpression(filterBuilder, Arrays.asList(filter)); + if (filter instanceof LogicalFilter) { + if (!buildExpression(filterBuilder, Arrays.asList(filter))) { + return; + } + } else { filterBuilder.startAnd(); - buildArgument(filterBuilder, filter); + if(!buildArgument(filterBuilder, filter)) { + return; + } filterBuilder.end(); } SearchArgument sarg = filterBuilder.build(); jobConf.set(SARG_PUSHDOWN, sarg.toKryo()); } - private void buildExpression(SearchArgument.Builder builder, List filterList) { + private boolean buildExpression(SearchArgument.Builder builder, List filterList) { for (Object f : filterList) { if (f instanceof LogicalFilter) { switch(((LogicalFilter) f).getOperator()) { @@ -131,15 +140,21 @@ public class HiveORCAccessor extends HiveAccessor { builder.startNot(); break; } - buildExpression(builder, ((LogicalFilter) f).getFilterList()); - builder.end(); + if (buildExpression(builder, ((LogicalFilter) f).getFilterList())) { + builder.end(); + } else { + return false; + } } else { - buildArgument(builder, f); + if (!buildArgument(builder, f)) { + return false; + } } } + return true; } - private void buildArgument(SearchArgument.Builder builder, Object filterObj) { + private boolean buildArgument(SearchArgument.Builder builder, Object filterObj) { /* The below functions will not be compatible and requires update with Hive 2.0 APIs */ BasicFilter filter = (BasicFilter) filterObj; int filterColumnIndex = filter.getColumn().index(); @@ -166,8 +181,12 @@ public class HiveORCAccessor extends HiveAccessor { case HDOP_NE: builder.startNot().equals(filterColumnName, filterValue).end(); break; + default: { + LOG.debug("Filter push-down is not supported for " + filter.getOperation() + "operation."); + return false; + } } - return; + return true; } }