Skip to content

Commit

Permalink
[core] fix comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
LinMingQiang committed Jan 9, 2025
1 parent 03d6040 commit 9201a87
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 23 deletions.
6 changes: 3 additions & 3 deletions docs/content/flink/sql-write.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ public class CustomPartitionMarkDoneAction implements PartitionMarkDoneAction {

Paimon also support http-report partition mark done action, this action will report the partition to the remote http server.
- partition.mark-done-action: http-report
- partition.mark-done-action.url : Action will report the partition to the remote http server.
- partition.mark-done-action.timeout : Http client connection timeout and default is 5s.
- partition.mark-done-action.params : Http client request params in the request body json.
- partition.mark-done-action.http.url : Action will report the partition to the remote http server.
- partition.mark-done-action.http.timeout : Http client connection timeout and default is 5s.
- partition.mark-done-action.http.params : Http client request params in the request body json.

Http Post request body :
```json
Expand Down
12 changes: 6 additions & 6 deletions docs/layouts/shortcodes/generated/core_configuration.html
Original file line number Diff line number Diff line change
Expand Up @@ -672,22 +672,22 @@
<td>The partition mark done class for implement PartitionMarkDoneAction interface. Only work in custom mark-done-action.</td>
</tr>
<tr>
<td><h5>partition.mark-done-action.params</h5></td>
<td><h5>partition.mark-done-action.http.params</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td>String</td>
<td>Http client request parameters will be written to the request body, This can only be used by http-report partition mark done action.</td>
<td>Http client request parameters will be written to the request body, this can only be used by http-report partition mark done action.</td>
</tr>
<tr>
<td><h5>partition.mark-done-action.timeout</h5></td>
<td><h5>partition.mark-done-action.http.timeout</h5></td>
<td style="word-wrap: break-word;">5 s</td>
<td>Duration</td>
<td>Http client connect timeout, This can only be used by http-report partition mark done action.</td>
<td>Http client connection timeout, this can only be used by http-report partition mark done action.</td>
</tr>
<tr>
<td><h5>partition.mark-done-action.url</h5></td>
<td><h5>partition.mark-done-action.http.url</h5></td>
<td style="word-wrap: break-word;">(none)</td>
<td>String</td>
<td>Mark done action will reports the partition to the remote http server, This can only be used by http-report partition mark done action.</td>
<td>Mark done action will reports the partition to the remote http server, this can only be used by http-report partition mark done action.</td>
</tr>
<tr>
<td><h5>partition.timestamp-formatter</h5></td>
Expand Down
12 changes: 6 additions & 6 deletions paimon-common/src/main/java/org/apache/paimon/CoreOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -1238,25 +1238,25 @@ public class CoreOptions implements Serializable {
+ " PartitionMarkDoneAction interface. Only work in custom mark-done-action.");

public static final ConfigOption<String> PARTITION_MARK_DONE_ACTION_URL =
key("partition.mark-done-action.url")
key("partition.mark-done-action.http.url")
.stringType()
.noDefaultValue()
.withDescription(
"Mark done action will reports the partition to the remote http server, This can only be used by http-report partition mark done action.");
"Mark done action will reports the partition to the remote http server, this can only be used by http-report partition mark done action.");

public static final ConfigOption<Duration> PARTITION_MARK_DONE_ACTION_TIMEOUT =
key("partition.mark-done-action.timeout")
key("partition.mark-done-action.http.timeout")
.durationType()
.defaultValue(Duration.ofSeconds(5))
.withDescription(
"Http client connect timeout, This can only be used by http-report partition mark done action.");
"Http client connection timeout, this can only be used by http-report partition mark done action.");

public static final ConfigOption<String> PARTITION_MARK_DONE_ACTION_PARAMS =
key("partition.mark-done-action.params")
key("partition.mark-done-action.http.params")
.stringType()
.noDefaultValue()
.withDescription(
"Http client request parameters will be written to the request body, This can only be used by http-report partition mark done action.");
"Http client request parameters will be written to the request body, this can only be used by http-report partition mark done action.");

public static final ConfigOption<Boolean> METASTORE_PARTITIONED_TABLE =
key("metastore.partitioned-table")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ public void markDone(String partition) throws Exception {
partition),
HttpReportMarkDoneResponse.class,
Collections.emptyMap());
Preconditions.checkArgument(
Preconditions.checkState(
reportIsSuccess(response),
String.format(
"The http-report actions response attribute `result` should be 'SUCCESS' but is '%s'.",
"The http-report action's response attribute `result` should be 'SUCCESS' but is '%s'.",
response.getResult()));
}

public boolean reportIsSuccess(HttpReportMarkDoneResponse response) {
private boolean reportIsSuccess(HttpReportMarkDoneResponse response) {
return response != null && RESPONSE_SUCCESS.equalsIgnoreCase(response.getResult());
}

Expand All @@ -109,6 +109,7 @@ public void close() throws IOException {
/** RestRequest only for HttpReportMarkDoneAction. */
@JsonIgnoreProperties(ignoreUnknown = true)
public static class HttpReportMarkDoneRequest implements RESTRequest {

private static final String MARK_DONE_PARTITION = "partition";
private static final String TABLE = "table";
private static final String PATH = "path";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void testPartitionMarkDoneWithMultiplePartitionKey(boolean hasPk, String
@MethodSource("testArguments")
public void testCustomPartitionMarkDoneAction(boolean hasPk, String invoker) throws Exception {

Map<String, String> options = new HashMap<>();
Map<String, String> options = new HashMap<>(2);
options.put(
PARTITION_MARK_DONE_ACTION.key(),
PartitionMarkDoneAction.SUCCESS_FILE + "," + PartitionMarkDoneAction.CUSTOM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ public void testHttpReportMarkDoneActionFailedResponse() throws Exception {
HttpReportMarkDoneResponse failedResponse = new HttpReportMarkDoneResponse("failed");
server.enqueueResponse(failedResponse, 200);
Assertions.assertThatThrownBy(() -> markDoneAction.markDone(partition))
.isInstanceOf(IllegalArgumentException.class)
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(
"The http-report actions response attribute `result` should be 'SUCCESS' but is 'failed'.");
"The http-report action's response attribute `result` should be 'SUCCESS' but is 'failed'.");

// Illegal response body.
String unExpectResponse = "{\"unknow\" :\"unknow\"}";
server.enqueueResponse(unExpectResponse, 200);
Assertions.assertThatThrownBy(() -> markDoneAction.markDone(partition))
.isInstanceOf(IllegalArgumentException.class)
.isInstanceOf(IllegalStateException.class)
.hasMessageContaining(
"The http-report actions response attribute `result` should be 'SUCCESS' but is 'null'.");
"The http-report action's response attribute `result` should be 'SUCCESS' but is 'null'.");

// 400.
server.enqueueResponse("", 400);
Expand Down

0 comments on commit 9201a87

Please sign in to comment.