Skip to content

Commit

Permalink
OPIK-446 remove materialized column
Browse files Browse the repository at this point in the history
  • Loading branch information
idoberko2 committed Dec 18, 2024
1 parent a012ea6 commit a9c127c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
15 changes: 12 additions & 3 deletions apps/opik-backend/src/main/java/com/comet/opik/domain/SpanDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,10 @@ LEFT JOIN (
private static final String SELECT_BY_ID = """
SELECT
*,
duration_millis
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis
FROM
spans
WHERE id = :id
Expand Down Expand Up @@ -513,7 +516,10 @@ LEFT JOIN (
last_updated_at,
created_by,
last_updated_by,
duration_millis
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis
FROM spans
WHERE project_id = :project_id
AND workspace_id = :workspace_id
Expand Down Expand Up @@ -636,7 +642,10 @@ AND id in (
workspace_id,
project_id,
id,
duration_millis,
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis,
if(length(input) > 0, 1, 0) as input_count,
if(length(output) > 0, 1, 0) as output_count,
if(length(metadata) > 0, 1, 0) as metadata_count,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,10 @@ INSERT INTO traces (
FROM (
SELECT
*,
duration_millis
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis
FROM traces
WHERE workspace_id = :workspace_id
AND id = :id
Expand Down Expand Up @@ -321,7 +324,10 @@ LEFT JOIN (
last_updated_at,
created_by,
last_updated_by,
duration_millis
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis
FROM traces
WHERE project_id = :project_id
AND workspace_id = :workspace_id
Expand Down Expand Up @@ -620,7 +626,10 @@ LEFT JOIN (
workspace_id,
project_id,
id,
duration_millis,
if(end_time IS NOT NULL AND start_time IS NOT NULL
AND notEquals(start_time, toDateTime64('1970-01-01 00:00:00.000', 9)),
(dateDiff('microsecond', start_time, end_time) / 1000.0),
NULL) AS duration_millis,
if(length(input) > 0, 1, 0) as input_count,
if(length(output) > 0, 1, 0) as output_count,
if(length(metadata) > 0, 1, 0) as metadata_count,
Expand Down

This file was deleted.

0 comments on commit a9c127c

Please sign in to comment.