Skip to content

Commit f48e22b

Browse files
authored
update sql editor column types to match CH schema (#924)
1 parent c97e890 commit f48e22b

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

frontend/components/sql/utils.ts

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -8,98 +8,98 @@ import { baseExtensions, defaultThemeSettings, githubDarkStyle } from "@/compone
88

99
const tableSchemas = {
1010
spans: [
11-
{ name: "span_id", type: "uuid", description: "Unique identifier for the span" },
12-
{ name: "status", type: "text", description: "Status of the span" },
13-
{ name: "name", type: "text", description: "Name of the span" },
14-
{ name: "path", type: "text", description: "Hierarchical path of the span (e.g., 'outer.inner')" },
15-
{ name: "parent_span_id", type: "uuid", description: "ID of the parent span" },
11+
{ name: "span_id", type: "UUID", description: "Unique identifier for the span" },
12+
{ name: "status", type: "String", description: "Status of the span" },
13+
{ name: "name", type: "String", description: "Name of the span" },
14+
{ name: "path", type: "String", description: "Hierarchical path of the span (e.g., 'outer.inner')" },
15+
{ name: "parent_span_id", type: "UUID", description: "ID of the parent span" },
1616
{
1717
name: "span_type",
1818
type: "span_type",
1919
description: "Stringified enum value of the span type (DEFAULT, LLM, EXECUTOR, EVALUATOR, EVALUATION, TOOL)",
2020
},
21-
{ name: "start_time", type: "timestamp", description: "When the span started" },
22-
{ name: "end_time", type: "timestamp", description: "When the span ended" },
23-
{ name: "duration", type: "double precision", description: "Duration in seconds (end_time - start_time)" },
24-
{ name: "input", type: "jsonb", description: "Input data for the span" },
25-
{ name: "output", type: "jsonb", description: "Output data from the span" },
26-
{ name: "request_model", type: "text", description: "LLM model specified in the request" },
27-
{ name: "response_model", type: "text", description: "LLM model returned in the response" },
28-
{ name: "model", type: "text", description: "LLM model used. Is a coalesce of request_model and response_model" },
29-
{ name: "provider", type: "text", description: "LLM provider, e.g. openai, anthropic, etc." },
30-
{ name: "input_tokens", type: "bigint", description: "Number of input tokens" },
31-
{ name: "output_tokens", type: "bigint", description: "Number of output tokens" },
32-
{ name: "total_tokens", type: "bigint", description: "Total tokens used" },
33-
{ name: "input_cost", type: "double precision", description: "Cost for input tokens" },
34-
{ name: "output_cost", type: "double precision", description: "Cost for output tokens" },
35-
{ name: "total_cost", type: "double precision", description: "Total cost of the span" },
36-
{ name: "attributes", type: "text", description: "Span attributes as stringified JSON" },
37-
{ name: "trace_id", type: "uuid", description: "ID of the trace" },
38-
{ name: "tags", type: "text", description: "Tags associated with the span as a stringified JSON array of strings" },
21+
{ name: "start_time", type: "DateTime64(9, 'UTC')", description: "When the span started" },
22+
{ name: "end_time", type: "DateTime64(9, 'UTC')", description: "When the span ended" },
23+
{ name: "duration", type: "Float64", description: "Duration in seconds (end_time - start_time)" },
24+
{ name: "input", type: "String", description: "Input data for the span as a stringified JSON" },
25+
{ name: "output", type: "String", description: "Output data from the span as a stringified JSON" },
26+
{ name: "request_model", type: "String", description: "LLM model specified in the request" },
27+
{ name: "response_model", type: "String", description: "LLM model returned in the response" },
28+
{ name: "model", type: "String", description: "LLM model used. Is a coalesce of request_model and response_model" },
29+
{ name: "provider", type: "String", description: "LLM provider, e.g. openai, anthropic, etc." },
30+
{ name: "input_tokens", type: "UInt64", description: "Number of input tokens" },
31+
{ name: "output_tokens", type: "UInt64", description: "Number of output tokens" },
32+
{ name: "total_tokens", type: "UInt64", description: "Total tokens used" },
33+
{ name: "input_cost", type: "Float64", description: "Cost for input tokens" },
34+
{ name: "output_cost", type: "Float64", description: "Cost for output tokens" },
35+
{ name: "total_cost", type: "Float64", description: "Total cost of the span" },
36+
{ name: "attributes", type: "String", description: "Span attributes as stringified JSON" },
37+
{ name: "trace_id", type: "UUID", description: "ID of the trace" },
38+
{ name: "tags", type: "String", description: "Tags associated with the span as a stringified JSON array of strings" },
3939
],
4040
traces: [
4141
// Core columns
42-
{ name: "id", type: "uuid", description: "Unique identifier for the trace" },
43-
{ name: "trace_type", type: "trace_type", description: "Stringified enum value of the trace type (DEFAULT, EVALUATION)" },
44-
{ name: "metadata", type: "text", description: "Trace metadata as stringified JSON" },
45-
{ name: "start_time", type: "timestamp", description: "When the trace started" },
46-
{ name: "end_time", type: "timestamp", description: "When the trace ended" },
47-
{ name: "duration", type: "double precision", description: "Duration in seconds (end_time - start_time)" },
48-
{ name: "input_tokens", type: "bigint", description: "Number of input tokens" },
49-
{ name: "output_tokens", type: "bigint", description: "Number of output tokens" },
50-
{ name: "total_tokens", type: "bigint", description: "Total tokens used" },
51-
{ name: "input_cost", type: "double precision", description: "Cost for input tokens" },
52-
{ name: "output_cost", type: "double precision", description: "Cost for output tokens" },
53-
{ name: "total_cost", type: "double precision", description: "Total LLM cost of the trace" },
54-
{ name: "status", type: "text", description: "Status of the trace" },
55-
{ name: "user_id", type: "text", description: "User ID sent with the trace" },
56-
{ name: "session_id", type: "text", description: "Session identifier" },
57-
{ name: "top_span_id", type: "uuid", description: "ID of the top-level span" },
58-
{ name: "top_span_name", type: "text", description: "Name of the top-level span" },
42+
{ name: "id", type: "UUID", description: "Unique identifier for the trace" },
43+
{ name: "trace_type", type: "trace_type", description: "Stringified enum value of the trace type (DEFAULT, EVALUATION, PLAYGROUND)" },
44+
{ name: "metadata", type: "String", description: "Trace metadata as stringified JSON" },
45+
{ name: "start_time", type: "DateTime64(9, 'UTC')", description: "When the trace started" },
46+
{ name: "end_time", type: "DateTime64(9, 'UTC')", description: "When the trace ended" },
47+
{ name: "duration", type: "Float64", description: "Duration in seconds (end_time - start_time)" },
48+
{ name: "input_tokens", type: "Int64", description: "Number of input tokens" },
49+
{ name: "output_tokens", type: "Int64", description: "Number of output tokens" },
50+
{ name: "total_tokens", type: "Int64", description: "Total tokens used" },
51+
{ name: "input_cost", type: "Float64", description: "Cost for input tokens" },
52+
{ name: "output_cost", type: "Float64", description: "Cost for output tokens" },
53+
{ name: "total_cost", type: "Float64", description: "Total cost of the span" },
54+
{ name: "status", type: "String", description: "Status of the trace" },
55+
{ name: "user_id", type: "String", description: "User ID sent with the trace" },
56+
{ name: "session_id", type: "String", description: "Session identifier" },
57+
{ name: "top_span_id", type: "UUID", description: "ID of the top-level span" },
58+
{ name: "top_span_name", type: "String", description: "Name of the top-level span" },
5959
{ name: "top_span_type", type: "span_type", description: "Type of the top-level span" },
6060
],
6161
dataset_datapoints: [
62-
{ name: "id", type: "uuid", description: "Unique identifier for the dataset datapoint" },
63-
{ name: "created_at", type: "timestamp", description: "When the dataset datapoint was created" },
64-
{ name: "dataset_id", type: "uuid", description: "Unique identifier for the dataset" },
65-
{ name: "data", type: "jsonb", description: "Input data for the dataset datapoint" },
66-
{ name: "target", type: "jsonb", description: "Target/expected output" },
67-
{ name: "metadata", type: "jsonb", description: "Additional metadata" },
62+
{ name: "id", type: "UUID", description: "Unique identifier for the dataset datapoint" },
63+
{ name: "created_at", type: "DateTime64(9, 'UTC')", description: "When the dataset datapoint was created" },
64+
{ name: "dataset_id", type: "UUID", description: "Unique identifier for the dataset" },
65+
{ name: "data", type: "String", description: "Input data for the dataset datapoint" },
66+
{ name: "target", type: "String", description: "Target/expected output" },
67+
{ name: "metadata", type: "String", description: "Additional metadata" },
6868
],
6969
evaluation_datapoints: [
70-
{ name: "id", type: "uuid", description: "Unique identifier for the evaluation datapoint" },
71-
{ name: "evaluation_id", type: "uuid", description: "Unique identifier for the evaluation" },
72-
{ name: "trace_id", type: "uuid", description: "Unique identifier for the trace" },
73-
{ name: "created_at", type: "timestamp", description: "When the evaluation datapoint was created" },
74-
{ name: "data", type: "string", description: "Input data for the evaluation datapoint" },
75-
{ name: "target", type: "string", description: "Target/expected output" },
76-
{ name: "metadata", type: "string", description: "Additional metadata as stringified JSON" },
77-
{ name: "executor_output", type: "string", description: "Output from the executor as" },
78-
{ name: "index", type: "integer", description: "Index of the evaluation datapoint within the evaluation" },
79-
{ name: "group_id", type: "text", description: "Group identifier of the evaluation run" },
80-
{ name: "scores", type: "text", description: "Scores for the evaluation datapoint as a stringified JSON object from score name to value" },
70+
{ name: "id", type: "UUID", description: "Unique identifier for the evaluation datapoint" },
71+
{ name: "evaluation_id", type: "UUID", description: "Unique identifier for the evaluation" },
72+
{ name: "trace_id", type: "UUID", description: "Unique identifier for the trace" },
73+
{ name: "created_at", type: "DateTime64(9, 'UTC')", description: "When the evaluation datapoint was created" },
74+
{ name: "data", type: "String", description: "Input data for the evaluation datapoint" },
75+
{ name: "target", type: "String", description: "Target/expected output" },
76+
{ name: "metadata", type: "String", description: "Additional metadata as stringified JSON" },
77+
{ name: "executor_output", type: "String", description: "Output from the executor as" },
78+
{ name: "index", type: "Int64", description: "Index of the evaluation datapoint within the evaluation" },
79+
{ name: "group_id", type: "String", description: "Group identifier of the evaluation run" },
80+
{ name: "scores", type: "String", description: "Scores for the evaluation datapoint as a stringified JSON object from score name to value" },
8181
],
8282
events: [
83-
{ name: "id", type: "uuid", description: "Unique identifier for the event" },
84-
{ name: "span_id", type: "uuid", description: "Identifier of the span that the event belongs to" },
85-
{ name: "name", type: "text", description: "Name of the event" },
86-
{ name: "timestamp", type: "timestamp", description: "When the event occurred" },
87-
{ name: "attributes", type: "jsonb", description: "Attributes of the event as stringified JSON" },
88-
{ name: "trace_id", type: "uuid", description: "Identifier of the trace that the span with this event belongs to" },
89-
{ name: "user_id", type: "text", description: "User ID associated with the event" },
90-
{ name: "session_id", type: "text", description: "Session ID associated with the event" },
83+
{ name: "id", type: "UUID", description: "Unique identifier for the event" },
84+
{ name: "span_id", type: "UUID", description: "Identifier of the span that the event belongs to" },
85+
{ name: "name", type: "String", description: "Name of the event" },
86+
{ name: "timestamp", type: "DateTime64(9, 'UTC')", description: "When the event occurred" },
87+
{ name: "attributes", type: "String", description: "Attributes of the event as stringified JSON" },
88+
{ name: "trace_id", type: "UUID", description: "Identifier of the trace that the span with this event belongs to" },
89+
{ name: "user_id", type: "String", description: "User ID associated with the event" },
90+
{ name: "session_id", type: "String", description: "Session ID associated with the event" },
9191
],
9292
tags: [
93-
{ name: "id", type: "uuid", description: "Unique identifier for the tag" },
94-
{ name: "span_id", type: "uuid", description: "Identifier of the span that the tag belongs to" },
95-
{ name: "name", type: "text", description: "Name of the tag" },
96-
{ name: "created_at", type: "timestamp", description: "When the tag was created" },
93+
{ name: "id", type: "UUID", description: "Unique identifier for the tag" },
94+
{ name: "span_id", type: "UUID", description: "Identifier of the span that the tag belongs to" },
95+
{ name: "name", type: "String", description: "Name of the tag" },
96+
{ name: "created_at", type: "DateTime64(9, 'UTC')", description: "When the tag was created" },
9797
{ name: "source", type: "tag_source", description: "Source of the tag as a stringified enum value" },
9898
],
9999
};
100100

101101
const enumValues = {
102-
trace_type: ["DEFAULT", "EVALUATION"],
102+
trace_type: ["DEFAULT", "EVALUATION", "PLAYGROUND"],
103103
span_type: ["DEFAULT", "LLM", "EXECUTOR", "EVALUATOR", "EVALUATION", "TOOL"],
104104
tag_source: ["HUMAN", "CODE"],
105105
};

0 commit comments

Comments
 (0)