[ 
https://issues.apache.org/jira/browse/DRILL-884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14018319#comment-14018319
 ] 

Norris Lee commented on DRILL-884:
----------------------------------

The issue is actually with the 2nd query that Tableau generates after getting 
the metadata. To get the metadata, it runs:
{code}
select * from (select * from dfs.`default`.`/opt/drill/raw-files/click1.json`) 
`TableauSQL` where (0=1);
{code}
then afterwards to get the actual data, it will run a query similar to this:
{code}
SELECT `TableauSQL`.`address` AS `address`,
  `TableauSQL`.`br` AS `br`,
  `TableauSQL`.`first_visit` AS `first_visit`,
  `TableauSQL`.`gender` AS `gender`,
  `TableauSQL`.`id` AS `id`,
  `TableauSQL`.`la` AS `la`,
  `TableauSQL`.`name` AS `name`,
  `TableauSQL`.`os` AS `os`,
  `TableauSQL`.`st` AS `st`,
  `TableauSQL`.`user_category` AS `user_category`
FROM (
  select * from dfs.`default`.`/opt/drill/raw-files/click1.json`
) `TableauSQL`
{code}
Running this query will fail in sqlline as well with the following parsing 
error:
{code}
Query failed: org.apache.drill.exec.rpc.RpcException: Remote failure while 
running query.[error_id: "a22c2c56-767c-4a38-a62a-3231bcb625a5"
endpoint {
  address: "localhost"
  user_port: 31010
  control_port: 31011
  data_port: 31012
}
error_type: 0
message: "Failure while parsing sql. < ValidationException:[ 
org.eigenbase.util.EigenbaseContextException: From line 1, column 21 to line 1, 
column 29 ] < EigenbaseContextException:[ From line 1, column 21 to line 1, 
column 29 ] < SqlValidatorException:[ Column 'address' not found in table 
'TableauSQL' ]"
]
{code}
This only seems to happen with dfs files such as json and parquet. This query 
runs fine on normal hive table.

> Query used to derive result set metadata for Tableau's "Custom SQL" does not 
> run
> --------------------------------------------------------------------------------
>
>                 Key: DRILL-884
>                 URL: https://issues.apache.org/jira/browse/DRILL-884
>             Project: Apache Drill
>          Issue Type: Bug
>            Reporter: George Chow
>
> The following style of query is used by Tableau to derive the metadata of a 
> custom SQL:
> From Tableau's protocol server log:
> {code}
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: ODBCProtocol::ReadMetadataImpl: 
> Attempting to read metadata from the prepared / executed query result set.
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: ODBCProtocolImpl::ReadMetadataImpl: 
> Reading metadata using a prepared statement.
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: <QUERY protocol='0367b1f0'>
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: SELECT *
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: FROM (
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0:   select * from 
> dfs.`default`.`/opt/drill/raw-files/click1.json`
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: ) `TableauSQL`
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: WHERE (0 = 1)
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: </QUERY>
> 2014-05-30 18:35:39.718 (-,-,-,-) 0ea0: ODBCProtocolImpl::ReadMetadataImpl: 
> SQLPrepare failed. Reading metadata using an executed query.
> 2014-05-30 18:35:47.640 (-,-,-,-) 0ea0: ODBCProtocolImpl::ReadMetadataImpl: 
> No columns were reported!
> {code}
> Extracting the query to run inside sqlline shows the problem:
> {code}
> 0: jdbc:drill:zk=localhost:5181> select * from (select * from 
> dfs.`default`.`/opt/drill/raw-files/click1.json`) `TableauSQL` where (0=1);
> +--+
> |  |
> +--+
> +--+
> No rows selected (9.059 seconds)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to