Skip to content

Commit

Permalink
[FLINK-34469][table] Implement TableDistribution toString
Browse files Browse the repository at this point in the history
  • Loading branch information
jeyhunkarimov authored and JingGe committed Feb 29, 2024
1 parent 9e81177 commit 322a841
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ public String toString() {
.map(EncodingUtils::escapeIdentifier)
.collect(Collectors.joining(", "));

final String distributedBy =
distribution == null ? "" : distribution.asSerializableString();
final String distributedBy = distribution == null ? "" : distribution.toString();

final String partitionedBy =
!partitionKeys.isEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ static Optional<String> extractFormattedComment(ResolvedCatalogBaseTable<?> tabl
}

static Optional<String> extractFormattedDistributedInfo(ResolvedCatalogTable catalogTable) {
return catalogTable.getDistribution().map(TableDistribution::asSerializableString);
return catalogTable.getDistribution().map(TableDistribution::toString);
}

static Optional<String> extractFormattedPartitionedInfo(ResolvedCatalogTable catalogTable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ public TableResult apply(TableEnvironment env, Map<String, String> extraOptions)
allOptions.putAll(extraOptions);

final String distributedBy =
Optional.ofNullable(distribution)
.map(TableDistribution::asSerializableString)
.orElse("");
Optional.ofNullable(distribution).map(TableDistribution::toString).orElse("");
final String partitionedBy =
partitionKeys.isEmpty()
? ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Optional<Integer> getBucketCount() {
return Optional.ofNullable(bucketCount);
}

public String asSerializableString() {
private String asSerializableString() {
if (getBucketKeys().isEmpty()
&& getBucketCount().isPresent()
&& getBucketCount().get() != 0) {
Expand All @@ -142,4 +142,9 @@ && getBucketCount().get() != 0) {
sb.append("\n");
return sb.toString();
}

@Override
public String toString() {
return asSerializableString();
}
}

0 comments on commit 322a841

Please sign in to comment.