Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tajo-client/src/main/java/org/apache/tajo/cli/TajoCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ private void waitForQueryCompleted(QueryId queryId) {
if (TajoClient.isInCompleteState(status.getState()) && status.getState() != QueryState.QUERY_KILL_WAIT) {
break;
} else {
Thread.sleep(Math.min(100 * progressRetries, 1000));
Thread.sleep(Math.min(200 * progressRetries, 1000));
progressRetries += 2;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,26 +245,18 @@ public float getProgress() {
synchronized(subqueries) {
tempSubQueries.addAll(subqueries.values());
}

float [] subProgresses = new float[tempSubQueries.size()];
boolean finished = true;
for (SubQuery subquery: tempSubQueries) {
if (subquery.getState() != SubQueryState.NEW) {
subProgresses[idx] = subquery.getProgress();
if (finished && subquery.getState() != SubQueryState.SUCCEEDED) {
finished = false;
}
} else {
subProgresses[idx] = 0.0f;
finished = false;
}
idx++;
}

if (finished) {
return 1.0f;
}

float totalProgress = 0;
float totalProgress = 0.0f;
float proportion = 1.0f / (float)(getExecutionBlockCursor().size() - 1); // minus one is due to

for (int i = 0; i < subProgresses.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion tajo-core/src/main/java/org/apache/tajo/util/JSPUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public int compare(FunctionDesc f1, FunctionDesc f2) {
});
}

static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("###.0");
static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("###.#");
public static String percentFormat(float value) {
return PERCENT_FORMAT.format(value * 100.0f);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* 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.tajo.master.querymaster;

import org.apache.tajo.*;
import org.apache.tajo.client.QueryStatus;
import org.apache.tajo.client.TajoClient;
import org.apache.tajo.conf.TajoConf;
import org.apache.tajo.ipc.ClientProtos;

import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import static org.junit.Assert.*;

@Category(IntegrationTest.class)
public class TestQueryProgress {
private static TajoTestingCluster cluster;
private static TajoConf conf;
private static TajoClient client;

@BeforeClass
public static void setUp() throws Exception {
cluster = TpchTestBase.getInstance().getTestingCluster();
conf = cluster.getConfiguration();
client = new TajoClient(conf);
}

@Test(timeout = 10000)
public final void testQueryProgress() throws Exception {
ClientProtos.SubmitQueryResponse res = client.executeQuery("select l_orderkey from lineitem group by l_orderkey");
QueryId queryId = new QueryId(res.getQueryId());

float prevProgress = 0;
while (true) {
QueryStatus status = client.getQueryStatus(queryId);
if (status == null) continue;

float progress = status.getProgress();

if (prevProgress > progress) {
fail("Previous progress: " + prevProgress + ", Current progress : " + progress);
}
prevProgress = progress;
assertTrue(progress <= 1.0f);

if (TajoClient.isInCompleteState(status.getState())) break;
}
}
}