Skip to content

Commit

Permalink
minor: Update error message for retention config
Browse files Browse the repository at this point in the history
  • Loading branch information
bvarghese1 committed Aug 24, 2022
1 parent e93fe35 commit f9864ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Expand Up @@ -209,7 +209,9 @@ private void throwIfRetentionPresentForTable(
) {
if (topicCleanUpPolicy.equals(TopicConfig.CLEANUP_POLICY_COMPACT)
&& retentionInMillis.isPresent()) {
throw new KsqlException("Invalid config variable in the WITH clause: RETENTION_MS");
throw new KsqlException(
"Invalid config variable in the WITH clause: RETENTION_MS."
+ " Non-windowed tables do not support retention.");
}
}

Expand Down Expand Up @@ -246,7 +248,7 @@ private TopicProperties createTopic(
config.putAll(additionalTopicConfigs);

// Note: The retention.ms config has no effect if cleanup.policy=compact
// cleanup.policy=compact is set for topics that are backed by tables
// config is set for topics that are backed by tables
if (topicCleanUpPolicy.equals(TopicConfig.CLEANUP_POLICY_COMPACT)) {
config.remove(TopicConfig.RETENTION_MS_CONFIG);
}
Expand Down
Expand Up @@ -508,7 +508,10 @@ public void shouldThrowIfRetentionConfigPresentInCreateTable() {
);

// Then:
assertThat(e.getMessage(), containsString("Invalid config variable in the WITH clause: RETENTION_MS"));
assertThat(
e.getMessage(),
containsString("Invalid config variable in the WITH clause: RETENTION_MS."
+ " Non-windowed tables do not support retention."));
}

@Test
Expand All @@ -523,7 +526,10 @@ public void shouldThrowIfRetentionConfigPresentInCreateTableAs() {
);

// Then:
assertThat(e.getMessage(), containsString("Invalid config variable in the WITH clause: RETENTION_MS"));
assertThat(
e.getMessage(),
containsString("Invalid config variable in the WITH clause: RETENTION_MS."
+ " Non-windowed tables do not support retention."));
}

private ConfiguredStatement<?> givenStatement(final String sql) {
Expand Down

0 comments on commit f9864ad

Please sign in to comment.