UNION ALL query that involves an empty directory on either side of UNION ALL operator results in FAILED query. We should return the results for the non-empty side (input) of UNION ALL.
Note that empty_DIR is an empty directory, the directory exists, but it has no files in it.
Drill 1.4 git.commit.id=b9068117
4 node cluster on CentOS
After resolving the current issue Drill can query an empty directory. It is a schemaless Drill table for now.
User can query empty directory and use it for queries with any JOIN and UNION (UNION ALL) operators.
Empty directory with parquet metadata cache files is schemaless Drill table as well.
It works similar to empty files:
- The query with star will return empty result.
- If some fields are indicated in select statement, that fields will be returned as INT-OPTIONAL types.
- The empty directory in the query with UNION operator will not change the result as if the statement with UNION is absent in the query.
- The query with joins will return an empty result except the cases of using outer join clauses, when the outer table for "right join" or derived table for "left join" has a data. In that case the data from a non-empty table is returned.
- The empty directory table can be used in complex queries.
Internally empty directory interprets as DynamicDrillTable with null selection. SchemalessScan, SchemalessBatchCreator and SchemalessBatch are introduced and used on execution state for interactions with other operators and batches.
If empty directory contain parquet metadata cache files, the ParquetGroupScan for such table is not valid and SchemalessScan is used instead of that.