Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

feat: support undefined cell value (#12258)

Liu Ji616e091783c0
diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vue
index cf3d1229f7..2120c786a2 100644
--- a/frontend/src/components/ProvideSQLEditorContext.vue
+++ b/frontend/src/components/ProvideSQLEditorContext.vue
@@ -15,7 +15,9 @@
</li>
</teleport>
- <router-view />
+ <Suspense>
+ <router-view />
+ </Suspense>
</template>
<script lang="ts" setup>
diff --git a/frontend/src/utils/v1/sql.ts b/frontend/src/utils/v1/sql.ts
index 2d2aaf907e..da5305272c 100644
--- a/frontend/src/utils/v1/sql.ts
+++ b/frontend/src/utils/v1/sql.ts
@@ -14,8 +14,7 @@ export const extractSQLRowValue = (value: RowValue | undefined) => {
const plainObject = RowValue.toJSON(value) as Record<string, any>;
const keys = Object.keys(plainObject);
if (keys.length === 0) {
- console.debug("empty row value", value);
- return null;
+ return undefined; // Will bi displayed as "UNSET"
}
if (keys.length > 1) {
console.debug("mixed type in row value", value);
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
index a3d4e7aba5..c65bb8f7d2 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/DataTable/TableCell.vue
@@ -85,6 +85,9 @@ const classes = computed(() => {
const html = computed(() => {
const value = extractSQLRowValue(props.value);
+ if (value === undefined) {
+ return `<span class="text-gray-400 italic">UNSET</span>`;
+ }
if (value === null) {
return `<span class="text-gray-400 italic">NULL</span>`;
}
diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
index 8b472b92b5..a96c892892 100644
--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/SingleResultViewV1.vue
@@ -216,6 +216,7 @@ import {
hasPermissionToCreateRequestGrantIssue,
hasWorkspacePermissionV2,
instanceV1HasStructuredQueryResult,
+ isNullOrUndefined,
} from "@/utils";
import DataBlock from "./DataBlock.vue";
import DataTable from "./DataTable";
@@ -346,9 +347,13 @@ const data = computed(() => {
let temp = data;
if (search) {
temp = data.filter((item) => {
- return item.values.some((col) =>
- String(extractSQLRowValue(col)).toLowerCase().includes(search)
- );
+ return item.values.some((col) => {
+ const value = extractSQLRowValue(col);
+ if (isNullOrUndefined(value)) {
+ return false;
+ }
+ return String(value).toLowerCase().includes(search);
+ });
});
}
return temp;
@@ -523,4 +528,4 @@ const queryTime = computed(() => {
--n-padding-single-left: 8px !important;
--n-padding-single-right: 8px !important;
}
-</style>
\ No newline at end of file
+</style>