理论上是会调用的。 1) 你的是的哪个版本?blink planner or old planner? 2) 你的 debug query 中有 where 表达式吗?是你上面那个 query 吗?
On Sun, 26 Apr 2020 at 15:31, 王双利 <[email protected]> wrote: > 主要原因是想在查询的时候直接从redis或者数据库中过滤一些数据,要不怕返回的数据太大了。 > > > > 发件人: 王双利 > 发送时间: 2020-04-26 14:55 > 收件人: user-zh > 主题: Re: Re: RichInputFormat 无法得到 查询参数 > > 无法调用 applyPredicate 方法 > 刚才测试了一下 ,是在什么情况下会调用 applyPredicate 方法呢? > 继承例子 如下 > > public class RedisStreamTableSource implements StreamTableSource<Row>, > LookupableTableSource<Row> , FilterableTableSource<Row> { > > 调用RedisStreamTableSource 的相关代码如下 public class RedisTableSourceSinkFactory > implements > StreamTableSourceFactory<Row>, > StreamTableSinkFactory<Tuple2<Boolean, Row>> {-------@Override > public StreamTableSource<Row> createStreamTableSource(Map<String, String> > map) { > DescriptorProperties descriptorProperties = new > DescriptorProperties(true); > descriptorProperties.putProperties(map); > return new > RedisStreamTableSource(map,descriptorProperties.getTableSchema(SCHEMA),getJedisManager(map)); > } > ----- > 发件人: Jark Wu > 发送时间: 2020-04-26 14:36 > 收件人: user-zh > 主题: Re: Re: RichInputFormat 无法得到 查询参数 > You can take this as an example: > > https://github.com/apache/flink/blob/master/flink-formats/flink-parquet/src/main/java/org/apache/flink/formats/parquet/ParquetTableSource.java#L178 > On Sun, 26 Apr 2020 at 14:33, 王双利 <[email protected]> wrote: > > 有例子吗? > > > > > > > > 王双利 > > > > 发件人: Jark Wu > > 发送时间: 2020-04-26 14:28 > > 收件人: user-zh > > 主题: Re: RichInputFormat 无法得到 查询参数 > > 是的。无法拿到。因为 RichInputFormat 是 DataStream 层的 runtime function,不感知 SQL 层的东西。 > > 你的这个需求可以通过 TableSource 实现 FilterableTableSource 来拿到这个下推的 filter 信息。 > > > > Best, > > Jark > > > > On Sun, 26 Apr 2020 at 13:52, 王双利 <[email protected]> wrote: > > > > > RichInputFormat 是不是无法获得 sql中对应的查询参数,比如 select ip,status,count(statusct) > > as > > > ct from ipstatus where ip='123.0.0.1' group by ip,status > > > 这个里面的'123.0.0.1' > > > > > > RichInputFormat > > > 是在StreamTableSourceFactory中的createStreamTableSource的getInputFormat中new > > 出来的 > > > > > >
