Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
liyubin117 committed Dec 12, 2024
1 parent 4ee4cf1 commit 4e459de
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 43 deletions.
30 changes: 0 additions & 30 deletions flink-python/pyflink/table/table_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,36 +226,6 @@ def set_idle_state_retention(self, duration: datetime.timedelta):
j_duration = j_duration_class.ofMillis(long(round(duration.total_seconds() * 1000)))
self._j_table_config.setIdleStateRetention(j_duration)

def get_min_idle_state_retention_time(self) -> int:
"""
State might be cleared and removed if it was not updated for the defined period of time.
.. note::
Currently the concept of min/max idle state retention has been deprecated and only
idle state retention time is supported. The min idle state retention is regarded as
idle state retention and the max idle state retention is derived from idle state
retention as 1.5 x idle state retention.
:return: The minimum time until state which was not updated will be retained.
"""
return self._j_table_config.getIdleStateRetention().toMillis()

def get_max_idle_state_retention_time(self) -> int:
"""
State will be cleared and removed if it was not updated for the defined period of time.
.. note::
Currently the concept of min/max idle state retention has been deprecated and only
idle state retention time is supported. The min idle state retention is regarded as
idle state retention and the max idle state retention is derived from idle state
retention as 1.5 x idle state retention.
:return: The maximum time until state which was not updated will be retained.
"""
return self._j_table_config.getIdleStateRetention().toMillis() * 3 / 2

def get_idle_state_retention(self) -> datetime.timedelta:
"""
Expand Down
9 changes: 0 additions & 9 deletions flink-python/pyflink/table/tests/test_table_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@


class TableConfigTests(PyFlinkTestCase):
def test_get_set_idle_state_retention_time(self):
table_config = TableConfig.get_default()

table_config.set_idle_state_retention_time(
datetime.timedelta(days=1), datetime.timedelta(days=2))

self.assertEqual(3 * 24 * 3600 * 1000 / 2, table_config.get_max_idle_state_retention_time())
self.assertEqual(24 * 3600 * 1000, table_config.get_min_idle_state_retention_time())

def test_get_set_idle_state_rentention(self):
table_config = TableConfig.get_default()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ class StreamTableEnvironmentImplTest {
tEnv.toDataStream(table)

assertThat(tEnv.getConfig.getIdleStateRetention.toMillis).isEqualTo(retention.toMillis)
assertThat(tEnv.getConfig.getIdleStateRetention.toMillis * 3 / 2)
.isEqualTo(retention.toMillis * 3 / 2)
}

@Test
Expand All @@ -65,8 +63,6 @@ class StreamTableEnvironmentImplTest {
tEnv.toRetractStream[Row](table)

assertThat(tEnv.getConfig.getIdleStateRetention.toMillis).isEqualTo(retention.toMillis)
assertThat(tEnv.getConfig.getIdleStateRetention.toMillis * 3 / 2)
.isEqualTo(retention.toMillis * 3 / 2)
}

private def getStreamTableEnvironment(
Expand Down

0 comments on commit 4e459de

Please sign in to comment.