apache-flink 2.1.0__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. {apache_flink-2.1.0/apache_flink.egg-info → apache_flink-2.2.0}/PKG-INFO +5 -5
  2. {apache_flink-2.1.0 → apache_flink-2.2.0}/README.md +1 -1
  3. {apache_flink-2.1.0 → apache_flink-2.2.0/apache_flink.egg-info}/PKG-INFO +5 -5
  4. {apache_flink-2.1.0 → apache_flink-2.2.0}/apache_flink.egg-info/SOURCES.txt +8 -0
  5. {apache_flink-2.1.0 → apache_flink-2.2.0}/apache_flink.egg-info/requires.txt +3 -3
  6. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/config.sh +2 -0
  7. apache_flink-2.2.0/deps/examples/datastream/asyncio/remote_model_inference.py +150 -0
  8. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/connectors/kafka_avro_format.py +28 -13
  9. apache_flink-2.2.0/deps/examples/datastream/connectors/kafka_bytearray_format.py +102 -0
  10. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/connectors/kafka_csv_format.py +28 -13
  11. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/connectors/kafka_json_format.py +28 -13
  12. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/__init__.py +10 -2
  13. apache_flink-2.2.0/pyflink/datastream/async_data_stream.py +172 -0
  14. apache_flink-2.2.0/pyflink/datastream/async_retry_predicates.py +29 -0
  15. apache_flink-2.2.0/pyflink/datastream/async_retry_strategies.py +121 -0
  16. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/data_stream.py +6 -3
  17. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/functions.py +130 -2
  18. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/window.py +2 -1
  19. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_coder_impl_fast.c +2030 -1912
  20. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_operations_fast.c +6203 -7137
  21. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_operations_fast.pyx +23 -6
  22. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_operations_slow.py +21 -5
  23. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_stream_fast.c +2406 -2301
  24. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/coder_impl_fast.c +11947 -15500
  25. apache_flink-2.2.0/pyflink/fn_execution/datastream/process/async_function/__init__.py +19 -0
  26. apache_flink-2.2.0/pyflink/fn_execution/datastream/process/async_function/operation.py +428 -0
  27. apache_flink-2.2.0/pyflink/fn_execution/datastream/process/async_function/queue.py +448 -0
  28. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/stream_fast.c +2326 -2507
  29. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/aggregate_fast.c +3703 -4292
  30. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_aggregate_fast.c +3273 -3934
  31. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/catalog.py +22 -0
  32. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/expression.py +40 -0
  33. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/expressions.py +36 -3
  34. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_environment.py +13 -0
  35. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/udf.py +0 -4
  36. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/version.py +1 -1
  37. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyproject.toml +50 -0
  38. {apache_flink-2.1.0 → apache_flink-2.2.0}/setup.py +3 -2
  39. {apache_flink-2.1.0 → apache_flink-2.2.0}/LICENSE +0 -0
  40. {apache_flink-2.1.0 → apache_flink-2.2.0}/MANIFEST.in +0 -0
  41. {apache_flink-2.1.0 → apache_flink-2.2.0}/apache_flink.egg-info/dependency_links.txt +0 -0
  42. {apache_flink-2.1.0 → apache_flink-2.2.0}/apache_flink.egg-info/not-zip-safe +0 -0
  43. {apache_flink-2.1.0 → apache_flink-2.2.0}/apache_flink.egg-info/top_level.txt +0 -0
  44. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/bash-java-utils.sh +0 -0
  45. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/config-parser-utils.sh +0 -0
  46. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/find-flink-home.sh +0 -0
  47. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/flink +0 -0
  48. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/flink-console.sh +0 -0
  49. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/flink-daemon.sh +0 -0
  50. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/historyserver.sh +0 -0
  51. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/jobmanager.sh +0 -0
  52. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/kubernetes-jobmanager.sh +0 -0
  53. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/kubernetes-session.sh +0 -0
  54. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/kubernetes-taskmanager.sh +0 -0
  55. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/migrate-config-file.sh +0 -0
  56. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/pyflink-shell.sh +0 -0
  57. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/pyflink-udf-runner.bat +0 -0
  58. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/pyflink-udf-runner.sh +0 -0
  59. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/sql-client.sh +0 -0
  60. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/sql-gateway.sh +0 -0
  61. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/standalone-job.sh +0 -0
  62. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/start-cluster.sh +0 -0
  63. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/start-zookeeper-quorum.sh +0 -0
  64. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/stop-cluster.sh +0 -0
  65. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/stop-zookeeper-quorum.sh +0 -0
  66. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/taskmanager.sh +0 -0
  67. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/yarn-session.sh +0 -0
  68. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/bin/zookeeper.sh +0 -0
  69. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/config.yaml +0 -0
  70. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/log4j-cli.properties +0 -0
  71. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/log4j-console.properties +0 -0
  72. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/log4j-session.properties +0 -0
  73. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/log4j.properties +0 -0
  74. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/logback-console.xml +0 -0
  75. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/logback-session.xml +0 -0
  76. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/logback.xml +0 -0
  77. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/masters +0 -0
  78. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/workers +0 -0
  79. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/conf/zoo.cfg +0 -0
  80. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/basic_operations.py +0 -0
  81. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/connectors/elasticsearch.py +0 -0
  82. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/connectors/pulsar.py +0 -0
  83. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/event_time_timer.py +0 -0
  84. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/process_json_data.py +0 -0
  85. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/state_access.py +0 -0
  86. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/streaming_word_count.py +0 -0
  87. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/windowing/session_with_dynamic_gap_window.py +0 -0
  88. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/windowing/session_with_gap_window.py +0 -0
  89. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/windowing/sliding_time_window.py +0 -0
  90. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/windowing/tumbling_count_window.py +0 -0
  91. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/windowing/tumbling_time_window.py +0 -0
  92. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/datastream/word_count.py +0 -0
  93. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/basic_operations.py +0 -0
  94. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/mixing_use_of_datastream_and_table.py +0 -0
  95. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/multi_sink.py +0 -0
  96. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/pandas/conversion_from_dataframe.py +0 -0
  97. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/pandas/pandas_udaf.py +0 -0
  98. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/process_json_data.py +0 -0
  99. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/process_json_data_with_udf.py +0 -0
  100. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/streaming_word_count.py +0 -0
  101. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/windowing/over_window.py +0 -0
  102. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/windowing/session_window.py +0 -0
  103. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/windowing/sliding_window.py +0 -0
  104. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/windowing/tumble_window.py +0 -0
  105. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/examples/table/word_count.py +0 -0
  106. {apache_flink-2.1.0 → apache_flink-2.2.0}/deps/log/empty.txt +0 -0
  107. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/README.txt +0 -0
  108. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/__init__.py +0 -0
  109. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/__init__.py +0 -0
  110. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/completable_future.py +0 -0
  111. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/config_options.py +0 -0
  112. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/configuration.py +0 -0
  113. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/constants.py +0 -0
  114. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/execution_config.py +0 -0
  115. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/input_dependency_constraint.py +0 -0
  116. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/io.py +0 -0
  117. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/job_client.py +0 -0
  118. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/job_execution_result.py +0 -0
  119. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/job_id.py +0 -0
  120. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/job_status.py +0 -0
  121. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/restart_strategy.py +0 -0
  122. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/serialization.py +0 -0
  123. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/serializer.py +0 -0
  124. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/time.py +0 -0
  125. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/typeinfo.py +0 -0
  126. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/types.py +0 -0
  127. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/utils.py +0 -0
  128. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/common/watermark_strategy.py +0 -0
  129. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/checkpoint_config.py +0 -0
  130. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/checkpoint_storage.py +0 -0
  131. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/checkpointing_mode.py +0 -0
  132. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/__init__.py +0 -0
  133. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/base.py +0 -0
  134. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/cassandra.py +0 -0
  135. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/elasticsearch.py +0 -0
  136. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/file_system.py +0 -0
  137. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/hybrid_source.py +0 -0
  138. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/jdbc.py +0 -0
  139. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/kafka.py +0 -0
  140. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/kinesis.py +0 -0
  141. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/number_seq.py +0 -0
  142. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/pulsar.py +0 -0
  143. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/connectors/rabbitmq.py +0 -0
  144. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/execution_mode.py +0 -0
  145. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/externalized_checkpoint_retention.py +0 -0
  146. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/__init__.py +0 -0
  147. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/avro.py +0 -0
  148. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/csv.py +0 -0
  149. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/json.py +0 -0
  150. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/orc.py +0 -0
  151. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/formats/parquet.py +0 -0
  152. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/output_tag.py +0 -0
  153. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/slot_sharing_group.py +0 -0
  154. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/state.py +0 -0
  155. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/state_backend.py +0 -0
  156. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/stream_execution_environment.py +0 -0
  157. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/time_domain.py +0 -0
  158. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/timerservice.py +0 -0
  159. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/datastream/utils.py +0 -0
  160. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/find_flink_home.py +0 -0
  161. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/ResettableIO.py +0 -0
  162. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/__init__.py +0 -0
  163. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/__init__.py +0 -0
  164. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_boot.py +0 -0
  165. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_coder_impl_fast.pxd +0 -0
  166. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_coder_impl_fast.pyx +0 -0
  167. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_coder_impl_slow.py +0 -0
  168. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_coders.py +0 -0
  169. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_operations.py +0 -0
  170. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_operations_fast.pxd +0 -0
  171. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_sdk_worker_main.py +0 -0
  172. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_stream_fast.pxd +0 -0
  173. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_stream_fast.pyx +0 -0
  174. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_stream_slow.py +0 -0
  175. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/beam/beam_worker_pool_service.py +0 -0
  176. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/coder_impl_fast.pxd +0 -0
  177. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/coder_impl_fast.pyx +0 -0
  178. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/coder_impl_slow.py +0 -0
  179. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/coders.py +0 -0
  180. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/__init__.py +0 -0
  181. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/__init__.py +0 -0
  182. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/operations.py +0 -0
  183. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/process_function.py +0 -0
  184. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/runtime_context.py +0 -0
  185. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/side_output_context.py +0 -0
  186. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/state_impl.py +0 -0
  187. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/embedded/timerservice_impl.py +0 -0
  188. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/operations.py +0 -0
  189. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/__init__.py +0 -0
  190. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/input_handler.py +0 -0
  191. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/operations.py +0 -0
  192. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/process_function.py +0 -0
  193. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/runtime_context.py +0 -0
  194. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/process/timerservice_impl.py +0 -0
  195. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/timerservice.py +0 -0
  196. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/window/__init__.py +0 -0
  197. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/window/merging_window_set.py +0 -0
  198. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/datastream/window/window_operator.py +0 -0
  199. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/__init__.py +0 -0
  200. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/converters.py +0 -0
  201. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/java_utils.py +0 -0
  202. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/operation_utils.py +0 -0
  203. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/operations.py +0 -0
  204. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/embedded/state_impl.py +0 -0
  205. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/flink_fn_execution_pb2.py +0 -0
  206. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/flink_fn_execution_pb2.pyi +0 -0
  207. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/formats/__init__.py +0 -0
  208. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/formats/avro.py +0 -0
  209. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/internal_state.py +0 -0
  210. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/__init__.py +0 -0
  211. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/embedded/__init__.py +0 -0
  212. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/embedded/counter_impl.py +0 -0
  213. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/embedded/distribution_impl.py +0 -0
  214. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/embedded/meter_impl.py +0 -0
  215. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/embedded/metric_impl.py +0 -0
  216. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/process/__init__.py +0 -0
  217. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/process/counter_impl.py +0 -0
  218. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/process/distribution_impl.py +0 -0
  219. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/process/meter_impl.py +0 -0
  220. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/metrics/process/metric_impl.py +0 -0
  221. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/pickle.py +0 -0
  222. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/profiler.py +0 -0
  223. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/state_impl.py +0 -0
  224. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/stream_fast.pxd +0 -0
  225. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/stream_fast.pyx +0 -0
  226. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/stream_slow.py +0 -0
  227. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/__init__.py +0 -0
  228. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/aggregate_fast.pxd +0 -0
  229. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/aggregate_fast.pyx +0 -0
  230. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/aggregate_slow.py +0 -0
  231. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/operations.py +0 -0
  232. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/state_data_view.py +0 -0
  233. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_aggregate_fast.pxd +0 -0
  234. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_aggregate_fast.pyx +0 -0
  235. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_aggregate_slow.py +0 -0
  236. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_assigner.py +0 -0
  237. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_context.py +0 -0
  238. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_process_function.py +0 -0
  239. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/table/window_trigger.py +0 -0
  240. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/utils/__init__.py +0 -0
  241. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/fn_execution/utils/operation_utils.py +0 -0
  242. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/gen_protos.py +0 -0
  243. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/java_gateway.py +0 -0
  244. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/metrics/__init__.py +0 -0
  245. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/metrics/metricbase.py +0 -0
  246. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/pyflink_callback_server.py +0 -0
  247. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/pyflink_gateway_server.py +0 -0
  248. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/serializers.py +0 -0
  249. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/shell.py +0 -0
  250. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/__init__.py +0 -0
  251. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/changelog_mode.py +0 -0
  252. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/compiled_plan.py +0 -0
  253. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/data_view.py +0 -0
  254. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/descriptors.py +0 -0
  255. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/environment_settings.py +0 -0
  256. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/explain_detail.py +0 -0
  257. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/functions.py +0 -0
  258. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/model_descriptor.py +0 -0
  259. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/module.py +0 -0
  260. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/plan_reference.py +0 -0
  261. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/resolved_expression.py +0 -0
  262. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/result_kind.py +0 -0
  263. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/schema.py +0 -0
  264. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/serializers.py +0 -0
  265. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/sql_dialect.py +0 -0
  266. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/statement_set.py +0 -0
  267. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table.py +0 -0
  268. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_config.py +0 -0
  269. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_descriptor.py +0 -0
  270. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_pipeline.py +0 -0
  271. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_result.py +0 -0
  272. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/table_schema.py +0 -0
  273. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/types.py +0 -0
  274. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/utils.py +0 -0
  275. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/table/window.py +0 -0
  276. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/testing/__init__.py +0 -0
  277. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/testing/source_sink_utils.py +0 -0
  278. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/testing/test_case_utils.py +0 -0
  279. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/util/__init__.py +0 -0
  280. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/util/api_stability_decorators.py +0 -0
  281. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/util/exceptions.py +0 -0
  282. {apache_flink-2.1.0 → apache_flink-2.2.0}/pyflink/util/java_utils.py +0 -0
  283. {apache_flink-2.1.0 → apache_flink-2.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-flink
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Apache Flink Python API
5
5
  Home-page: https://flink.apache.org
6
6
  Author: Apache Software Foundation
@@ -25,12 +25,12 @@ Requires-Dist: fastavro!=1.8.0,>=1.1.0
25
25
  Requires-Dist: requests>=2.26.0
26
26
  Requires-Dist: protobuf>=3.19.0
27
27
  Requires-Dist: numpy>=1.22.4
28
- Requires-Dist: pandas>=1.3.0
28
+ Requires-Dist: pandas<2.3,>=1.3.0
29
29
  Requires-Dist: pyarrow<21.0.0,>=5.0.0
30
- Requires-Dist: pemja<0.5.4,>=0.5.0; platform_system != "Windows"
30
+ Requires-Dist: pemja<0.5.6,>=0.5.5; platform_system != "Windows"
31
31
  Requires-Dist: httplib2>=0.19.0
32
32
  Requires-Dist: ruamel.yaml>=0.18.4
33
- Requires-Dist: apache-flink-libraries<2.1.1,>=2.1.0
33
+ Requires-Dist: apache-flink-libraries<2.2.1,>=2.2.0
34
34
  Dynamic: author
35
35
  Dynamic: author-email
36
36
  Dynamic: classifier
@@ -112,6 +112,6 @@ Then you can activate your environment and run tests, for example:
112
112
 
113
113
  ```shell
114
114
  source pyflink_39/bin/activate
115
- uv pip install -r ./dev/dev-requirements.txt
115
+ uv pip install --group dev
116
116
  ./dev/lint-python.sh
117
117
  ```
@@ -67,6 +67,6 @@ Then you can activate your environment and run tests, for example:
67
67
 
68
68
  ```shell
69
69
  source pyflink_39/bin/activate
70
- uv pip install -r ./dev/dev-requirements.txt
70
+ uv pip install --group dev
71
71
  ./dev/lint-python.sh
72
72
  ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-flink
3
- Version: 2.1.0
3
+ Version: 2.2.0
4
4
  Summary: Apache Flink Python API
5
5
  Home-page: https://flink.apache.org
6
6
  Author: Apache Software Foundation
@@ -25,12 +25,12 @@ Requires-Dist: fastavro!=1.8.0,>=1.1.0
25
25
  Requires-Dist: requests>=2.26.0
26
26
  Requires-Dist: protobuf>=3.19.0
27
27
  Requires-Dist: numpy>=1.22.4
28
- Requires-Dist: pandas>=1.3.0
28
+ Requires-Dist: pandas<2.3,>=1.3.0
29
29
  Requires-Dist: pyarrow<21.0.0,>=5.0.0
30
- Requires-Dist: pemja<0.5.4,>=0.5.0; platform_system != "Windows"
30
+ Requires-Dist: pemja<0.5.6,>=0.5.5; platform_system != "Windows"
31
31
  Requires-Dist: httplib2>=0.19.0
32
32
  Requires-Dist: ruamel.yaml>=0.18.4
33
- Requires-Dist: apache-flink-libraries<2.1.1,>=2.1.0
33
+ Requires-Dist: apache-flink-libraries<2.2.1,>=2.2.0
34
34
  Dynamic: author
35
35
  Dynamic: author-email
36
36
  Dynamic: classifier
@@ -112,6 +112,6 @@ Then you can activate your environment and run tests, for example:
112
112
 
113
113
  ```shell
114
114
  source pyflink_39/bin/activate
115
- uv pip install -r ./dev/dev-requirements.txt
115
+ uv pip install --group dev
116
116
  ./dev/lint-python.sh
117
117
  ```
@@ -53,8 +53,10 @@ deps/examples/datastream/process_json_data.py
53
53
  deps/examples/datastream/state_access.py
54
54
  deps/examples/datastream/streaming_word_count.py
55
55
  deps/examples/datastream/word_count.py
56
+ deps/examples/datastream/asyncio/remote_model_inference.py
56
57
  deps/examples/datastream/connectors/elasticsearch.py
57
58
  deps/examples/datastream/connectors/kafka_avro_format.py
59
+ deps/examples/datastream/connectors/kafka_bytearray_format.py
58
60
  deps/examples/datastream/connectors/kafka_csv_format.py
59
61
  deps/examples/datastream/connectors/kafka_json_format.py
60
62
  deps/examples/datastream/connectors/pulsar.py
@@ -108,6 +110,9 @@ pyflink/common/types.py
108
110
  pyflink/common/utils.py
109
111
  pyflink/common/watermark_strategy.py
110
112
  pyflink/datastream/__init__.py
113
+ pyflink/datastream/async_data_stream.py
114
+ pyflink/datastream/async_retry_predicates.py
115
+ pyflink/datastream/async_retry_strategies.py
111
116
  pyflink/datastream/checkpoint_config.py
112
117
  pyflink/datastream/checkpoint_storage.py
113
118
  pyflink/datastream/checkpointing_mode.py
@@ -193,6 +198,9 @@ pyflink/fn_execution/datastream/process/operations.py
193
198
  pyflink/fn_execution/datastream/process/process_function.py
194
199
  pyflink/fn_execution/datastream/process/runtime_context.py
195
200
  pyflink/fn_execution/datastream/process/timerservice_impl.py
201
+ pyflink/fn_execution/datastream/process/async_function/__init__.py
202
+ pyflink/fn_execution/datastream/process/async_function/operation.py
203
+ pyflink/fn_execution/datastream/process/async_function/queue.py
196
204
  pyflink/fn_execution/datastream/window/__init__.py
197
205
  pyflink/fn_execution/datastream/window/merging_window_set.py
198
206
  pyflink/fn_execution/datastream/window/window_operator.py
@@ -8,11 +8,11 @@ fastavro!=1.8.0,>=1.1.0
8
8
  requests>=2.26.0
9
9
  protobuf>=3.19.0
10
10
  numpy>=1.22.4
11
- pandas>=1.3.0
11
+ pandas<2.3,>=1.3.0
12
12
  pyarrow<21.0.0,>=5.0.0
13
13
  httplib2>=0.19.0
14
14
  ruamel.yaml>=0.18.4
15
- apache-flink-libraries<2.1.1,>=2.1.0
15
+ apache-flink-libraries<2.2.1,>=2.2.0
16
16
 
17
17
  [:platform_system != "Windows"]
18
- pemja<0.5.4,>=0.5.0
18
+ pemja<0.5.6,>=0.5.5
@@ -240,6 +240,8 @@ fi
240
240
 
241
241
  if [ -z "${MAX_LOG_FILE_NUMBER}" ]; then
242
242
  MAX_LOG_FILE_NUMBER=$(readFromConfig ${KEY_ENV_LOG_MAX} ${DEFAULT_ENV_LOG_MAX} "${YAML_CONF}")
243
+ # Remove leading and ending single quotes (if present) of value
244
+ MAX_LOG_FILE_NUMBER="$( echo "${MAX_LOG_FILE_NUMBER}" | sed -e "s/^'//" -e "s/'$//" )"
243
245
  export MAX_LOG_FILE_NUMBER
244
246
  fi
245
247
 
@@ -0,0 +1,150 @@
1
+ ################################################################################
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ ################################################################################
18
+ import argparse
19
+ import asyncio
20
+ import functools
21
+ import json
22
+ import logging
23
+ import random
24
+ import sys
25
+ from typing import List
26
+
27
+ from pyflink.common import Encoder, Types, Time, Row
28
+ from pyflink.datastream import StreamExecutionEnvironment, AsyncDataStream, AsyncFunction, \
29
+ RuntimeContext, AsyncRetryStrategy, async_retry_predicates, CheckpointingMode
30
+ from pyflink.datastream.connectors.file_system import (FileSink, OutputFileConfig, RollingPolicy)
31
+ from pyflink.table import StreamTableEnvironment, TableDescriptor, Schema, DataTypes
32
+
33
+
34
+ class AsyncLLMRequest(AsyncFunction[Row, str]):
35
+
36
+ def __init__(self):
37
+ self.retried_keys = {}
38
+
39
+ def open(self, runtime_context: RuntimeContext):
40
+ # create model inference client here
41
+ pass
42
+
43
+ def close(self):
44
+ # close the model inference client here
45
+ pass
46
+
47
+ async def async_invoke(self, value: Row) -> List[str]:
48
+ # issue the asynchronous request
49
+ await asyncio.sleep(random.randint(1, 2))
50
+
51
+ if value.user_id not in self.retried_keys and random.randint(1, 10) % 3 == 0:
52
+ self.retried_keys[value.user_id] = True
53
+ # remote model inference request may time out
54
+ raise TimeoutError
55
+ else:
56
+ if value.user_id in self.retried_keys:
57
+ del self.retried_keys[value.user_id]
58
+ # remote model inference request completes
59
+ # note that the result should be a collection even there is only one result
60
+ analysis_result = "positive"
61
+ result = {
62
+ "user_id": value.user_id,
63
+ "comments": value.comments,
64
+ "analysis_result": analysis_result
65
+ }
66
+ return [json.dumps(result)]
67
+
68
+ def timeout(self, value: Row) -> List[str]:
69
+ # return a default value in case timeout
70
+ result = {
71
+ "user_id": value.user_id,
72
+ "comments": value.comments,
73
+ "analysis_result": None
74
+ }
75
+ return [json.dumps(result)]
76
+
77
+
78
+ def main(output_path):
79
+ env = StreamExecutionEnvironment.get_execution_environment()
80
+ env.enable_checkpointing(30000, CheckpointingMode.EXACTLY_ONCE)
81
+ t_env = StreamTableEnvironment.create(stream_execution_environment=env)
82
+
83
+ # source: user_id, comments
84
+ t_env.create_temporary_table(
85
+ 'source',
86
+ TableDescriptor.for_connector('datagen')
87
+ .schema(Schema.new_builder()
88
+ .column('user_id', DataTypes.INT())
89
+ .column('comments', DataTypes.STRING())
90
+ .build())
91
+ .option('fields.user_id.kind', 'random')
92
+ .option('fields.comments.kind', 'random')
93
+ .option('rows-per-second', '100')
94
+ .build())
95
+
96
+ table = t_env.from_path('source')
97
+ ds = t_env.to_data_stream(table)
98
+
99
+ # create an async retry strategy via utility class or a user defined strategy
100
+ async_retry_strategy = AsyncRetryStrategy.fixed_delay(
101
+ max_attempts=100,
102
+ backoff_time_millis=1000,
103
+ result_predicate=None,
104
+ exception_predicate=functools.partial(async_retry_predicates.exception_type_predicate,
105
+ expected_error_type=TimeoutError))
106
+
107
+ result_stream = AsyncDataStream.unordered_wait_with_retry(
108
+ data_stream=ds,
109
+ async_function=AsyncLLMRequest(),
110
+ timeout=Time.seconds(10),
111
+ async_retry_strategy=async_retry_strategy,
112
+ capacity=1000,
113
+ output_type=Types.STRING())
114
+
115
+ # define the sink
116
+ if output_path is not None:
117
+ result_stream.sink_to(
118
+ sink=FileSink.for_row_format(
119
+ base_path=output_path,
120
+ encoder=Encoder.simple_string_encoder())
121
+ .with_output_file_config(
122
+ OutputFileConfig.builder()
123
+ .with_part_prefix("prefix")
124
+ .with_part_suffix(".ext")
125
+ .build())
126
+ .with_rolling_policy(RollingPolicy.default_rolling_policy())
127
+ .build()
128
+ )
129
+ else:
130
+ print("Printing result to stdout. Use --output to specify output path.")
131
+ result_stream.print()
132
+
133
+ # submit for execution
134
+ env.execute()
135
+
136
+
137
+ if __name__ == '__main__':
138
+ logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(message)s")
139
+
140
+ parser = argparse.ArgumentParser()
141
+ parser.add_argument(
142
+ '--output',
143
+ dest='output',
144
+ required=False,
145
+ help='Output file to write results to.')
146
+
147
+ argv = sys.argv[1:]
148
+ known_args, _ = parser.parse_known_args(argv)
149
+
150
+ main(known_args.output)
@@ -18,9 +18,10 @@
18
18
  import logging
19
19
  import sys
20
20
 
21
- from pyflink.common import Types
21
+ from pyflink.common import Types, WatermarkStrategy
22
22
  from pyflink.datastream import StreamExecutionEnvironment
23
- from pyflink.datastream.connectors.kafka import FlinkKafkaProducer, FlinkKafkaConsumer
23
+ from pyflink.datastream.connectors.kafka import (KafkaRecordSerializationSchema, KafkaSink,
24
+ KafkaSource, KafkaOffsetsInitializer)
24
25
  from pyflink.datastream.formats.avro import AvroRowSerializationSchema, AvroRowDeserializationSchema
25
26
 
26
27
 
@@ -43,14 +44,20 @@ def write_to_kafka(env):
43
44
  }"""
44
45
  )
45
46
 
46
- kafka_producer = FlinkKafkaProducer(
47
- topic='test_avro_topic',
48
- serialization_schema=serialization_schema,
49
- producer_config={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group'}
47
+ record_serializer = KafkaRecordSerializationSchema.builder() \
48
+ .set_topic('test_avro_topic') \
49
+ .set_value_serialization_schema(serialization_schema) \
50
+ .build()
51
+ kafka_sink = (
52
+ KafkaSink.builder()
53
+ .set_record_serializer(record_serializer)
54
+ .set_bootstrap_servers('localhost:9092')
55
+ .set_property("group.id", "test_group")
56
+ .build()
50
57
  )
51
58
 
52
59
  # note that the output type of ds must be RowTypeInfo
53
- ds.add_sink(kafka_producer)
60
+ ds.sink_to(kafka_sink)
54
61
  env.execute()
55
62
 
56
63
 
@@ -67,14 +74,22 @@ def read_from_kafka(env):
67
74
  }"""
68
75
  )
69
76
 
70
- kafka_consumer = FlinkKafkaConsumer(
71
- topics='test_avro_topic',
72
- deserialization_schema=deserialization_schema,
73
- properties={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'}
77
+ kafka_source = (
78
+ KafkaSource.builder()
79
+ .set_topics('test_avro_topic')
80
+ .set_value_only_deserializer(deserialization_schema)
81
+ .set_properties({'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'})
82
+ .set_starting_offsets(KafkaOffsetsInitializer.earliest())
83
+ .build()
74
84
  )
75
- kafka_consumer.set_start_from_earliest()
76
85
 
77
- env.add_source(kafka_consumer).print()
86
+ ds = env.from_source(
87
+ kafka_source,
88
+ watermark_strategy=WatermarkStrategy.no_watermarks(),
89
+ source_name="kafka source"
90
+ )
91
+
92
+ ds.print()
78
93
  env.execute()
79
94
 
80
95
 
@@ -0,0 +1,102 @@
1
+ ################################################################################
2
+ # Licensed to the Apache Software Foundation (ASF) under one
3
+ # or more contributor license agreements. See the NOTICE file
4
+ # distributed with this work for additional information
5
+ # regarding copyright ownership. The ASF licenses this file
6
+ # to you under the Apache License, Version 2.0 (the
7
+ # "License"); you may not use this file except in compliance
8
+ # with the License. You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ ################################################################################
18
+ import json
19
+ import logging
20
+ import sys
21
+
22
+ from pyflink.common import Types, ByteArraySchema, WatermarkStrategy
23
+ from pyflink.datastream import StreamExecutionEnvironment
24
+ from pyflink.datastream.connectors.kafka import KafkaSource, \
25
+ KafkaOffsetsInitializer, KafkaSink, KafkaRecordSerializationSchema
26
+
27
+
28
+ # This example works since Flink 2.0 since ByteArraySchema was introduced in Flink 2.0
29
+
30
+ # Make sure that the Kafka cluster is started and the topic 'test_json_topic' is
31
+ # created before executing this job.
32
+ def write_to_kafka(env):
33
+ data = [
34
+ (json.dumps({
35
+ "id": 1,
36
+ "country": "USA"
37
+ }).encode("utf-8"),),
38
+ (json.dumps({
39
+ "id": 2,
40
+ "country": "Canada"
41
+ }).encode("utf-8"),),
42
+ (json.dumps({
43
+ "id": 3,
44
+ "country": "Germany"
45
+ }).encode("utf-8"),)
46
+ ]
47
+ type_info = Types.ROW([Types.PRIMITIVE_ARRAY(Types.BYTE())])
48
+ ds = env.from_collection(data, type_info=type_info)
49
+
50
+ # declare the output type as Types.PRIMITIVE_ARRAY(Types.BYTE()),
51
+ # otherwise, Types.PICKLED_BYTE_ARRAY() will be used by default, it will
52
+ # use pickler to serialize the result byte array which is unnecessary
53
+ ds = ds.map(lambda x: x[0], output_type=Types.PRIMITIVE_ARRAY(Types.BYTE()))
54
+
55
+ record_serializer = KafkaRecordSerializationSchema.builder() \
56
+ .set_topic('test_bytearray_topic') \
57
+ .set_value_serialization_schema(ByteArraySchema()) \
58
+ .build()
59
+ kafka_sink = (
60
+ KafkaSink.builder()
61
+ .set_record_serializer(record_serializer)
62
+ .set_bootstrap_servers('localhost:9092')
63
+ .set_property("group.id", "test_group")
64
+ .build()
65
+ )
66
+
67
+ ds.sink_to(kafka_sink)
68
+ env.execute()
69
+
70
+
71
+ def read_from_kafka(env):
72
+ kafka_source = (
73
+ KafkaSource.builder()
74
+ .set_topics('test_bytearray_topic')
75
+ .set_value_only_deserializer(ByteArraySchema())
76
+ .set_properties({'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'})
77
+ .set_starting_offsets(KafkaOffsetsInitializer.earliest())
78
+ .build()
79
+ )
80
+
81
+ ds = env.from_source(
82
+ kafka_source,
83
+ watermark_strategy=WatermarkStrategy.no_watermarks(),
84
+ source_name="kafka source"
85
+ )
86
+
87
+ # the data read out from the source is byte array, decode it as a string
88
+ ds.map(lambda data: data.decode("utf-8")).print()
89
+ env.execute()
90
+
91
+
92
+ if __name__ == '__main__':
93
+ logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(message)s")
94
+
95
+ env = StreamExecutionEnvironment.get_execution_environment()
96
+ env.add_jars("file:///path/to/flink-sql-connector-kafka-1.15.0.jar")
97
+
98
+ print("start writing data to kafka")
99
+ write_to_kafka(env)
100
+
101
+ print("start reading data from kafka")
102
+ read_from_kafka(env)
@@ -18,9 +18,10 @@
18
18
  import logging
19
19
  import sys
20
20
 
21
- from pyflink.common import Types
21
+ from pyflink.common import Types, WatermarkStrategy
22
22
  from pyflink.datastream import StreamExecutionEnvironment
23
- from pyflink.datastream.connectors.kafka import FlinkKafkaProducer, FlinkKafkaConsumer
23
+ from pyflink.datastream.connectors.kafka import (KafkaRecordSerializationSchema, KafkaSink,
24
+ KafkaSource, KafkaOffsetsInitializer)
24
25
  from pyflink.datastream.formats.csv import CsvRowSerializationSchema, CsvRowDeserializationSchema
25
26
 
26
27
 
@@ -33,14 +34,20 @@ def write_to_kafka(env):
33
34
  type_info=type_info)
34
35
 
35
36
  serialization_schema = CsvRowSerializationSchema.Builder(type_info).build()
36
- kafka_producer = FlinkKafkaProducer(
37
- topic='test_csv_topic',
38
- serialization_schema=serialization_schema,
39
- producer_config={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group'}
37
+ record_serializer = KafkaRecordSerializationSchema.builder() \
38
+ .set_topic('test_csv_topic') \
39
+ .set_value_serialization_schema(serialization_schema) \
40
+ .build()
41
+ kafka_sink = (
42
+ KafkaSink.builder()
43
+ .set_record_serializer(record_serializer)
44
+ .set_bootstrap_servers('localhost:9092')
45
+ .set_property("group.id", "test_group")
46
+ .build()
40
47
  )
41
48
 
42
49
  # note that the output type of ds must be RowTypeInfo
43
- ds.add_sink(kafka_producer)
50
+ ds.sink_to(kafka_sink)
44
51
  env.execute()
45
52
 
46
53
 
@@ -48,14 +55,22 @@ def read_from_kafka(env):
48
55
  type_info = Types.ROW([Types.INT(), Types.STRING()])
49
56
  deserialization_schema = CsvRowDeserializationSchema.Builder(type_info).build()
50
57
 
51
- kafka_consumer = FlinkKafkaConsumer(
52
- topics='test_csv_topic',
53
- deserialization_schema=deserialization_schema,
54
- properties={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'}
58
+ kafka_source = (
59
+ KafkaSource.builder()
60
+ .set_topics('test_csv_topic')
61
+ .set_value_only_deserializer(deserialization_schema)
62
+ .set_properties({'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'})
63
+ .set_starting_offsets(KafkaOffsetsInitializer.earliest())
64
+ .build()
55
65
  )
56
- kafka_consumer.set_start_from_earliest()
57
66
 
58
- env.add_source(kafka_consumer).print()
67
+ ds = env.from_source(
68
+ kafka_source,
69
+ watermark_strategy=WatermarkStrategy.no_watermarks(),
70
+ source_name="kafka source"
71
+ )
72
+
73
+ ds.print()
59
74
  env.execute()
60
75
 
61
76
 
@@ -18,9 +18,10 @@
18
18
  import logging
19
19
  import sys
20
20
 
21
- from pyflink.common import Types
21
+ from pyflink.common import Types, WatermarkStrategy
22
22
  from pyflink.datastream import StreamExecutionEnvironment
23
- from pyflink.datastream.connectors.kafka import FlinkKafkaProducer, FlinkKafkaConsumer
23
+ from pyflink.datastream.connectors.kafka import (KafkaRecordSerializationSchema, KafkaSink,
24
+ KafkaSource, KafkaOffsetsInitializer)
24
25
  from pyflink.datastream.formats.json import JsonRowSerializationSchema, JsonRowDeserializationSchema
25
26
 
26
27
 
@@ -35,14 +36,20 @@ def write_to_kafka(env):
35
36
  serialization_schema = JsonRowSerializationSchema.Builder() \
36
37
  .with_type_info(type_info) \
37
38
  .build()
38
- kafka_producer = FlinkKafkaProducer(
39
- topic='test_json_topic',
40
- serialization_schema=serialization_schema,
41
- producer_config={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group'}
39
+ record_serializer = KafkaRecordSerializationSchema.builder() \
40
+ .set_topic('test_json_topic') \
41
+ .set_value_serialization_schema(serialization_schema) \
42
+ .build()
43
+ kafka_sink = (
44
+ KafkaSink.builder()
45
+ .set_record_serializer(record_serializer)
46
+ .set_bootstrap_servers('localhost:9092')
47
+ .set_property("group.id", "test_group")
48
+ .build()
42
49
  )
43
50
 
44
51
  # note that the output type of ds must be RowTypeInfo
45
- ds.add_sink(kafka_producer)
52
+ ds.sink_to(kafka_sink)
46
53
  env.execute()
47
54
 
48
55
 
@@ -50,14 +57,22 @@ def read_from_kafka(env):
50
57
  deserialization_schema = JsonRowDeserializationSchema.Builder() \
51
58
  .type_info(Types.ROW([Types.INT(), Types.STRING()])) \
52
59
  .build()
53
- kafka_consumer = FlinkKafkaConsumer(
54
- topics='test_json_topic',
55
- deserialization_schema=deserialization_schema,
56
- properties={'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'}
60
+ kafka_source = (
61
+ KafkaSource.builder()
62
+ .set_topics('test_json_topic')
63
+ .set_value_only_deserializer(deserialization_schema)
64
+ .set_properties({'bootstrap.servers': 'localhost:9092', 'group.id': 'test_group_1'})
65
+ .set_starting_offsets(KafkaOffsetsInitializer.earliest())
66
+ .build()
67
+ )
68
+
69
+ ds = env.from_source(
70
+ kafka_source,
71
+ watermark_strategy=WatermarkStrategy.no_watermarks(),
72
+ source_name="kafka source"
57
73
  )
58
- kafka_consumer.set_start_from_earliest()
59
74
 
60
- env.add_source(kafka_consumer).print()
75
+ ds.print()
61
76
  env.execute()
62
77
 
63
78
 
@@ -82,6 +82,8 @@ Functions used to transform a :class:`DataStream` into another :class:`DataStrea
82
82
  - :class:`KeyedBroadcastProcessFunction`:
83
83
  A function to be applied to a :class:`BroadcastConnectedStream` that connects
84
84
  :class:`BroadcastStream`, i.e. a stream with broadcast state, with a :class:`KeyedStream`.
85
+ - :class:`AsyncFunction`:
86
+ A function to trigger Async I/O operation.
85
87
  - :class:`RuntimeContext`:
86
88
  Contains information about the context in which functions are executed. Each
87
89
  parallel instance of the function will have a context through which it can access static
@@ -256,6 +258,7 @@ Other important classes:
256
258
  - :class:`OutputTag`:
257
259
  Tag with a name and type for identifying side output of an operator
258
260
  """
261
+ from pyflink.datastream.async_data_stream import AsyncDataStream
259
262
  from pyflink.datastream.checkpoint_config import CheckpointConfig
260
263
  from pyflink.datastream.externalized_checkpoint_retention import ExternalizedCheckpointRetention
261
264
  from pyflink.datastream.checkpointing_mode import CheckpointingMode
@@ -268,7 +271,8 @@ from pyflink.datastream.functions import (MapFunction, CoMapFunction, FlatMapFun
268
271
  SinkFunction, CoProcessFunction, KeyedProcessFunction,
269
272
  KeyedCoProcessFunction, AggregateFunction, WindowFunction,
270
273
  ProcessWindowFunction, BroadcastProcessFunction,
271
- KeyedBroadcastProcessFunction)
274
+ KeyedBroadcastProcessFunction, AsyncFunction,
275
+ AsyncRetryPredicate, AsyncRetryStrategy)
272
276
  from pyflink.datastream.slot_sharing_group import SlotSharingGroup, MemorySize
273
277
  from pyflink.datastream.state_backend import (StateBackend, CustomStateBackend,
274
278
  PredefinedOptions, HashMapStateBackend,
@@ -292,6 +296,7 @@ __all__ = [
292
296
  'ConnectedStreams',
293
297
  'BroadcastStream',
294
298
  'BroadcastConnectedStream',
299
+ 'AsyncDataStream',
295
300
  'DataStreamSink',
296
301
  'MapFunction',
297
302
  'CoMapFunction',
@@ -308,6 +313,7 @@ __all__ = [
308
313
  'AggregateFunction',
309
314
  'BroadcastProcessFunction',
310
315
  'KeyedBroadcastProcessFunction',
316
+ 'AsyncFunction',
311
317
  'RuntimeContext',
312
318
  'TimerService',
313
319
  'CheckpointingMode',
@@ -338,5 +344,7 @@ __all__ = [
338
344
  'SinkFunction',
339
345
  'SlotSharingGroup',
340
346
  'MemorySize',
341
- 'OutputTag'
347
+ 'OutputTag',
348
+ 'AsyncRetryPredicate',
349
+ 'AsyncRetryStrategy'
342
350
  ]