You can specify the column names.
"select *"  explores the schema by itself.

> select * from `data`;
+------------+------------+
|    dir0    |    col1    |
+------------+------------+
| null       | 1          |
| folder1    | null       |
| folder1    | null       |
| folder1    | 4          |
+------------+------------+
4 rows selected (0.074 seconds)
> select dir0,col1,col2 from `data`;
+------------+------------+------------+
|    dir0    |    col1    |    col2    |
+------------+------------+------------+
| null       | 1          | null       |
| folder1    | null       | 3          |
| folder1    | null       | 2          |
| folder1    | 4          | null       |
+------------+------------+------------+
4 rows selected (0.088 seconds)
> select dir0,col1,col2,col3 from `data`;
+------------+------------+------------+------------+
|    dir0    |    col1    |    col2    |    col3    |
+------------+------------+------------+------------+
| null       | 1          | null       | null       |
| folder1    | null       | 3          | null       |
| folder1    | null       | 2          | null       |
| folder1    | 4          | null       | null       |
+------------+------------+------------+------------+
4 rows selected (0.098 seconds)

Thanks,
Hao

On Wed, Apr 29, 2015 at 5:14 PM, rahul challapalli <
[email protected]> wrote:

> What is the desired behavior when I run "select * from data;" on the below
> structure?
>
> data/
>   -- file1.json
>   -- folder1/
>        -- file2.json
>
> file1.json : {"col1" : 1}
> file2.json : {"col2" : 2}
>
> This is what drill returns :
> +------------+------------+
> |    dir0    |    col2    |
> +------------+------------+
> | folder1   | 2          |
> | null       | null       |
> +------------+------------+
>
> Looks like drill ignored the columns from the first file.
>
> - Rahul
>

Reply via email to