You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Ted Dunning (JIRA)" <ji...@apache.org> on 2015/10/05 22:17:26 UTC

[jira] [Commented] (DRILL-3894) Directory functions (MaxDir, MinDir ..) should have optional filename parameter

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

Ted Dunning commented on DRILL-3894:
------------------------------------

Actually, I just tested a bit with this.  I agree that this is a valid request, but there is actually a trivial (but not necessarily obvious work-around).

TLDR: Just use '.' as the table name.

I created a workspace zoom under my home directory as the directory zoom.

>From my home directory, I can use {{MAXDIR}} as expected:
{code}
0: jdbc:drill:> select count(*) from dfs.tdunning.zoom;
+---------+
| EXPR$0  |
+---------+
| 600     |
+---------+
1 row selected (0.378 seconds)
0: jdbc:drill:> select count(*) from dfs.tdunning.zoom where dir0 = MAXDIR('dfs.tdunning', 'zoom');
+---------+
| EXPR$0  |
+---------+
| 200     |
+---------+
1 row selected (0.799 seconds)
{code}
So that all works. If I try to touch the zoom work-space, I immediately have some issues because a workspace isn't a table.

{code}
0: jdbc:drill:> select count(*) from dfs.zoom;

Error: PARSE ERROR: From line 1, column 22 to line 1, column 24: Table 'dfs.zoom' not found
{code}
Using the hack of {{`.`}} as a table resolves this, however:

{code}
0: jdbc:drill:> select count(*) from dfs.zoom.`.`;
+---------+
| EXPR$0  |
+---------+
| 600     |
+---------+
1 row selected (0.336 seconds)
0: jdbc:drill:> select count(*) from dfs.zoom.`.` where dir0 = maxdir('dfs.zoom', '.');
+---------+
| EXPR$0  |
+---------+
| 200     |
+---------+
1 row selected (0.777 seconds)
0: jdbc:drill:> 
{code}

> Directory functions (MaxDir, MinDir ..) should have optional filename parameter
> -------------------------------------------------------------------------------
>
>                 Key: DRILL-3894
>                 URL: https://issues.apache.org/jira/browse/DRILL-3894
>             Project: Apache Drill
>          Issue Type: Improvement
>          Components: Functions - Drill
>    Affects Versions: 1.2.0
>            Reporter: Neeraja
>
> https://drill.apache.org/docs/query-directory-functions/
> The directory functions documented above should provide ability to have second parameter(file name) as optional.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)