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 69EBF10E24 for ; Sun, 4 Jan 2015 21:28:53 +0000 (UTC) Received: (qmail 97302 invoked by uid 500); 4 Jan 2015 21:28:54 -0000 Delivered-To: apmail-drill-issues-archive@drill.apache.org Received: (qmail 97269 invoked by uid 500); 4 Jan 2015 21:28:54 -0000 Mailing-List: contact issues-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 issues@drill.apache.org Received: (qmail 97259 invoked by uid 99); 4 Jan 2015 21:28:54 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Jan 2015 21:28:54 +0000 Date: Sun, 4 Jan 2015 21:28:54 +0000 (UTC) From: "Jacques Nadeau (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (DRILL-1736) Cannot cast to other data types after using flatten + convert_from('json') MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DRILL-1736?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Nadeau updated DRILL-1736: ---------------------------------- Priority: Minor (was: Major) > Cannot cast to other data types after using flatten + convert_from('json') > -------------------------------------------------------------------------- > > Key: DRILL-1736 > URL: https://issues.apache.org/jira/browse/DRILL-1736 > Project: Apache Drill > Issue Type: Bug > Components: Functions - Drill > Affects Versions: 0.6.0, 0.7.0 > Reporter: Hao Zhu > Assignee: Steven Phillips > Priority: Minor > Fix For: 0.8.0 > > > 1. This SQL looks good. > {code} > select cast(row_key as int) as b, flatten(convert_from(mat.i.n , 'json')) as d from dfs.root.`table/mat` as mat; > +------------+------------+ > | b | d | > +------------+------------+ > | 100 | 10 | > | 100 | 1000 | > | 101 | 20 | > | 101 | 1200 | > +------------+------------+ > 4 rows selected (0.196 seconds) > {code} > 2. Can not cast column 'b' to other data type. > {code} > with tmp as > (select cast(row_key as int) as b, flatten(convert_from(mat.i.n , 'json')) as d from dfs.root.`table/mat` as mat) > select * from tmp where cast(tmp.d as int)=10; > > Query failed: Failure while running fragment., Failure while trying to materialize incoming schema. Errors: > Error in expression at index -1. Error: Missing function implementation: [castINT(MAP-REQUIRED)]. Full expression: --UNKNOWN EXPRESSION--.. [ 744bffba-5ad9-40f4-a47e-25dc83565716 on n4a:31010 ] > (org.apache.drill.exec.exception.SchemaChangeException) Failure while trying to materialize incoming schema. Errors: > Error in expression at index -1. Error: Missing function implementation: [castINT(MAP-REQUIRED)]. Full expression: --UNKNOWN EXPRESSION--.. > org.apache.drill.exec.physical.impl.filter.FilterRecordBatch.generateSV2Filterer():194 > org.apache.drill.exec.physical.impl.filter.FilterRecordBatch.setupNewSchema():114 org.apache.drill.exec.record.AbstractSingleRecordBatch.buildSchema():110 > org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.buildSchema():64 org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 > org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.buildSchema():269 org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 > org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.buildSchema():95 > org.apache.drill.exec.work.fragment.FragmentExecutor.run():111 > org.apache.drill.exec.work.WorkManager$RunnableWrapper.run():249 > .......():0 > Error: exception while executing query: Failure while executing query. (state=,code=0) > {code} > 3. Still can not change data type after creating the view. > {code} > create or replace view testview as select cast(row_key as int) as b, flatten(convert_from(mat.i.n , 'json')) as d from dfs.root.`table/mat` as mat; > > describe testview; > +-------------+------------+-------------+ > | COLUMN_NAME | DATA_TYPE | IS_NULLABLE | > +-------------+------------+-------------+ > | b | INTEGER | NO | > | d | ANY | NO | > +-------------+------------+-------------+ > 2 rows selected (0.505 seconds) > select * from testview where cast(d as int)=10; > > Query failed: Failure while running fragment., Failure while trying to materialize incoming schema. Errors: > Error in expression at index -1. Error: Missing function implementation: [castINT(MAP-REQUIRED)]. Full expression: --UNKNOWN EXPRESSION--.. [ e3a92573-3947-416e-b0ea-aa6dc4d47a20 on n4a:31010 ] > (org.apache.drill.exec.exception.SchemaChangeException) Failure while trying to materialize incoming schema. Errors: > Error in expression at index -1. Error: Missing function implementation: [castINT(MAP-REQUIRED)]. Full expression: --UNKNOWN EXPRESSION--.. > org.apache.drill.exec.physical.impl.filter.FilterRecordBatch.generateSV2Filterer():194 > org.apache.drill.exec.physical.impl.filter.FilterRecordBatch.setupNewSchema():114 > org.apache.drill.exec.record.AbstractSingleRecordBatch.buildSchema():110 > org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 > org.apache.drill.exec.physical.impl.svremover.RemovingRecordBatch.buildSchema():64 > org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 > org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.buildSchema():269 > org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.buildSchema():80 org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.buildSchema():95 > org.apache.drill.exec.work.fragment.FragmentExecutor.run():111 > org.apache.drill.exec.work.WorkManager$RunnableWrapper.run():249 > .......():0 > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)