Skip to content

Commit

Permalink
fix: update error msg (#8221)
Browse files Browse the repository at this point in the history
* fix: update error msg

* fix: update name

* fix: tests
  • Loading branch information
wcarlson5 authored Oct 6, 2021
1 parent 68f05a0 commit 8c30780
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private ConfiguredStatement<? extends CreateSource> injectForCreateSource(
} else if (!properties.getPartitions().isPresent()) {
final CreateSource example = createSource.copyWith(
createSource.getElements(),
properties.withPartitionsAndReplicas(2, (short) 1));
properties.withPartitions(2));
throw new KsqlException(
"Topic '" + topicName + "' does not exist. If you want to create a new topic for the "
+ "stream/table please re-run the statement providing the required '"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ public void shouldHaveSuperUsefulErrorMessageIfCreateWithNoPartitions() {
+ "stream/table please re-run the statement providing the required 'PARTITIONS' "
+ "configuration in the WITH clause (and optionally 'REPLICAS'). For example: "
+ "CREATE STREAM FOO (FOO STRING) "
+ "WITH (KAFKA_TOPIC='doesntexist', PARTITIONS=2, REPLICAS=1, VALUE_FORMAT='avro');"));
+ "WITH (KAFKA_TOPIC='doesntexist', PARTITIONS=2, VALUE_FORMAT='avro');"));
}

private ConfiguredStatement<?> givenStatement(final String sql) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,11 @@ public CreateSourceProperties withSchemaIds(
return new CreateSourceProperties(originals, durationParser);
}

public CreateSourceProperties withPartitionsAndReplicas(
final int partitions,
final short replicas
public CreateSourceProperties withPartitions(
final int partitions
) {
final Map<String, Literal> originals = props.copyOfOriginalLiterals();
originals.put(CommonCreateConfigs.SOURCE_NUMBER_OF_PARTITIONS, new IntegerLiteral(partitions));
originals.put(CommonCreateConfigs.SOURCE_NUMBER_OF_REPLICAS, new IntegerLiteral(replicas));

return new CreateSourceProperties(originals, durationParser);
}
Expand Down

0 comments on commit 8c30780

Please sign in to comment.