Skip to content

Commit

Permalink
[FLINK-21740][sql-client] Fix unstable CliTableauResultViewTest (apac…
Browse files Browse the repository at this point in the history
  • Loading branch information
fsk119 authored Mar 15, 2021
1 parent 36366f7 commit f6d6fa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ private void printResults(AtomicInteger receivedRowCount, boolean isStreamingMod

switch (result.getType()) {
case EMPTY:
// do nothing
try {
// prevent busy loop
Thread.sleep(1);
} catch (InterruptedException e) {
// get ctrl+c from terminal and fallback
}
break;
case EOS:
if (receivedRowCount.get() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ public void setUp() {
Timestamp.valueOf("2020-03-04 18:39:14")));

streamingData = new ArrayList<>();
for (int i = 0; i < data.size(); ++i) {
Row row = Row.copy(data.get(i));
for (Row datum : data) {
Row row = Row.copy(datum);
streamingData.add(row);
}
}
Expand Down Expand Up @@ -221,11 +221,11 @@ public void testCancelBatchResult() throws Exception {

// submit result display in another thread
ExecutorService executorService = Executors.newSingleThreadExecutor();
Future<?> furture = executorService.submit(() -> view.displayResults());
Future<?> furture = executorService.submit(view::displayResults);

// wait until we trying to get batch result
CommonTestUtils.waitUntilCondition(
() -> mockExecutor.getNumRetrieveResultChancesCalls() > 0,
() -> mockExecutor.getNumRetrieveResultChancesCalls() > 1,
Deadline.now().plus(Duration.ofSeconds(5)),
50L);

Expand Down Expand Up @@ -423,7 +423,7 @@ public void testCancelStreamingResult() throws Exception {

// submit result display in another thread
ExecutorService executorService = Executors.newSingleThreadExecutor();
Future<?> furture = executorService.submit(() -> view.displayResults());
Future<?> furture = executorService.submit(view::displayResults);

// wait until we processed first result
CommonTestUtils.waitUntilCondition(
Expand Down

0 comments on commit f6d6fa5

Please sign in to comment.