You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2021/01/13 09:56:28 UTC

[GitHub] [flink] HuangXingBo opened a new pull request #14628: [FLINK-20954][python] Optimize State with Cross Bundle State Cache In PyFlink

HuangXingBo opened a new pull request #14628:
URL: https://github.com/apache/flink/pull/14628


   ## What is the purpose of the change
   
   *This pull request Optimize State with Cross Bundle State Cache In PyFlink*
   
   ## Brief change log
   
     - *Let StateRequestHandler for user state only use a single cache token*
   
   ## Verifying this change
   
    - *Original Tests*
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (no)
     - The serializers: (no)
     - The runtime per-record code paths (performance sensitive): (no)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
     - The S3 file system connector: (no)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   
   class MeanAggregateFunction(AggregateFunction):
   
       def get_value(self, accumulator: ACC) -> T:
           if accumulator[1] == 0:
               return None
           else:
               return accumulator[0] / accumulator[1]
   
       def create_accumulator(self) -> ACC:
           return [0, 0]
   
       def accumulate(self, accumulator: ACC, *args):
           accumulator[0] += args[0]
           accumulator[1] += 1
   
       def retract(self, accumulator: ACC, *args):
           accumulator[0] -= args[0]
           accumulator[1] -= 1
   
       def merge(self, accumulator: ACC, accumulators):
           for other_acc in accumulators:
               accumulator[0] += other_acc[0]
               accumulator[1] += other_acc[1]
   
       def get_accumulator_type(self) -> DataType:
           return DataTypes.ARRAY(DataTypes.BIGINT())
   
       def get_result_type(self) -> DataType:
           return DataTypes.FLOAT()
   
   ### Test Code
       env = StreamExecutionEnvironment.get_execution_environment()
       env.set_parallelism(1)
       env.set_stream_time_characteristic(TimeCharacteristic.EventTime)
       environment_settings = EnvironmentSettings.new_instance().use_blink_planner().build()
       t_env = StreamTableEnvironment.create(env, environment_settings=environment_settings)
       t_env.get_config().get_configuration().set_integer("python.fn-execution.bundle.time", 1000) 
        t_env.get_config().get_configuration().set_boolean("pipeline.object-reuse", True)
   
       t_env.create_temporary_function("python_avg", MeanAggregateFunction())
       t_env.create_java_temporary_system_function("java_avg", "com.alibaba.flink.function.JavaAvg")
   
       num_rows = 10000000
   
       t_env.execute_sql(f"""
           CREATE TABLE source (
               id INT,
               num INT,
               rowtime TIMESTAMP(3),
               WATERMARK FOR rowtime AS rowtime - INTERVAL '60' MINUTE
           ) WITH (
             'connector' = 'Range',
             'start' = '1',
             'end' = '{num_rows}',
             'step' = '1',
             'partition' = '200'
           )
       """)
       t_env.register_table_sink(
           "sink",
           PrintTableSink(
               ["num", "value"],
               [DataTypes.INT(False), DataTypes.FLOAT(False)], 1000000))
       result = t_env.from_path("source") \
           .select("num % 1000 as num, id") \
           .group_by("num") \
           .select("num, python_avg(id)")
       result.insert_into("sink")
       beg_time = time.time()
       t_env.execute("Python UDF")
       print("PyFlink stream group agg consume time: " + str(time.time() - beg_time))
   
   
   ## Test Results
   num rows, num colums |  Consume Time(Before) | Consume Time(After)
   1000w,3                      |     113.30s                          |    85.93s
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] dianfu merged pull request #14628: [FLINK-20954][python] Support state cache between bundles

Posted by GitBox <gi...@apache.org>.
dianfu merged pull request #14628:
URL: https://github.com/apache/flink/pull/14628


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14628: [FLINK-20954][python] Optimize State with Cross Bundle State Cache In PyFlink

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14628:
URL: https://github.com/apache/flink/pull/14628#issuecomment-759349674


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "status" : "FAILURE",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11978",
       "triggerID" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3d76ae577a595d0c852f2828ca4f94afa3accd03 Azure: [FAILURE](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11978) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14628: [FLINK-20954][python] Support state cache between bundles

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14628:
URL: https://github.com/apache/flink/pull/14628#issuecomment-759339661


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 3d76ae577a595d0c852f2828ca4f94afa3accd03 (Fri May 28 07:06:58 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14628: [FLINK-20954][python] Optimize State with Cross Bundle State Cache In PyFlink

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14628:
URL: https://github.com/apache/flink/pull/14628#issuecomment-759349674


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3d76ae577a595d0c852f2828ca4f94afa3accd03 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot edited a comment on pull request #14628: [FLINK-20954][python] Optimize State with Cross Bundle State Cache In PyFlink

Posted by GitBox <gi...@apache.org>.
flinkbot edited a comment on pull request #14628:
URL: https://github.com/apache/flink/pull/14628#issuecomment-759349674


   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "status" : "PENDING",
       "url" : "https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11978",
       "triggerID" : "3d76ae577a595d0c852f2828ca4f94afa3accd03",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3d76ae577a595d0c852f2828ca4f94afa3accd03 Azure: [PENDING](https://dev.azure.com/apache-flink/98463496-1af2-4620-8eab-a2ecc1a2e6fe/_build/results?buildId=11978) 
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run travis` re-run the last Travis build
    - `@flinkbot run azure` re-run the last Azure build
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [flink] flinkbot commented on pull request #14628: [FLINK-20954][python] Optimize State with Cross Bundle State Cache In PyFlink

Posted by GitBox <gi...@apache.org>.
flinkbot commented on pull request #14628:
URL: https://github.com/apache/flink/pull/14628#issuecomment-759339661


   Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
   to review your pull request. We will use this comment to track the progress of the review.
   
   
   ## Automated Checks
   Last check on commit 3d76ae577a595d0c852f2828ca4f94afa3accd03 (Wed Jan 13 09:58:16 UTC 2021)
   
   **Warnings:**
    * No documentation files were touched! Remember to keep the Flink docs up to date!
    * **This pull request references an unassigned [Jira ticket](https://issues.apache.org/jira/browse/FLINK-20954).** According to the [code contribution guide](https://flink.apache.org/contributing/contribute-code.html), tickets need to be assigned before starting with the implementation work.
   
   
   <sub>Mention the bot in a comment to re-run the automated checks.</sub>
   ## Review Progress
   
   * ❓ 1. The [description] looks good.
   * ❓ 2. There is [consensus] that the contribution should go into to Flink.
   * ❓ 3. Needs [attention] from.
   * ❓ 4. The change fits into the overall [architecture].
   * ❓ 5. Overall code [quality] is good.
   
   Please see the [Pull Request Review Guide](https://flink.apache.org/contributing/reviewing-prs.html) for a full explanation of the review process.<details>
    The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot approve description` to approve one or more aspects (aspects: `description`, `consensus`, `architecture` and `quality`)
    - `@flinkbot approve all` to approve all aspects
    - `@flinkbot approve-until architecture` to approve everything until `architecture`
    - `@flinkbot attention @username1 [@username2 ..]` to require somebody's attention
    - `@flinkbot disapprove architecture` to remove an approval you gave earlier
   </details>


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org