Re: ParquetTableSource在blink table planner下的使用问题

2020-02-17 文章 jun su
hi Jark,

就是因为我的数据里 event_name 字段的value 没有 "没有这个值" , 所以才比较奇怪

Jark Wu  于2020年2月18日周二 下午12:15写道:

> Hi jun,
>
> 这个是符合预期的行为哈。这说明你的 source 中有4条 event_name 的值是  '没有这个值'
>
> Best,
> Jark
>
> On Mon, 17 Feb 2020 at 23:26, jun su  wrote:
>
>> hi Jark Wu,
>>
>> 感谢你的帮助 , 我在之前的问询中还发现了一些别的问题:
>>
>> 发现ParquetTableSource在flink table planner下, stream/batch 两个模式下都有这个情况:
>> 当select一个字段, 并且where条件有 = 判断的话, 输出结果是将where条件
>> 直接赋值给了select字段并返回,以下是简单描述:
>>
>> sql = select event_name from source where event_name = '没有这个值'
>>
>> 输出结果为:
>>
>> 没有这个值
>> 没有这个值
>> 没有这个值
>> 没有这个值
>>
>>
>> Jark Wu  于2020年2月17日周一 下午5:03写道:
>>
>>> 排查了下,确实是个 bug,我开了个 issue 来跟进解决:
>>> https://issues.apache.org/jira/browse/FLINK-16113
>>>
>>> 当前的 workaround 可以将常量放到 selelct 中,比如 select a,b,'windows进程创建' from
>>> MyTable where c = 'windows进程创建'
>>>
>>> Best,
>>> Jark
>>>
>>> On Mon, 17 Feb 2020 at 15:15, jun su  wrote:
>>>
 上一个问题补充, 在blink table planner下:

 select event_name from table => 中文编码没问题

 select event_name from table where event_name = 'windows进程创建'=>
 此时中文编码有问题, 应该是在底层userFunction里将where条件为true时, 直接将where条件赋值给了
 输出列,此时出现了编码问题

 麻烦查证下

 jun su  于2020年2月17日周一 下午1:28写道:

> hi Jark Wu,
>
> 又发现了一个blink table planner的问题,中文显示乱码,麻烦也查证下, 以下是代码:
>
> ParquetTableSource parquetTableSource = ParquetTableSource
> .builder()
> .path("/Users/sujun/Downloads/edr/EDR")
> .forParquetSchema(new 
> AvroSchemaConverter().convert(org.apache.avro.Schema.parse(schema, true)))
> .build();
>
> Table source = bsTableEnv.fromTableSource(parquetTableSource);
> bsTableEnv.createTemporaryView("source",source);
>
> Table t1 = bsTableEnv.sqlQuery("select event_name from source where 
> event_name = 'windows进程创建'");
> bsTableEnv.toAppendStream(t1,Row.class).print();
>
> windows\u8FDB\u7A0B\u521B\u5EFA
> windows\u8FDB\u7A0B\u521B\u5EFA
> windows\u8FDB\u7A0B\u521B\u5EFA
> windows\u8FDB\u7A0B\u521B\u5EFA
> windows\u8FDB\u7A0B\u521B\u5EFA
> windows\u8FDB\u7A0B\u521B\u5EFA
>
>
> jun su  于2020年2月14日周五 下午6:54写道:
>
>> 1. 发现ParquetTableSource在flink table planner下, stream/batch
>> 两个模式下都有以上提出的问题,
>> 2. blink table planner下没有以上问题, 但是中文print方法有编码问题
>>
>> 不清数是不是我使用问题,麻烦查证下
>>
>> jun su  于2020年2月14日周五 下午6:30写道:
>>
>>> hi Jark Wu,
>>>
>>> 抱歉以下是我的代码和结果:
>>>
>>> public static void main(String[] args) throws Exception {
>>> ExecutionEnvironment fbEnv = 
>>> ExecutionEnvironment.getExecutionEnvironment();
>>> BatchTableEnvironment fbTableEnv = 
>>> BatchTableEnvironment.create(fbEnv);
>>>
>>> String schema = 
>>> 

Re: ParquetTableSource在blink table planner下的使用问题

2020-02-17 文章 Jark Wu
Hi jun,

这个是符合预期的行为哈。这说明你的 source 中有4条 event_name 的值是  '没有这个值'

Best,
Jark

On Mon, 17 Feb 2020 at 23:26, jun su  wrote:

> hi Jark Wu,
>
> 感谢你的帮助 , 我在之前的问询中还发现了一些别的问题:
>
> 发现ParquetTableSource在flink table planner下, stream/batch 两个模式下都有这个情况:
> 当select一个字段, 并且where条件有 = 判断的话, 输出结果是将where条件
> 直接赋值给了select字段并返回,以下是简单描述:
>
> sql = select event_name from source where event_name = '没有这个值'
>
> 输出结果为:
>
> 没有这个值
> 没有这个值
> 没有这个值
> 没有这个值
>
>
> Jark Wu  于2020年2月17日周一 下午5:03写道:
>
>> 排查了下,确实是个 bug,我开了个 issue 来跟进解决:
>> https://issues.apache.org/jira/browse/FLINK-16113
>>
>> 当前的 workaround 可以将常量放到 selelct 中,比如 select a,b,'windows进程创建' from MyTable
>> where c = 'windows进程创建'
>>
>> Best,
>> Jark
>>
>> On Mon, 17 Feb 2020 at 15:15, jun su  wrote:
>>
>>> 上一个问题补充, 在blink table planner下:
>>>
>>> select event_name from table => 中文编码没问题
>>>
>>> select event_name from table where event_name = 'windows进程创建'=>
>>> 此时中文编码有问题, 应该是在底层userFunction里将where条件为true时, 直接将where条件赋值给了
>>> 输出列,此时出现了编码问题
>>>
>>> 麻烦查证下
>>>
>>> jun su  于2020年2月17日周一 下午1:28写道:
>>>
 hi Jark Wu,

 又发现了一个blink table planner的问题,中文显示乱码,麻烦也查证下, 以下是代码:

 ParquetTableSource parquetTableSource = ParquetTableSource
 .builder()
 .path("/Users/sujun/Downloads/edr/EDR")
 .forParquetSchema(new 
 AvroSchemaConverter().convert(org.apache.avro.Schema.parse(schema, true)))
 .build();

 Table source = bsTableEnv.fromTableSource(parquetTableSource);
 bsTableEnv.createTemporaryView("source",source);

 Table t1 = bsTableEnv.sqlQuery("select event_name from source where 
 event_name = 'windows进程创建'");
 bsTableEnv.toAppendStream(t1,Row.class).print();

 windows\u8FDB\u7A0B\u521B\u5EFA
 windows\u8FDB\u7A0B\u521B\u5EFA
 windows\u8FDB\u7A0B\u521B\u5EFA
 windows\u8FDB\u7A0B\u521B\u5EFA
 windows\u8FDB\u7A0B\u521B\u5EFA
 windows\u8FDB\u7A0B\u521B\u5EFA


 jun su  于2020年2月14日周五 下午6:54写道:

> 1. 发现ParquetTableSource在flink table planner下, stream/batch
> 两个模式下都有以上提出的问题,
> 2. blink table planner下没有以上问题, 但是中文print方法有编码问题
>
> 不清数是不是我使用问题,麻烦查证下
>
> jun su  于2020年2月14日周五 下午6:30写道:
>
>> hi Jark Wu,
>>
>> 抱歉以下是我的代码和结果:
>>
>> public static void main(String[] args) throws Exception {
>> ExecutionEnvironment fbEnv = 
>> ExecutionEnvironment.getExecutionEnvironment();
>> BatchTableEnvironment fbTableEnv = 
>> BatchTableEnvironment.create(fbEnv);
>>
>> String schema = 
>> 

Re: ParquetTableSource在blink table planner下的使用问题

2020-02-17 文章 Jark Wu
排查了下,确实是个 bug,我开了个 issue 来跟进解决:
https://issues.apache.org/jira/browse/FLINK-16113

当前的 workaround 可以将常量放到 selelct 中,比如 select a,b,'windows进程创建' from MyTable
where c = 'windows进程创建'

Best,
Jark

On Mon, 17 Feb 2020 at 15:15, jun su  wrote:

> 上一个问题补充, 在blink table planner下:
>
> select event_name from table => 中文编码没问题
>
> select event_name from table where event_name = 'windows进程创建'=>
> 此时中文编码有问题, 应该是在底层userFunction里将where条件为true时, 直接将where条件赋值给了
> 输出列,此时出现了编码问题
>
> 麻烦查证下
>
> jun su  于2020年2月17日周一 下午1:28写道:
>
>> hi Jark Wu,
>>
>> 又发现了一个blink table planner的问题,中文显示乱码,麻烦也查证下, 以下是代码:
>>
>> ParquetTableSource parquetTableSource = ParquetTableSource
>> .builder()
>> .path("/Users/sujun/Downloads/edr/EDR")
>> .forParquetSchema(new 
>> AvroSchemaConverter().convert(org.apache.avro.Schema.parse(schema, true)))
>> .build();
>>
>> Table source = bsTableEnv.fromTableSource(parquetTableSource);
>> bsTableEnv.createTemporaryView("source",source);
>>
>> Table t1 = bsTableEnv.sqlQuery("select event_name from source where 
>> event_name = 'windows进程创建'");
>> bsTableEnv.toAppendStream(t1,Row.class).print();
>>
>> windows\u8FDB\u7A0B\u521B\u5EFA
>> windows\u8FDB\u7A0B\u521B\u5EFA
>> windows\u8FDB\u7A0B\u521B\u5EFA
>> windows\u8FDB\u7A0B\u521B\u5EFA
>> windows\u8FDB\u7A0B\u521B\u5EFA
>> windows\u8FDB\u7A0B\u521B\u5EFA
>>
>>
>> jun su  于2020年2月14日周五 下午6:54写道:
>>
>>> 1. 发现ParquetTableSource在flink table planner下, stream/batch
>>> 两个模式下都有以上提出的问题,
>>> 2. blink table planner下没有以上问题, 但是中文print方法有编码问题
>>>
>>> 不清数是不是我使用问题,麻烦查证下
>>>
>>> jun su  于2020年2月14日周五 下午6:30写道:
>>>
 hi Jark Wu,

 抱歉以下是我的代码和结果:

 public static void main(String[] args) throws Exception {
 ExecutionEnvironment fbEnv = 
 ExecutionEnvironment.getExecutionEnvironment();
 BatchTableEnvironment fbTableEnv = BatchTableEnvironment.create(fbEnv);

 String schema = 
 

Re: ParquetTableSource在blink table planner下的使用问题

2020-02-14 文章 jun su
1. 发现ParquetTableSource在flink table planner下, stream/batch 两个模式下都有以上提出的问题,
2. blink table planner下没有以上问题, 但是中文print方法有编码问题

不清数是不是我使用问题,麻烦查证下

jun su  于2020年2月14日周五 下午6:30写道:

> hi Jark Wu,
>
> 抱歉以下是我的代码和结果:
>
> public static void main(String[] args) throws Exception {
> ExecutionEnvironment fbEnv = 
> ExecutionEnvironment.getExecutionEnvironment();
> BatchTableEnvironment fbTableEnv = BatchTableEnvironment.create(fbEnv);
>
> String schema = 
> "{\"type\":\"record\",\"name\":\"root\",\"fields\":[{\"name\":\"parent_process_id\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"process_id\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"dst_address\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"technique_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"tgt_path\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"tgt_pid\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"windows_event_id\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"event_rule_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dev_address\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"sa_da\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"tran_protocol\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"src_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"domain_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"operation_object\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"protocol\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"event_type\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"vendor\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"src_address\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"source_user\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"id\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"image\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"parent_command_line\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"product\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"sa_sp_ap_da_dp\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"rule_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"receive_time\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null},{\"name\":\"collector_source\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"source_process_id\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"src_ad\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"data_source\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"rule_id\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"src_port\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"event_content\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"file_hash\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"source_image\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"dst_port\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"event_level\",\"type\":[\"null\",\"long\"],\"default\":null},{\"name\":\"event_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"parent_image\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"current_directory\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"technique_id\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"user_account\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"command_line\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"host_name\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"occur_time\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null},{\"name\":\"row_time\",\"type\":[\"null\",{\"type\":\"long\",\"logicalType\":\"timestamp-millis\"}],\"default\":null}]}";
>
> ParquetTableSource parquetTableSource = ParquetTableSource
> .builder()
> .path("/Users/sujun/Downloads/edr/EDR")
> .forParquetSchema(new 
> AvroSchemaConverter().convert(org.apache.avro.Schema.parse(schema, true)))
> .build();
>
>
> Table source = fbTableEnv.fromTableSource(parquetTableSource);
> fbTableEnv.createTemporaryView("source",source);
>
> Table table = fbTableEnv.sqlQuery("select event_name from source where 
> event_name = '没有这个值'");
>
> fbTableEnv.toDataSet(table,Row.class).print();
>
> 没有这个值
> 没有这个值
> 没有这个值
> 没有这个值
> 没有这个值
> 没有这个值
> 没有这个值
>
>
> Jark Wu  于2020年2月14日周五 下午6:25写道:
>
>> Hi Jun,
>>
>> 你上传的图片失败了,你可以选择用一些图床工具上传然后将链接贴在这里。或者直接贴文本。
>>
>> Best,
>> Jark
>>
>> On Fri, 14 Feb 2020 at 18:16, jun su  wrote:
>>
>> > hi JingsongLee,
>> > 我在测试ParquetTableSource时遇到一个问题:  我的数据中没有where条件设置的值, 但是打印的结果,
>> > 

Re: ParquetTableSource在blink table planner下的使用问题

2020-02-14 文章 Jark Wu
Hi Jun,

你上传的图片失败了,你可以选择用一些图床工具上传然后将链接贴在这里。或者直接贴文本。

Best,
Jark

On Fri, 14 Feb 2020 at 18:16, jun su  wrote:

> hi JingsongLee,
> 我在测试ParquetTableSource时遇到一个问题:  我的数据中没有where条件设置的值, 但是打印的结果,
> 是将where条件直接赋值给了该字段
>
> [image: image.png]
>
> JingsongLee  于2020年2月14日周五 下午5:05写道:
>
>> Hi jun,
>>
>> pushdown逻辑是批流复用的,应该work的很愉快。
>>
>> Best,
>> Jingsong Lee
>>
>>
>> --
>> From:jun su 
>> Send Time:2020年2月14日(星期五) 17:00
>> To:user-zh 
>> Subject:ParquetTableSource在blink table planner下的使用问题
>>
>> 你好:
>>官网文档中说明Blink Table Planner并不支持BatchTableSource,
>>
>> 目前最新版1.10代码中的ParquetTableSource还是BatchTableSource,那么说明目前的ParquetTableSource还不支持blink
>> table planner ?如果将现有的ParquetTableSource改成StreamTableSource后,
>> pushdown逻辑会不会出现bug?
>>
>


Re: ParquetTableSource在blink table planner下的使用问题

2020-02-14 文章 jun su
hi JingsongLee,
我在测试ParquetTableSource时遇到一个问题:  我的数据中没有where条件设置的值, 但是打印的结果,
是将where条件直接赋值给了该字段

[image: image.png]

JingsongLee  于2020年2月14日周五 下午5:05写道:

> Hi jun,
>
> pushdown逻辑是批流复用的,应该work的很愉快。
>
> Best,
> Jingsong Lee
>
>
> --
> From:jun su 
> Send Time:2020年2月14日(星期五) 17:00
> To:user-zh 
> Subject:ParquetTableSource在blink table planner下的使用问题
>
> 你好:
>官网文档中说明Blink Table Planner并不支持BatchTableSource,
>
> 目前最新版1.10代码中的ParquetTableSource还是BatchTableSource,那么说明目前的ParquetTableSource还不支持blink
> table planner ?如果将现有的ParquetTableSource改成StreamTableSource后,
> pushdown逻辑会不会出现bug?
>