This is an automated email from the ASF dual-hosted git repository.
nicholasjiang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-webui.git
The following commit(s) were added to refs/heads/main by this push:
new d7a38131 [Bugfix] Fix playground NullPointerException (#530)
d7a38131 is described below
commit d7a381316e5aa19012aca3059d125d1b9b402338
Author: hiliuxg <[email protected]>
AuthorDate: Fri Aug 16 20:26:21 2024 +0800
[Bugfix] Fix playground NullPointerException (#530)
---
.../sql/gateway/executor/FlinkSqlGatewayExecutor.java | 18 ++++++++++++++++--
.../paimon/web/server/context/logtool/LogReadPool.java | 6 ++----
.../src/views/playground/components/query/index.tsx | 4 ++--
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git
a/paimon-web-engine/paimon-web-engine-flink/paimon-web-engine-flink-sql-gateway/src/main/java/org/apache/paimon/web/engine/flink/sql/gateway/executor/FlinkSqlGatewayExecutor.java
b/paimon-web-engine/paimon-web-engine-flink/paimon-web-engine-flink-sql-gateway/src/main/java/org/apache/paimon/web/engine/flink/sql/gateway/executor/FlinkSqlGatewayExecutor.java
index ab58e471..fcffc15d 100644
---
a/paimon-web-engine/paimon-web-engine-flink/paimon-web-engine-flink-sql-gateway/src/main/java/org/apache/paimon/web/engine/flink/sql/gateway/executor/FlinkSqlGatewayExecutor.java
+++
b/paimon-web-engine/paimon-web-engine-flink/paimon-web-engine-flink-sql-gateway/src/main/java/org/apache/paimon/web/engine/flink/sql/gateway/executor/FlinkSqlGatewayExecutor.java
@@ -23,6 +23,7 @@ import
org.apache.paimon.web.engine.flink.common.operation.FlinkSqlOperationType
import org.apache.paimon.web.engine.flink.common.parser.CustomSqlParser;
import org.apache.paimon.web.engine.flink.common.result.ExecutionResult;
import org.apache.paimon.web.engine.flink.common.result.FetchResultParams;
+import org.apache.paimon.web.engine.flink.common.status.JobStatus;
import org.apache.paimon.web.engine.flink.sql.gateway.client.SqlGatewayClient;
import org.apache.paimon.web.engine.flink.sql.gateway.model.SessionEntity;
import org.apache.paimon.web.engine.flink.sql.gateway.utils.CollectResultUtil;
@@ -30,6 +31,7 @@ import
org.apache.paimon.web.engine.flink.sql.gateway.utils.FlinkSqlStatementSet
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlNodeList;
+import org.apache.flink.api.common.JobID;
import org.apache.flink.table.gateway.api.results.ResultSet;
import
org.apache.flink.table.gateway.rest.message.statement.FetchResultsResponseBody;
@@ -102,6 +104,14 @@ public class FlinkSqlGatewayExecutor implements Executor {
executionResult = executeDmlStatement(combinedStatement);
}
+ if (executionResult == null) {
+ executionResult =
+ new ExecutionResult.Builder()
+ .shouldFetchResult(false)
+ .status(JobStatus.FINISHED.getValue())
+ .build();
+ }
+
return executionResult;
}
@@ -113,8 +123,12 @@ public class FlinkSqlGatewayExecutor implements Executor {
ExecutionResult.Builder builder =
CollectResultUtil.collectSqlGatewayResult(results.getResults())
.submitId(operationId);
- if
(operationType.getType().equals(FlinkSqlOperationType.SELECT.getType())) {
-
builder.jobId(getJobIdFromResults(results)).shouldFetchResult(true);
+ JobID jobId = results.getJobID();
+ if (jobId != null
+ &&
operationType.getType().equals(FlinkSqlOperationType.SELECT.getType())) {
+ builder.jobId(jobId.toString()).shouldFetchResult(true);
+ } else if (jobId == null) {
+
builder.shouldFetchResult(false).status(JobStatus.FINISHED.getValue());
}
return builder.build();
}
diff --git
a/paimon-web-server/src/main/java/org/apache/paimon/web/server/context/logtool/LogReadPool.java
b/paimon-web-server/src/main/java/org/apache/paimon/web/server/context/logtool/LogReadPool.java
index ca855d1d..a6506e01 100644
---
a/paimon-web-server/src/main/java/org/apache/paimon/web/server/context/logtool/LogReadPool.java
+++
b/paimon-web-server/src/main/java/org/apache/paimon/web/server/context/logtool/LogReadPool.java
@@ -36,12 +36,10 @@ public class LogReadPool extends
AbstractPool<StringBuilder> {
}
public static void write(String str, String userId) {
- consoleEntityCache
- .computeIfAbsent(userId, k -> new StringBuilder("Console:\n"))
- .append(str);
+ consoleEntityCache.computeIfAbsent(userId, k -> new
StringBuilder()).append(str);
}
public static void clear(String userId) {
- consoleEntityCache.put(userId, new StringBuilder("Console:\n"));
+ consoleEntityCache.put(userId, new StringBuilder());
}
}
diff --git a/paimon-web-ui/src/views/playground/components/query/index.tsx
b/paimon-web-ui/src/views/playground/components/query/index.tsx
index 8d21ba1d..4d429df4 100644
--- a/paimon-web-ui/src/views/playground/components/query/index.tsx
+++ b/paimon-web-ui/src/views/playground/components/query/index.tsx
@@ -107,12 +107,12 @@ export default defineComponent({
const { connect, subscribe } = useWebSocket(wsUrl, {
onMessage: (message) => {
const data = JSON.parse(message.body)
- if (data && data.jobId && data.fileName) {
+ if (data && data.fileName) {
const jobDetail: JobDetails = {
executionMode: data.executeMode as ExecutionMode,
job: data,
jobResultData: null,
- jobStatus: '',
+ jobStatus: data.status == null ? '' : data.status,
executionTime: 0,
startTime: Date.now(),
displayResult: true,