-
Notifications
You must be signed in to change notification settings - Fork 924
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KYUUBI #5873] Support to get operation progress with RESTful API
# 🔍 Description ## Issue References 🔗 Since #2493, with jdbc conneciton, user can get TProgressUpdateResp to check the operation progress percentage, but for RESTful api, it is not supported yet. As title, this PR supports to get operation progress with RESTful api. This pull request fixes #5873 ## Describe Your Solution 🔧 Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Types of changes 🔖 - [ ] Bugfix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan 🧪 #### Behavior Without This Pull Request ⚰️ #### Behavior With This Pull Request 🎉 #### Related Unit Tests --- # Checklists ## 📝 Author Self Checklist - [ ] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project - [ ] I have performed a self-review - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) ## 📝 Committer Pre-Merge Checklist - [ ] Pull request title is okay. - [ ] No license issues. - [ ] Milestone correctly set? - [ ] Test coverage is ok - [ ] Assignees are selected. - [ ] Minimum number of approvals - [ ] No changes are requested **Be nice. Be informative.** Closes #5875 from turboFei/progress_resp. Closes #5873 f177da0 [Fei Wang] using dto event 0dbd450 [Fei Wang] ut c0758a5 [Fei Wang] save 29acb12 [Fei Wang] save 9a92cd0 [Fei Wang] save Authored-by: Fei Wang <[email protected]> Signed-off-by: Fei Wang <[email protected]>
- Loading branch information
Showing
8 changed files
with
250 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
kyuubi-rest-client/src/main/java/org/apache/kyuubi/client/api/v1/dto/OperationProgress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.kyuubi.client.api.v1.dto; | ||
|
||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import org.apache.commons.lang3.builder.ReflectionToStringBuilder; | ||
import org.apache.commons.lang3.builder.ToStringStyle; | ||
|
||
public class OperationProgress { | ||
private List<String> headerNames; | ||
private List<List<String>> rows; | ||
private double progressedPercentage; | ||
private String status; | ||
private String footerSummary; | ||
private long startTime; | ||
|
||
public OperationProgress() {} | ||
|
||
public OperationProgress( | ||
List<String> headerNames, | ||
List<List<String>> rows, | ||
double progressedPercentage, | ||
String status, | ||
String footerSummary, | ||
long startTime) { | ||
this.headerNames = headerNames; | ||
this.rows = rows; | ||
this.progressedPercentage = progressedPercentage; | ||
this.status = status; | ||
this.footerSummary = footerSummary; | ||
this.startTime = startTime; | ||
} | ||
|
||
public List<String> getHeaderNames() { | ||
if (headerNames == null) { | ||
return Collections.emptyList(); | ||
} | ||
return headerNames; | ||
} | ||
|
||
public void setHeaderNames(List<String> headerNames) { | ||
this.headerNames = headerNames; | ||
} | ||
|
||
public List<List<String>> getRows() { | ||
if (rows == null) { | ||
return Collections.emptyList(); | ||
} | ||
return rows; | ||
} | ||
|
||
public void setRows(List<List<String>> rows) { | ||
this.rows = rows; | ||
} | ||
|
||
public double getProgressedPercentage() { | ||
return progressedPercentage; | ||
} | ||
|
||
public void setProgressedPercentage(double progressedPercentage) { | ||
this.progressedPercentage = progressedPercentage; | ||
} | ||
|
||
public String getStatus() { | ||
return status; | ||
} | ||
|
||
public void setStatus(String status) { | ||
this.status = status; | ||
} | ||
|
||
public String getFooterSummary() { | ||
return footerSummary; | ||
} | ||
|
||
public void setFooterSummary(String footerSummary) { | ||
this.footerSummary = footerSummary; | ||
} | ||
|
||
public long getStartTime() { | ||
return startTime; | ||
} | ||
|
||
public void setStartTime(long startTime) { | ||
this.startTime = startTime; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
OperationProgress that = (OperationProgress) o; | ||
return Double.compare(getProgressedPercentage(), that.getProgressedPercentage()) == 0 | ||
&& getStartTime() == that.getStartTime() | ||
&& Objects.equals(getHeaderNames(), that.getHeaderNames()) | ||
&& Objects.equals(getRows(), that.getRows()) | ||
&& Objects.equals(getStatus(), that.getStatus()) | ||
&& Objects.equals(getFooterSummary(), that.getFooterSummary()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash( | ||
getHeaderNames(), | ||
getRows(), | ||
getProgressedPercentage(), | ||
getStatus(), | ||
getFooterSummary(), | ||
getStartTime()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return ReflectionToStringBuilder.toString(this, ToStringStyle.JSON_STYLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.