Skip to content

Commit 76f07c5

Browse files
committed
fix(databricks): preserve saved controls and correct output contracts
1 parent 48145ed commit 76f07c5

23 files changed

Lines changed: 191 additions & 153 deletions

‎apps/docs/content/docs/integrations/databricks.mdx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ Retrieve one chunk of an INLINE SQL result using nextChunkIndex from Execute SQL
120120

121121
| Parameter | Type | Description |
122122
| --------- | ---- | ----------- |
123-
| `data` | array | Result rows as a 2D array; each non-null value is a string and null values stay null |
124123
| `chunkIndex` | number | Index of this result chunk |
125124
| `rowOffset` | number | Starting row offset of this chunk |
126125
| `rowCount` | number | Number of rows in this chunk |
127126
| `nextChunkIndex` | number | Next chunk to retrieve with Get Statement Chunk; null on the final chunk |
128127
| `nextChunkInternalLink` | string | Workspace-relative path to the next result chunk |
128+
| `data` | array | Result rows as a 2D array; each non-null value is a string and null values stay null |
129129

130130
### Databricks Cancel Statement
131131

@@ -579,6 +579,8 @@ Get the status, timing, and details of a Databricks job run by its run ID.
579579
| ↳ `code` | string | |
580580
| ↳ `message` | string | |
581581
| `repairHistory` | array | Prior repairs; pass the latest id to Repair Run |
582+
| ↳ `id` | number | |
583+
| ↳ `task_run_ids` | array | |
582584
| ↳ `status` | object | Run lifecycle and termination or queue details |
583585
| ↳ `state` | string | Current lifecycle state |
584586
| ↳ `termination_details` | object | |
@@ -588,8 +590,6 @@ Get the status, timing, and details of a Databricks job run by its run ID.
588590
| ↳ `queue_details` | object | |
589591
| ↳ `code` | string | |
590592
| ↳ `message` | string | |
591-
| ↳ `id` | number | |
592-
| ↳ `task_run_ids` | array | |
593593
| `jobParameters` | array | Resolved job parameter values |
594594
| `runDuration` | number | Run duration including repairs in milliseconds |
595595
| `nextPageToken` | string | Token for the next page of tasks or job clusters |
@@ -1414,7 +1414,7 @@ Ask a Databricks Genie space a question in natural language and wait for the ans
14141414
| ↳ `typeName` | string | Column type \(STRING, INT, LONG, DOUBLE, BOOLEAN, TIMESTAMP, DATE, DECIMAL, etc.\) |
14151415
| `data` | array | Result rows as a 2D array; each non-null value is a string and null values stay null |
14161416
| `totalRows` | number | Total number of rows in the result |
1417-
| `truncated` | boolean | Whether the result set was truncated |
1417+
| `truncated` | boolean | Whether the result set was truncated; null when no query result was retrieved |
14181418

14191419
### Databricks Genie Get Message
14201420

‎apps/sim/blocks/blocks/databricks.ts‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,12 @@ export const DatabricksBlock: BlockConfig = {
361361
{
362362
id: 'expandTasks',
363363
title: 'Expand Tasks',
364-
type: 'switch',
364+
type: 'dropdown',
365+
options: [
366+
{ label: 'No', id: 'false' },
367+
{ label: 'Yes', id: 'true' },
368+
],
369+
value: () => 'false',
365370
condition: { field: 'operation', value: ['list_jobs', 'list_runs'] },
366371
mode: 'advanced',
367372
},
@@ -472,29 +477,49 @@ Return ONLY a valid JSON object - no explanations, no extra text.`,
472477
{
473478
id: 'includeHistory',
474479
title: 'Include History',
475-
type: 'switch',
480+
type: 'dropdown',
481+
options: [
482+
{ label: 'No', id: 'false' },
483+
{ label: 'Yes', id: 'true' },
484+
],
485+
value: () => 'false',
476486
condition: { field: 'operation', value: 'get_run' },
477487
mode: 'advanced',
478488
},
479489
{
480490
id: 'includeResolvedValues',
481491
title: 'Include Resolved Values',
482-
type: 'switch',
492+
type: 'dropdown',
493+
options: [
494+
{ label: 'No', id: 'false' },
495+
{ label: 'Yes', id: 'true' },
496+
],
497+
value: () => 'false',
483498
condition: { field: 'operation', value: 'get_run' },
484499
mode: 'advanced',
485500
},
486501

487502
{
488503
id: 'activeOnly',
489504
title: 'Active Only',
490-
type: 'switch',
505+
type: 'dropdown',
506+
options: [
507+
{ label: 'No', id: 'false' },
508+
{ label: 'Yes', id: 'true' },
509+
],
510+
value: () => 'false',
491511
condition: { field: 'operation', value: 'list_runs' },
492512
mode: 'advanced',
493513
},
494514
{
495515
id: 'completedOnly',
496516
title: 'Completed Only',
497-
type: 'switch',
517+
type: 'dropdown',
518+
options: [
519+
{ label: 'No', id: 'false' },
520+
{ label: 'Yes', id: 'true' },
521+
],
522+
value: () => 'false',
498523
condition: { field: 'operation', value: 'list_runs' },
499524
mode: 'advanced',
500525
},

‎apps/sim/tools/databricks/create_cluster.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,6 @@ export const createClusterTool: ToolConfig<
304304
return { success: true, output: { clusterId: data.cluster_id ?? null } }
305305
},
306306
outputs: {
307-
clusterId: { type: 'string', optional: true, description: 'Compute cluster identifier' },
307+
clusterId: { type: 'string', nullable: true, description: 'Compute cluster identifier' },
308308
},
309309
}

‎apps/sim/tools/databricks/create_job.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const createJobTool: ToolConfig<DatabricksCreateJobParams, DatabricksCrea
218218
'array'
219219
),
220220
name: optionalDatabricksString(params.name),
221-
description: params.description ?? undefined,
221+
description: optionalDatabricksString(params.description),
222222
email_notifications: parseDatabricksJson(
223223
params.emailNotifications,
224224
'emailNotifications',
@@ -271,6 +271,6 @@ export const createJobTool: ToolConfig<DatabricksCreateJobParams, DatabricksCrea
271271
return { success: true, output: { jobId: data.job_id ?? null } }
272272
},
273273
outputs: {
274-
jobId: { type: 'number', optional: true, description: 'Job identifier' },
274+
jobId: { type: 'number', nullable: true, description: 'Job identifier' },
275275
},
276276
}

‎apps/sim/tools/databricks/create_warehouse.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,6 @@ export const createWarehouseTool: ToolConfig<
133133
return { success: true, output: { warehouseId: data.id ?? null } }
134134
},
135135
outputs: {
136-
warehouseId: { type: 'string', optional: true, description: 'SQL warehouse identifier' },
136+
warehouseId: { type: 'string', nullable: true, description: 'SQL warehouse identifier' },
137137
},
138138
}

‎apps/sim/tools/databricks/genie_ask.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@ export const genieAskTool: ToolConfig<DatabricksGenieAskParams, DatabricksGenieA
232232
outputs: {
233233
...GENIE_MESSAGE_OUTPUT_PROPERTIES,
234234
...STATEMENT_RESULT_OUTPUT_PROPERTIES,
235+
truncated: {
236+
type: 'boolean',
237+
nullable: true,
238+
description: 'Whether the result set was truncated; null when no query result was retrieved',
239+
},
235240
rowCount: GENIE_MESSAGE_OUTPUT_PROPERTIES.rowCount,
236241
},
237242
}

‎apps/sim/tools/databricks/genie_create_space.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ export const genieCreateSpaceTool: ToolConfig<
7171
warehouse_id: params.warehouseId,
7272
parent_path: optionalDatabricksString(params.parentPath),
7373
serialized_space: params.serializedSpace,
74-
title: params.title ?? undefined,
75-
description: params.description ?? undefined,
74+
title: optionalDatabricksString(params.title),
75+
description: optionalDatabricksString(params.description),
7676
})
7777
},
7878
},
@@ -89,7 +89,7 @@ export const genieCreateSpaceTool: ToolConfig<
8989
...GENIE_SPACE_OUTPUT_PROPERTIES,
9090
serializedSpace: {
9191
type: 'string',
92-
optional: true,
92+
nullable: true,
9393
description:
9494
'Serialized Genie configuration (data_sources, instructions, config, benchmarks)',
9595
},

‎apps/sim/tools/databricks/genie_update_space.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ export const genieUpdateSpaceTool: ToolConfig<
8686
body: (params) => {
8787
return filterUndefined({
8888
serialized_space: optionalDatabricksString(params.serializedSpace),
89-
title: params.title ?? undefined,
90-
description: params.description ?? undefined,
89+
title: optionalDatabricksString(params.title),
90+
description: optionalDatabricksString(params.description),
9191
warehouse_id: optionalDatabricksString(params.warehouseId),
9292
etag: optionalDatabricksString(params.etag),
9393
parent_path: optionalDatabricksString(params.parentPath),
@@ -107,7 +107,7 @@ export const genieUpdateSpaceTool: ToolConfig<
107107
...GENIE_SPACE_OUTPUT_PROPERTIES,
108108
serializedSpace: {
109109
type: 'string',
110-
optional: true,
110+
nullable: true,
111111
description:
112112
'Serialized Genie configuration (data_sources, instructions, config, benchmarks)',
113113
},

‎apps/sim/tools/databricks/get_cluster.ts‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ export const getClusterTool: ToolConfig<DatabricksGetClusterParams, DatabricksGe
9191
type: 'object',
9292
description: 'Cluster detail',
9393
properties: {
94-
policyId: { type: 'string', optional: true, description: 'Compute policy identifier' },
95-
dataSecurityMode: { type: 'string', optional: true, description: 'Cluster access mode' },
94+
policyId: { type: 'string', nullable: true, description: 'Compute policy identifier' },
95+
dataSecurityMode: { type: 'string', nullable: true, description: 'Cluster access mode' },
9696
terminatedTime: {
9797
type: 'number',
98-
optional: true,
98+
nullable: true,
9999
description: 'Cluster termination time in epoch milliseconds',
100100
},
101-
customTags: { type: 'object', optional: true, description: 'Custom cluster tags' },
101+
customTags: { type: 'object', nullable: true, description: 'Custom cluster tags' },
102102
terminationReason: {
103103
type: 'object',
104-
optional: true,
104+
nullable: true,
105105
description: 'Reason for termination (code, type, parameters)',
106106
properties: {
107107
code: { type: 'string' },
@@ -130,12 +130,12 @@ export const getClusterTool: ToolConfig<DatabricksGetClusterParams, DatabricksGe
130130
numWorkers: {
131131
type: 'number',
132132
description: 'Number of worker nodes (for fixed-size clusters)',
133-
optional: true,
133+
nullable: true,
134134
},
135135
autoscale: {
136136
type: 'object',
137137
description: 'Autoscaling configuration (null for fixed-size clusters)',
138-
optional: true,
138+
nullable: true,
139139
properties: {
140140
minWorkers: { type: 'number', description: 'Minimum number of workers' },
141141
maxWorkers: { type: 'number', description: 'Maximum number of workers' },
@@ -152,7 +152,7 @@ export const getClusterTool: ToolConfig<DatabricksGetClusterParams, DatabricksGe
152152
startTime: {
153153
type: 'number',
154154
description: 'Cluster start timestamp (epoch ms)',
155-
optional: true,
155+
nullable: true,
156156
},
157157
},
158158
},

‎apps/sim/tools/databricks/get_job.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResp
9494
outputs: {
9595
tasks: JOB_TASK_OUTPUT,
9696
jobClusters: JOB_CLUSTERS_OUTPUT,
97-
description: { type: 'string', optional: true, description: 'Job description' },
97+
description: { type: 'string', nullable: true, description: 'Job description' },
9898
parameters: {
9999
type: 'array',
100100
description: 'Job parameter definitions',
@@ -105,13 +105,13 @@ export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResp
105105
},
106106
queue: {
107107
type: 'object',
108-
optional: true,
108+
nullable: true,
109109
description: 'Job queue settings',
110110
properties: { enabled: { type: 'boolean' } },
111111
},
112112
triggerState: {
113113
type: 'object',
114-
optional: true,
114+
nullable: true,
115115
description: 'Current file-arrival, table-update, or periodic trigger state',
116116
properties: {
117117
file_arrival: { type: 'object', properties: { using_file_events: { type: 'boolean' } } },
@@ -135,7 +135,7 @@ export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResp
135135
},
136136
nextPageToken: {
137137
type: 'string',
138-
optional: true,
138+
nullable: true,
139139
description: 'Token for the next page of tasks or job clusters',
140140
},
141141

@@ -149,7 +149,7 @@ export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResp
149149
timeoutSeconds: {
150150
type: 'number',
151151
description: 'Job-level timeout in seconds (0 or null means no timeout)',
152-
optional: true,
152+
nullable: true,
153153
},
154154
schedule: {
155155
type: 'object',
@@ -160,12 +160,12 @@ export const getJobTool: ToolConfig<DatabricksGetJobParams, DatabricksGetJobResp
160160
timezone_id: { type: 'string' },
161161
pause_status: { type: 'string' },
162162
},
163-
optional: true,
163+
nullable: true,
164164
},
165165
tags: {
166166
type: 'object',
167167
description: 'Key-value tags applied to the job',
168-
optional: true,
168+
nullable: true,
169169
},
170170
},
171171
}

0 commit comments

Comments
 (0)