From b6c2a16dfde06a8d73bc960d8347a65eb45dffb2 Mon Sep 17 00:00:00 2001 From: gtarpenning Date: Wed, 30 Oct 2024 11:33:56 -0700 Subject: [PATCH] use groupby --- .../Home/Browse3/pages/ObjectVersionPage.tsx | 7 +++---- .../trace_server/clickhouse_trace_server_batched.py | 13 ++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ObjectVersionPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ObjectVersionPage.tsx index a2d193669ee..36e2051be44 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ObjectVersionPage.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3/pages/ObjectVersionPage.tsx @@ -8,10 +8,9 @@ import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; import {Button} from '@wandb/weave/components/Button'; import {useObjectViewEvent} from '@wandb/weave/integrations/analytics/useViewEvents'; +import numeral from 'numeral'; import React, {useMemo, useState} from 'react'; import styled from 'styled-components'; -import numeral from 'numeral'; -import React, {useMemo} from 'react'; import {maybePluralizeWord} from '../../../../../core/util/string'; import {Icon, IconName} from '../../../../Icon'; @@ -704,7 +703,7 @@ const DeleteModal: React.FC<{ const [deleteLoading, setDeleteLoading] = useState(false); const [error, setError] = useState(null); - const deleteTargetStr = object.baseObjectClass ?? 'object'; + const deleteTargetStr = `${object.objectId}:v${object.versionIndex}`; const onDelete = () => { setDeleteLoading(true); @@ -738,7 +737,7 @@ const DeleteModal: React.FC<{

Are you sure you want to delete?

)} - {object.objectId}:v{object.versionIndex} + {deleteTargetStr} diff --git a/weave/trace_server/clickhouse_trace_server_batched.py b/weave/trace_server/clickhouse_trace_server_batched.py index d21903a87cf..9ba56d368e6 100644 --- a/weave/trace_server/clickhouse_trace_server_batched.py +++ b/weave/trace_server/clickhouse_trace_server_batched.py @@ -1682,18 +1682,17 @@ def _select_objs_query( FROM ( SELECT project_id, object_id, - created_at, + MIN(created_at) AS created_at, + MIN(deleted_at) AS deleted_at, kind, - base_object_class, - refs, + MIN(base_object_class) AS base_object_class, + MIN(refs) AS refs, digest, - deleted_at, - if (kind = 'op', 1, 0) AS is_op, + IF(kind = 'op', 1, 0) AS is_op FROM object_versions WHERE project_id = {{project_id: String}} AND {object_id_conditions_part} - ORDER by created_at DESC - LIMIT 1 + GROUP BY project_id, kind, object_id, digest ) ) WHERE {conditions_part} AND