上一个问题补充, 在blink table planner下: select event_name from table => 中文编码没问题
select event_name from table where event_name = 'windows进程创建' => 此时中文编码有问题, 应该是在底层userFunction里将where条件为true时, 直接将where条件赋值给了 输出列,此时出现了编码问题 麻烦查证下 jun su <[email protected]> 于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 <[email protected]> 于2020年2月14日周五 下午6:54写道: > >> 1. 发现ParquetTableSource在flink table planner下, stream/batch 两个模式下都有以上提出的问题, >> 2. blink table planner下没有以上问题, 但是中文print方法有编码问题 >> >> 不清数是不是我使用问题,麻烦查证下 >> >> jun su <[email protected]> 于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 <[email protected]> 于2020年2月14日周五 下午6:25写道: >>> >>>> Hi Jun, >>>> >>>> 你上传的图片失败了,你可以选择用一些图床工具上传然后将链接贴在这里。或者直接贴文本。 >>>> >>>> Best, >>>> Jark >>>> >>>> On Fri, 14 Feb 2020 at 18:16, jun su <[email protected]> wrote: >>>> >>>> > hi JingsongLee, >>>> > 我在测试ParquetTableSource时遇到一个问题: 我的数据中没有where条件设置的值, 但是打印的结果, >>>> > 是将where条件直接赋值给了该字段 >>>> > >>>> > [image: image.png] >>>> > >>>> > JingsongLee <[email protected]> 于2020年2月14日周五 下午5:05写道: >>>> > >>>> >> Hi jun, >>>> >> >>>> >> pushdown逻辑是批流复用的,应该work的很愉快。 >>>> >> >>>> >> Best, >>>> >> Jingsong Lee >>>> >> >>>> >> >>>> >> ------------------------------------------------------------------ >>>> >> From:jun su <[email protected]> >>>> >> Send Time:2020年2月14日(星期五) 17:00 >>>> >> To:user-zh <[email protected]> >>>> >> Subject:ParquetTableSource在blink table planner下的使用问题 >>>> >> >>>> >> 你好: >>>> >> 官网文档中说明Blink Table Planner并不支持BatchTableSource, >>>> >> >>>> >> >>>> 目前最新版1.10代码中的ParquetTableSource还是BatchTableSource,那么说明目前的ParquetTableSource还不支持blink >>>> >> table planner ?如果将现有的ParquetTableSource改成StreamTableSource后, >>>> >> pushdown逻辑会不会出现bug? >>>> >> >>>> > >>>> >>>
