Return-Path: X-Original-To: apmail-drill-issues-archive@minotaur.apache.org Delivered-To: apmail-drill-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E48871045D for ; Mon, 17 Nov 2014 01:41:55 +0000 (UTC) Received: (qmail 24814 invoked by uid 500); 17 Nov 2014 01:41:55 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 24782 invoked by uid 500); 17 Nov 2014 01:41:55 -0000 Mailing-List: contact issues-help@drill.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.incubator.apache.org Delivered-To: mailing list issues@drill.incubator.apache.org Received: (qmail 24767 invoked by uid 99); 17 Nov 2014 01:41:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2014 01:41:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 17 Nov 2014 01:41:54 +0000 Received: (qmail 24186 invoked by uid 99); 17 Nov 2014 01:41:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Nov 2014 01:41:34 +0000 Date: Mon, 17 Nov 2014 01:41:34 +0000 (UTC) From: "Jacques Nadeau (JIRA)" To: issues@drill.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-1616) Drill throws "Schema is currently null" error on count(field) when field is an JSON object/array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DRILL-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Nadeau updated DRILL-1616: ---------------------------------- Fix Version/s: 0.7.0 > Drill throws "Schema is currently null" error on count(field) when field is an JSON object/array > ------------------------------------------------------------------------------------------------ > > Key: DRILL-1616 > URL: https://issues.apache.org/jira/browse/DRILL-1616 > Project: Apache Drill > Issue Type: Bug > Components: Storage - JSON > Reporter: Abhishek Girish > Assignee: Jason Altekruse > Fix For: 0.7.0 > > > Count(field) throws error on fields which are objects or arrays and these are not clean. They do not indicate an error in usage. Also, count on objects/arrays should be supported. > > select * from `abc.json`; > +------------+------------+------------+------------+------------+ > | field_1 | field_2 | field_3 | field_4 | field_5 | > +------------+------------+------------+------------+------------+ > | ["1"] | null | {"inner_3":[]} | {"inner_1":[],"inner_3":{}} | [] | > | ["5"] | 2 | {"inner_1":"2","inner_3":[]} | {"inner_1":["1","2","3"],"inner_2":"3","inner_3":{"inner_object_field_1":"2"}} | [{"inner_list":["1","null","6"],"inner_ | > | ["5","10","15"] | A wild string appears! | {"inner_1":"5","inner_2":"3","inner_3":[{},{"inner_object_field_1":"10"}]} | {"inner_1":["4","5","6"],"inner_2":"3","inner_3":{}} | [{ | > +------------+------------+------------+------------+------------+ > 3 rows selected (0.081 seconds) > > select count(field_1) from `abc.json`; > Query failed: Failure while running fragment., Schema is currently null. You must call buildSchema(SelectionVectorMode) before this container can return a schema. [ b6f021f9-213e-475e-83f4-a6facf6fd76d on abhi7.qa.lab:31010 ] > Error: exception while executing query: Failure while executing query. (state=,code=0) > Error is seen on fields 1,3,4,5. > The issue is not seen when array index is specified. > > select count(field_1[0]) from `abc.json`; > +------------+ > | EXPR$0 | > +------------+ > | 3 | > +------------+ > 1 row selected (0.152 seconds) > Or when the element in the object is specified: > > select count(t.field_3.inner_3) from `textmode.json` as t; > +------------+ > | EXPR$0 | > +------------+ > | 3 | > +------------+ > 1 row selected (0.155 seconds) > LOG: > 2014-10-30 13:28:20,286 [a90cc246-e60b-452b-ba96-7f79709f5ffa:frag:0:0] ERROR o.a.d.e.w.f.AbstractStatusReporter - Error bc438332-0828-4a86-8063-9dc8c5a703d9: Failure while running fragment. > java.lang.NullPointerException: Schema is currently null. You must call buildSchema(SelectionVectorMode) before this container can return a schema. > at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:208) ~[guava-14.0.1.jar:na] > at org.apache.drill.exec.record.VectorContainer.getSchema(VectorContainer.java:273) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at org.apache.drill.exec.record.AbstractRecordBatch.getSchema(AbstractRecordBatch.java:116) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.getSchema(IteratorValidatorBatchIterator.java:75) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.buildSchema(ScreenCreator.java:100) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:103) ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at org.apache.drill.exec.work.WorkManager$RunnableWrapper.run(WorkManager.java:249) [drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT] > at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_65] > at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_65] > at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65] -- This message was sent by Atlassian JIRA (v6.3.4#6332)