You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Vince Gonzalez <vg...@mapr.com> on 2016/05/06 12:26:18 UTC

Re: am I using table functions incorrectly?

Filed DRILL-4568 <https://issues.apache.org/jira/browse/DRILL-4658> for the
issue where the table function doesn't like '\t' as the argument for
fieldDelimiter.

 ----
 Vince Gonzalez
 Systems Engineer
 212.694.3879

 mapr.com

On Wed, Apr 13, 2016 at 11:14 AM, Andries Engelbrecht <
aengelbrecht@maprtech.com> wrote:

> Vince,
>
> Issue #1
> You have to specify type => 'text' , this seems to work for that issue.
>
> Issue #2
>
> I could not find a workaround or resolution for using tab in the
> fieldDelimiter.
>
>
> --Andries
>
> > On Apr 13, 2016, at 5:56 AM, Vince Gonzalez <vg...@mapr.com> wrote:
> >
> > Issue #1 - I can't just specify some of the options - the issue appears
> to
> > be that I didn't also include some other options:
> >
> > 0: jdbc:drill:zk=local> select columns[0] as a, cast(columns[1] as
> bigint)
> > as b from table(dfs.tmp.`sample_cast.tsv`(skipFirstLine => true));
> > Apr 13, 2016 8:48:51 AM
> > org.apache.calcite.sql.validate.SqlValidatorException <init>
> > *SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: DEFAULT
> is
> > only allowed for optional parameters*
> > Apr 13, 2016 8:48:51 AM org.apache.calcite.runtime.CalciteException
> <init>
> > SEVERE: org.apache.calcite.runtime.CalciteContextException: From line 1,
> > column 76 to line 1, column 115: DEFAULT is only allowed for optional
> > parameters
> > Error: VALIDATION ERROR: From line 1, column 76 to line 1, column 115:
> > DEFAULT is only allowed for optional parameters
> >
> > SQL Query null
> >
> > [Error Id: 0e17e5a8-9b34-46a4-a029-441d1a305fd1 on 172.30.1.144:31010]
> > (state=,code=0)
> >
> >
> > Issue #2 - I can't specify a tab delimiter in the table function because
> it
> > maybe counts the characters rather than trying to interpret as a
> character
> > escape code?
> >
> > 0: jdbc:drill:zk=local> select columns[0] as a, cast(columns[1] as
> bigint)
> > as b from table(dfs.tmp.`sample_cast.tsv`(type => 'text', fieldDelimiter
> =>
> > '\t', skipFirstLine => true));
> > *Error: PARSE ERROR: Expected single character but was String: \t*
> >
> > table sample_cast.tsv
> > parameter fieldDelimiter
> > SQL Query null
> >
> > [Error Id: 3efa82e1-3810-4d4a-b23c-32d6658dffcf on 172.30.1.144:31010]
> > (state=,code=0)
> >
> >
> >
> > ----
> > Vince Gonzalez
> > Systems Engineer
> > 212.694.3879
> >
> > mapr.com
>
>

Re: am I using table functions incorrectly?

Posted by Jacques Nadeau <ja...@dremio.com>.
I haven't tried this but can you try to use the unicode escape sequence for
tab?

I think the format is:

fieldDelimiter => U&'\0009'

--
Jacques Nadeau
CTO and Co-Founder, Dremio

On Fri, May 6, 2016 at 5:26 AM, Vince Gonzalez <vg...@mapr.com> wrote:

> Filed DRILL-4568 <https://issues.apache.org/jira/browse/DRILL-4658> for
> the
> issue where the table function doesn't like '\t' as the argument for
> fieldDelimiter.
>
>  ----
>  Vince Gonzalez
>  Systems Engineer
>  212.694.3879
>
>  mapr.com
>
> On Wed, Apr 13, 2016 at 11:14 AM, Andries Engelbrecht <
> aengelbrecht@maprtech.com> wrote:
>
> > Vince,
> >
> > Issue #1
> > You have to specify type => 'text' , this seems to work for that issue.
> >
> > Issue #2
> >
> > I could not find a workaround or resolution for using tab in the
> > fieldDelimiter.
> >
> >
> > --Andries
> >
> > > On Apr 13, 2016, at 5:56 AM, Vince Gonzalez <vg...@mapr.com>
> wrote:
> > >
> > > Issue #1 - I can't just specify some of the options - the issue appears
> > to
> > > be that I didn't also include some other options:
> > >
> > > 0: jdbc:drill:zk=local> select columns[0] as a, cast(columns[1] as
> > bigint)
> > > as b from table(dfs.tmp.`sample_cast.tsv`(skipFirstLine => true));
> > > Apr 13, 2016 8:48:51 AM
> > > org.apache.calcite.sql.validate.SqlValidatorException <init>
> > > *SEVERE: org.apache.calcite.sql.validate.SqlValidatorException: DEFAULT
> > is
> > > only allowed for optional parameters*
> > > Apr 13, 2016 8:48:51 AM org.apache.calcite.runtime.CalciteException
> > <init>
> > > SEVERE: org.apache.calcite.runtime.CalciteContextException: From line
> 1,
> > > column 76 to line 1, column 115: DEFAULT is only allowed for optional
> > > parameters
> > > Error: VALIDATION ERROR: From line 1, column 76 to line 1, column 115:
> > > DEFAULT is only allowed for optional parameters
> > >
> > > SQL Query null
> > >
> > > [Error Id: 0e17e5a8-9b34-46a4-a029-441d1a305fd1 on 172.30.1.144:31010]
> > > (state=,code=0)
> > >
> > >
> > > Issue #2 - I can't specify a tab delimiter in the table function
> because
> > it
> > > maybe counts the characters rather than trying to interpret as a
> > character
> > > escape code?
> > >
> > > 0: jdbc:drill:zk=local> select columns[0] as a, cast(columns[1] as
> > bigint)
> > > as b from table(dfs.tmp.`sample_cast.tsv`(type => 'text',
> fieldDelimiter
> > =>
> > > '\t', skipFirstLine => true));
> > > *Error: PARSE ERROR: Expected single character but was String: \t*
> > >
> > > table sample_cast.tsv
> > > parameter fieldDelimiter
> > > SQL Query null
> > >
> > > [Error Id: 3efa82e1-3810-4d4a-b23c-32d6658dffcf on 172.30.1.144:31010]
> > > (state=,code=0)
> > >
> > >
> > >
> > > ----
> > > Vince Gonzalez
> > > Systems Engineer
> > > 212.694.3879
> > >
> > > mapr.com
> >
> >
>