You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by srikanth flink <fl...@gmail.com> on 2019/10/29 06:51:17 UTC
Add custom fields into Json
Hi there,
I'm querying json data and is working fine. I would like to add custom
fields including the query result.
My query looks like: select ROW(`source`), ROW(`destination`), ROW(`dns`),
organization, cnt from (select (source.`ip`,source.`isInternalIP`) as
source, (destination.`ip`,destination.`isInternalIP`) as destination,
(dns.`query`, dns.`answers`.`data`) as dns, organization as organization
from dnsTableS) tab1;
While I would like to add "'dns' as `agg.type`, 'dns' as `agg.name`" to the
same output, but the query is throw exceptions:
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.sql.parser.impl.ParseException: Encountered "." at line 1,
column 278.
Was expecting one of:
"EXCEPT" ...
"FETCH" ...
"FROM" ...
"INTERSECT" ...
"LIMIT" ...
"OFFSET" ...
"ORDER" ...
"MINUS" ...
"UNION" ...
")" ...
"," ...
Could someone help me with this? Thanks
Srikanth
Re: Add custom fields into Json
Posted by Jingsong Li <ji...@gmail.com>.
Hi Srikanth,
Which sql throws exception?
On Tue, Oct 29, 2019 at 3:41 PM vino yang <ya...@gmail.com> wrote:
> Hi,
>
> The exception shows your SQL statement has grammatical errors. Please
> check it again or provide the whole SQL statement here.
>
> Best,
> Vino
>
> srikanth flink <fl...@gmail.com> 于2019年10月29日周二 下午2:51写道:
>
>> Hi there,
>>
>> I'm querying json data and is working fine. I would like to add custom
>> fields including the query result.
>> My query looks like: select ROW(`source`), ROW(`destination`),
>> ROW(`dns`), organization, cnt from (select
>> (source.`ip`,source.`isInternalIP`) as source,
>> (destination.`ip`,destination.`isInternalIP`) as destination,
>> (dns.`query`, dns.`answers`.`data`) as dns, organization as organization
>> from dnsTableS) tab1;
>>
>> While I would like to add "'dns' as `agg.type`, 'dns' as `agg.name`" to
>> the same output, but the query is throw exceptions:
>> [ERROR] Could not execute SQL statement. Reason:
>> org.apache.flink.sql.parser.impl.ParseException: Encountered "." at line
>> 1, column 278.
>> Was expecting one of:
>> "EXCEPT" ...
>> "FETCH" ...
>> "FROM" ...
>> "INTERSECT" ...
>> "LIMIT" ...
>> "OFFSET" ...
>> "ORDER" ...
>> "MINUS" ...
>> "UNION" ...
>> ")" ...
>> "," ...
>>
>> Could someone help me with this? Thanks
>>
>> Srikanth
>>
>
--
Best, Jingsong Lee
Re: Add custom fields into Json
Posted by vino yang <ya...@gmail.com>.
Hi,
The exception shows your SQL statement has grammatical errors. Please check
it again or provide the whole SQL statement here.
Best,
Vino
srikanth flink <fl...@gmail.com> 于2019年10月29日周二 下午2:51写道:
> Hi there,
>
> I'm querying json data and is working fine. I would like to add custom
> fields including the query result.
> My query looks like: select ROW(`source`), ROW(`destination`),
> ROW(`dns`), organization, cnt from (select
> (source.`ip`,source.`isInternalIP`) as source,
> (destination.`ip`,destination.`isInternalIP`) as destination,
> (dns.`query`, dns.`answers`.`data`) as dns, organization as organization
> from dnsTableS) tab1;
>
> While I would like to add "'dns' as `agg.type`, 'dns' as `agg.name`" to
> the same output, but the query is throw exceptions:
> [ERROR] Could not execute SQL statement. Reason:
> org.apache.flink.sql.parser.impl.ParseException: Encountered "." at line
> 1, column 278.
> Was expecting one of:
> "EXCEPT" ...
> "FETCH" ...
> "FROM" ...
> "INTERSECT" ...
> "LIMIT" ...
> "OFFSET" ...
> "ORDER" ...
> "MINUS" ...
> "UNION" ...
> ")" ...
> "," ...
>
> Could someone help me with this? Thanks
>
> Srikanth
>
Re: Add custom fields into Json
Posted by Jingsong Li <ji...@gmail.com>.
Hi Srikanth,
1.Can you share complete sql? And schema of input table?
2.What schema you want to select? I didn't understand what is "agg" field
mean.
On Tue, Oct 29, 2019 at 3:28 PM Jingsong Li <ji...@gmail.com> wrote:
> Hi Srikanth,
> 1.Can you share complete sql? And schema of input table?
> 2.What schema you want to select? I didn't understand what is "agg" field
> mean.
>
> On Tue, Oct 29, 2019 at 2:51 PM srikanth flink <fl...@gmail.com>
> wrote:
>
>> Hi there,
>>
>> I'm querying json data and is working fine. I would like to add custom
>> fields including the query result.
>> My query looks like: select ROW(`source`), ROW(`destination`),
>> ROW(`dns`), organization, cnt from (select
>> (source.`ip`,source.`isInternalIP`) as source,
>> (destination.`ip`,destination.`isInternalIP`) as destination,
>> (dns.`query`, dns.`answers`.`data`) as dns, organization as organization
>> from dnsTableS) tab1;
>>
>> While I would like to add "'dns' as `agg.type`, 'dns' as `agg.name`" to
>> the same output, but the query is throw exceptions:
>> [ERROR] Could not execute SQL statement. Reason:
>> org.apache.flink.sql.parser.impl.ParseException: Encountered "." at line
>> 1, column 278.
>> Was expecting one of:
>> "EXCEPT" ...
>> "FETCH" ...
>> "FROM" ...
>> "INTERSECT" ...
>> "LIMIT" ...
>> "OFFSET" ...
>> "ORDER" ...
>> "MINUS" ...
>> "UNION" ...
>> ")" ...
>> "," ...
>>
>> Could someone help me with this? Thanks
>>
>> Srikanth
>>
>
>
> --
> Best, Jingsong Lee
>
--
Best, Jingsong Lee