fix(doris): preserve aggregate-state bytes in query results

This commit is contained in:
Guoyu Su authored and GitHub committed 2026-09-28 01:01:09 +08:00
1 parent 4bcab01489
commit c75ce783df
17 files changed
+1066 -42

No files matched your search

@@ -166,8 +166,11 @@ import {
downloadBinaryCellPayload,
formatBinaryCellByteSize,
binaryCellUtf8Text,
hasUnsafeOpaqueAggregateStatePredicate,
isBlobCellColumnType,
isBinaryCellColumnType,
isOpaqueAggregateStateColumnType,
mergeOpaqueReadonlyColumnIndexes,
openBinaryCellFile,
parseBinaryCellBytes,
retainBinaryCellDownloadMenuForHover,
@@ -3878,7 +3881,7 @@ const editor = useDataGridEditor({
tableMeta: computed(() => props.tableMeta),
sourceColumns: computed(() => props.sourceColumns),
joinedWriteTargets: computed(() => props.joinedWriteTargets),
readonlyColumnIndexes: computed(() => (props.readonlyColumnIndexes ? new Set(props.readonlyColumnIndexes) : undefined)),
readonlyColumnIndexes: computed(() => mergeOpaqueReadonlyColumnIndexes(props.readonlyColumnIndexes, allColumnTypes.value)),
canEditExistingRows,
onExecuteSql: computed(() => props.onExecuteSql),
customSaveHandler: computed(() => props.customSaveHandler),
@@ -4088,6 +4091,7 @@ function canEditRowItem(item: RowItem | undefined): boolean {
function canEditCellItem(item: RowItem | undefined, columnIndex: number): boolean {
if (!canEditRowItem(item) || !item || !canEditColumn(columnIndex)) return false;
if (isOpaqueAggregateStateColumnType(allColumnTypes.value[columnIndex])) return false;
if (!item.isNew && !item.isDraft && !canUpdateExistingRows.value) return false;
if (isSavingNewRow(item)) return false;
const column = props.result.columns[columnIndex] ?? "";
@@ -4351,6 +4355,7 @@ function isDecimalColumnType(dataType: string): boolean {
function canDeleteRowItem(item: RowItem | undefined): boolean {
if (!item) return false;
if (!item.isNew && canUseKeylessRowPredicate(props.databaseType, props.tableMeta?.primaryKeys ?? []) && hasUnsafeOpaqueAggregateStatePredicate(allColumnTypes.value, item.data)) return false;
const canDelete = canDeleteGridRowItem({
editable: !!props.editable && canDeleteRows.value,
isDraft: !!item.isDraft,
@@ -113,6 +113,14 @@ import DataGridSearchBar from "@/components/grid/DataGridSearchBar.vue";
const cellDetailPanelSource = readFileSync("apps/desktop/src/components/grid/DataGridCellDetailPanel.vue", "utf8");
const cellDetailDialogSource = readFileSync("apps/desktop/src/components/grid/DataGridCellDetailDialog.vue", "utf8");
const binaryTextPreviewSource = readFileSync("apps/desktop/src/components/grid/DataGridCellDetailTextPreview.vue", "utf8");
const dataGridSource = readFileSync("apps/desktop/src/components/grid/DataGrid.vue", "utf8");
describe("DataGrid opaque aggregate-state safety", () => {
it("blocks cell edits and keyless row deletion through the centralized gates", () => {
expect(dataGridSource).toMatch(/function canEditCellItem[\s\S]*isOpaqueAggregateStateColumnType\(allColumnTypes\.value\[columnIndex\]\)/);
expect(dataGridSource).toMatch(/function canDeleteRowItem[\s\S]*canUseKeylessRowPredicate[\s\S]*hasUnsafeOpaqueAggregateStatePredicate\(allColumnTypes\.value, item\.data\)/);
});
});
function detail(patch: Partial<DataGridCellDetail> = {}): DataGridCellDetail {
return {