[
https://issues.apache.org/jira/browse/FLINK-11974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826040#comment-16826040
]
Piotr Nowojski edited comment on FLINK-11974 at 4/25/19 12:58 PM:
------------------------------------------------------------------
Yes, I think so. I would see two questions/problems to your poc, for which I
don't have a clear answer yet:
1. Those {{if (node.getOperatorFactory() instanceof SimpleOperatorFactory)}}
are not pretty and they prevent from using the combination of non
{{SimpleOperatorFactory}} with for example {{AbstractUdfStreamOperator}} or
{{OutputTypeConfigurable}}. Could we express the same logic within
{{StreamOperatorFactory}} framework? For example replacing
{code:java}
if (taskOperatorFactory instanceof SimpleOperatorFactory) {
StreamOperator operatorObject = ((SimpleOperatorFactory)
taskOperatorFactory).getOperator();
if (operatorObject instanceof OutputTypeConfigurable && outTypeInfo !=
null) {
...
}
}
{code}
with:
{code:java}
if (taskOperatorFactory.isOutputTypeConfigurable() && outTypeInfo != null) {
}
{code}
or
{code:java}
if (taskOperatorFactory instanceof OutputTypeConfigurableFactory && outTypeInfo
!= null) {
}
{code}
2. {{StreamOperatorFactory#createStreamOperator(...)}} could return already
"setup" operator. We could for example move the {{StreamOperator#setup(...)}}
method to a new interface {{SetupableStreamOperator}} and
{{SetupableStreamOperator}} would be only used in {{SimpleOperatorFactory}}.
However I'm not sure what would be the next clean up step - for example how
much effort and how to actually get rid of {{#setup()}} method from
{{AbstractStreamOperator}}?
was (Author: pnowojski):
Yes, I think so. I would see two questions/problems to your poc, for which I
don't have a clear answer yet:
1. Those {{if (node.getOperatorFactory() instanceof SimpleOperatorFactory)}}
are not pretty and they prevent from using the combination of non
{{SimpleOperatorFactory}} with for example {{AbstractUdfStreamOperator}} or
{{OutputTypeConfigurable}}. Could we express the same logic withing
{{StreamOperatorFactory}} framework? For example replacing
{code:java}
if (taskOperatorFactory instanceof SimpleOperatorFactory) {
StreamOperator operatorObject = ((SimpleOperatorFactory)
taskOperatorFactory).getOperator();
if (operatorObject instanceof OutputTypeConfigurable && outTypeInfo !=
null) {
...
}
}
{code}
with:
{code:java}
if (taskOperatorFactory.isOutputTypeConfigurable() && outTypeInfo != null) {
}
{code}
or
{code:java}
if (taskOperatorFactory instanceof OutputTypeConfigurableFactory && outTypeInfo
!= null) {
}
{code}
2. {{StreamOperatorFactory#createStreamOperator(...)}} could return already
"setup" operator. We could for example move the {{StreamOperator#setup(...)}}
method to a new interface {{SetupableStreamOperator}} and
{{SetupableStreamOperator}} would be only used in {{SimpleOperatorFactory}}.
However I'm not sure what would be the next clean up step - for example how
much effort and how to actually get rid of {{#setup()}} method from
{{AbstractStreamOperator}}?
> Introduce StreamOperatorFactory to help table perform the whole Operator
> CodeGen
> --------------------------------------------------------------------------------
>
> Key: FLINK-11974
> URL: https://issues.apache.org/jira/browse/FLINK-11974
> Project: Flink
> Issue Type: New Feature
> Components: Runtime / Operators
> Reporter: Jingsong Lee
> Assignee: Jingsong Lee
> Priority: Major
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> If we need CodeGen an entire Operator, one possible solution is to introduce
> an OperatorWrapper, then generate a CodeGen sub-Operator in OperatorWrapper's
> open, and then proxy all methods to the sub-Operator. But introduce
> OperatorWrapper results in multiple virtual function calls.
> The another way is to introduce a StreamOperatorFactory. In runtime, we get
> the StreamOperatorFactory and create real operator to invoke. In this way,
> there is no redundant virtual call, the test results show that the
> performance improves by about 10% after the introduction of
> StreamOperatorFactory. (Benchmark for simple query:
> [https://github.com/JingsongLi/flink/blob/benchmarkop/flink-table/flink-table-planner-blink/src/test/java/org/apache/flink/table/benchmark/batch/CalcBenchmark.java])
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)