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 1E367200B49 for ; Wed, 20 Jul 2016 08:18:44 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1CF34160A8B; Wed, 20 Jul 2016 06:18:44 +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 637C1160A76 for ; Wed, 20 Jul 2016 08:18:43 +0200 (CEST) Received: (qmail 62100 invoked by uid 500); 20 Jul 2016 06:18:42 -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 62088 invoked by uid 99); 20 Jul 2016 06:18:42 -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, 20 Jul 2016 06:18:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0F1C6E03A6; Wed, 20 Jul 2016 06:18:42 +0000 (UTC) From: chunhui-shi To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #546: DRILL-4783: flatten operator should not throw excep... Content-Type: text/plain Message-Id: <20160720061842.0F1C6E03A6@git1-us-west.apache.org> Date: Wed, 20 Jul 2016 06:18:42 +0000 (UTC) archived-at: Wed, 20 Jul 2016 06:18:44 -0000 Github user chunhui-shi commented on a diff in the pull request: https://github.com/apache/drill/pull/546#discussion_r71471032 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/flatten/FlattenRecordBatch.java --- @@ -129,8 +129,14 @@ private void setFlattenVector() { try { final TypedFieldId typedFieldId = incoming.getValueVectorId(popConfig.getColumn()); final MaterializedField field = incoming.getSchema().getColumn(typedFieldId.getFieldIds()[0]); - final RepeatedValueVector vector = RepeatedValueVector.class.cast(incoming.getValueAccessorById( - field.getValueClass(), typedFieldId.getFieldIds()).getValueVector()); + RepeatedValueVector vector = null; + try { + vector = RepeatedValueVector.class.cast(incoming.getValueAccessorById( + field.getValueClass(), typedFieldId.getFieldIds()).getValueVector()); + } catch(ClassCastException ex) { + //if cast fail --- End diff -- Thanks Jinfeng for the review. The fix will return empty result if it is flatten(100). Since this fix is to address the issue when there is no incoming record, flatten above convert_from should not throw exception. Meanwhile it is better to keep other behavior unchanged unless we have strong reason to change it. Based on this understanding, I am updating the change to still throw the same cast exception if flatten is not getting a RepeatedValueVector to work on. --- 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. ---