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 266C3200CF3 for ; Wed, 30 Aug 2017 07:42:12 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 24EB016740C; Wed, 30 Aug 2017 05:42:12 +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 6BA891673FA for ; Wed, 30 Aug 2017 07:42:11 +0200 (CEST) Received: (qmail 75863 invoked by uid 500); 30 Aug 2017 05:42:10 -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 75848 invoked by uid 99); 30 Aug 2017 05:42:10 -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; Wed, 30 Aug 2017 05:42:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 02B1BF32AD; Wed, 30 Aug 2017 05:42:10 +0000 (UTC) From: jinfengni To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #906: DRILL-5546: Handle schema change exception failure ... Content-Type: text/plain Message-Id: <20170830054210.02B1BF32AD@git1-us-west.apache.org> Date: Wed, 30 Aug 2017 05:42:10 +0000 (UTC) archived-at: Wed, 30 Aug 2017 05:42:12 -0000 Github user jinfengni commented on a diff in the pull request: https://github.com/apache/drill/pull/906#discussion_r135974310 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java --- @@ -768,4 +765,73 @@ else if (exprHasPrefix && refHasPrefix) { } } } + + /** + * handle FAST NONE specially when Project for query output. This happens when input returns a + * FAST NONE directly ( input does not return any batch with schema/data). + * + * Project operator has to return a batch with schema derived using the following 3 rules: + * Case 1: * ==> expand into an empty list of columns. + * Case 2: regular column reference ==> treat as nullable-int column + * Case 3: expressions => Call ExpressionTreeMaterialization over an empty vector contain. + * Once the expression is materialized without error, use the output type of materialized + * expression. + * The batch is constructed with the above rules, and recordCount = 0. + * Returned with OK_NEW_SCHEMA to down-stream operator. + */ + @Override + protected IterOutcome handleFastNone() { + if (! popConfig.isOutputProj()) { + return super.handleFastNone(); + } + + allocationVectors = new ArrayList<>(); + final List exprs = getExpressionList(); + final ErrorCollector collector = new ErrorCollectorImpl(); + VectorContainer fakedIncomingVC = new VectorContainer(); + + for (NamedExpression namedExpression : exprs) { + if (namedExpression.getExpr() instanceof SchemaPath) { + final NameSegment expr = ((SchemaPath) namedExpression.getExpr()).getRootSegment(); + if (expr.getPath().contains(StarColumnHelper.STAR_COLUMN)) { --- End diff -- This code has been removed in revised patch. --- 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. ---