From 8aba2475be46913400a48499bd348e0a8b0f4b4f Mon Sep 17 00:00:00 2001 From: v-zhangjc9 Date: Mon, 3 Jun 2024 15:52:34 +0800 Subject: [PATCH] =?UTF-8?q?fix(executor-task):=20=E4=BF=AE=E5=A4=8Dsql?= =?UTF-8?q?=E8=AF=AD=E5=8F=A5=E6=9F=A5=E8=AF=A2=E5=88=B0null=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E5=AF=BC=E8=87=B4=E6=95=B0=E7=BB=84=E8=B6=8A=E7=95=8C?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/executor/task/SQLExecutor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/service-executor/service-executor-task/src/main/java/com/lanyuanxiaoyao/service/executor/task/SQLExecutor.java b/service-executor/service-executor-task/src/main/java/com/lanyuanxiaoyao/service/executor/task/SQLExecutor.java index 5a8d309..4545fdd 100644 --- a/service-executor/service-executor-task/src/main/java/com/lanyuanxiaoyao/service/executor/task/SQLExecutor.java +++ b/service-executor/service-executor-task/src/main/java/com/lanyuanxiaoyao/service/executor/task/SQLExecutor.java @@ -1,6 +1,7 @@ package com.lanyuanxiaoyao.service.executor.task; import cn.hutool.core.collection.IterUtil; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import de.vandermeer.asciitable.AsciiTable; import de.vandermeer.asciitable.CWC_LongestLine; @@ -18,7 +19,6 @@ import org.apache.flink.util.CloseableIterator; import org.apache.hudi.common.table.HoodieTableConfig; import org.apache.hudi.common.table.HoodieTableMetaClient; import org.apache.hudi.common.table.TableSchemaResolver; -import org.apache.hudi.configuration.FlinkOptions; import org.apache.hudi.org.apache.avro.Schema; import org.apache.hudi.util.AvroSchemaConverter; import org.apache.hudi.util.HoodiePipeline; @@ -89,7 +89,12 @@ public class SQLExecutor { table.addRule(); table.addRow(fields.toArray()); table.addRule(); - iterator.forEachRemaining(row -> table.addRow(fields.collect(row::getField).toArray())); + iterator.forEachRemaining(row -> { + table.addRow(fields.collect(name -> { + Object field = row.getField(name); + return ObjectUtil.isNull(field) ? "null" : field; + }).toArray()); + }); table.addRule(); table.getRenderer().setCWC(new CWC_LongestLine()); table.getContext().setGridTheme(TA_GridThemes.NONE);