Search code examples
hdfsapache-drill

Apache drill showing datatype 'ANY'


I created a view 'names' over a csv file in dfs. I tried using describe statement:

describe dfs.root.`names`

Here is my create view statement:

create view dfs.root.`names` as select id,name,city from dfs.root.`names.csv`

In the output, in the data type column I get data type for all columns as 'ANY'

Here are my csv file contents:

id,name,city
1,shrinivas,pune
2,harshal,morgaon
3,nikhil,chiplun
4,ravinder,chandigarh

the extractHeader parameter in my configuration is set to true

Any ideas on how to get the exact data type in this case?


Solution

  • You need to explicitly specify the datatype of each during view creation:

    create view dfs.root.`names` as select cast(id as smallint) ID,cast(name as varchar) NAME,cast(city as varchar) CITY from dfs.root.`names.csv`