Skip to content

Commit

Permalink
use groupby
Browse files Browse the repository at this point in the history
  • Loading branch information
gtarpenning committed Oct 30, 2024
1 parent 667ccf5 commit b6c2a16
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -704,7 +703,7 @@ const DeleteModal: React.FC<{
const [deleteLoading, setDeleteLoading] = useState(false);
const [error, setError] = useState<string | null>(null);

const deleteTargetStr = object.baseObjectClass ?? 'object';
const deleteTargetStr = `${object.objectId}:v${object.versionIndex}`;

const onDelete = () => {
setDeleteLoading(true);
Expand Down Expand Up @@ -738,7 +737,7 @@ const DeleteModal: React.FC<{
<p>Are you sure you want to delete?</p>
)}
<span style={{fontSize: '16px', fontWeight: '600'}}>
{object.objectId}:v{object.versionIndex}
{deleteTargetStr}
</span>
</DialogContent>
<DialogActions $align="left">
Expand Down
13 changes: 6 additions & 7 deletions weave/trace_server/clickhouse_trace_server_batched.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b6c2a16

Please sign in to comment.