Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ altertable query show|cancel
| `--layout <AUTO\|TABLE\|LINE>` | Human layout: auto, table, or line Values: auto, table, line. |
| `--columns <COLUMNS>` | Comma-separated columns to show |
| `--max-width <MAX-WIDTH>` | Maximum display width for table columns Default: "32". |
| `--compute-size <XS\|S\|M\|L\|XL\|AUTO>` | Compute size for the query Values: XS, S, M, L, XL, AUTO. Default: "AUTO". |
| `--compute-size <COMPUTE-SIZE>` | Compute size for the query Default: "AUTO". |
| `--dialect <DIALECT>` | Source SQL dialect to transpile from (server default: DuckDB) |
| `--catalog <CATALOG>` | Catalog name (optional; can also come from the session) |
| `--schema <SCHEMA>` | Schema name (optional; can also come from the session) |
Expand Down
11 changes: 2 additions & 9 deletions cli-reference.json
Original file line number Diff line number Diff line change
Expand Up @@ -1172,19 +1172,12 @@
{
"name": "compute-size",
"aliases": [],
"type": "enum",
"type": "string",
"description": "Compute size for the query",
"required": false,
"repeatable": false,
"scope": "command",
"values": [
"XS",
"S",
"M",
"L",
"XL",
"AUTO"
],
"values": [],
"default": "AUTO"
},
{
Expand Down
5 changes: 1 addition & 4 deletions cli/src/lib/lakehouse/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ import { STREAM_READ_TIMEOUT_MS } from "@/lib/transport-defaults.ts";

export type LakehouseApiQueryFormat = "csv" | "jsonl" | "parquet";

export const LAKEHOUSE_COMPUTE_SIZES = ["XS", "S", "M", "L", "XL", "AUTO"] as const;
export type LakehouseComputeSize = (typeof LAKEHOUSE_COMPUTE_SIZES)[number];

export type LakehouseQueryInput = {
statement: string;
queryId?: string;
sessionId?: string;
computeSize?: LakehouseComputeSize;
computeSize?: string;
format?: LakehouseApiQueryFormat;
dialect?: string;
catalog?: string;
Expand Down
25 changes: 5 additions & 20 deletions cli/src/lib/query-output-args.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { asCliArgString } from "@/lib/cli-args.ts";
import { defineArguments } from "@/lib/command.ts";
import { CliError } from "@/lib/errors.ts";
import { LAKEHOUSE_COMPUTE_SIZES, type LakehouseComputeSize } from "@/lib/lakehouse/query.ts";
import {
isApiNativeQueryFormat,
parseQueryResultFormat,
Expand Down Expand Up @@ -68,10 +67,9 @@ export const queryPagerArgs = defineArguments({

export const queryRequestArgs = defineArguments({
"compute-size": {
type: "enum",
type: "string",
description: "Compute size for the query",
default: "AUTO",
options: [...LAKEHOUSE_COMPUTE_SIZES],
},
dialect: {
type: "string",
Expand All @@ -96,7 +94,7 @@ export type QueryOutputOptions = {
displayOptions: QueryDisplayOptions;
pagerOptions: PagerOptions;
outputPath?: string;
computeSize?: LakehouseComputeSize;
computeSize?: string;
dialect?: string;
catalog?: string;
schema?: string;
Expand Down Expand Up @@ -192,22 +190,11 @@ function optionalTrimmedString(args: Record<string, unknown>, name: string): str
return trimmed === "" ? undefined : trimmed;
}

function isLakehouseComputeSize(value: string): value is LakehouseComputeSize {
return (LAKEHOUSE_COMPUTE_SIZES as readonly string[]).includes(value);
}

function parseLakehouseComputeSize(value: string): LakehouseComputeSize {
if (!isLakehouseComputeSize(value)) {
throw new CliError(`--compute-size must be one of ${LAKEHOUSE_COMPUTE_SIZES.join(", ")}.`);
}
return value;
}

export function resolveQueryComputeSize(options: {
sessionId?: string;
computeSizeArg?: LakehouseComputeSize;
computeSizeArg?: string;
computeSizeExplicit: boolean;
}): LakehouseComputeSize | undefined {
}): string | undefined {
const computeSize = options.computeSizeArg ?? "AUTO";

if (options.sessionId && !options.computeSizeExplicit) return undefined;
Expand All @@ -228,9 +215,7 @@ export function parseQueryOutputOptions(
const computeSize = resolveQueryComputeSize({
sessionId,
computeSizeArg:
args["compute-size"] === undefined
? undefined
: parseLakehouseComputeSize(asCliArgString(args["compute-size"])),
args["compute-size"] === undefined ? undefined : asCliArgString(args["compute-size"]),
computeSizeExplicit: hasArgvFlag(options.rawArgs, "--compute-size"),
});

Expand Down
1 change: 1 addition & 0 deletions specs
Submodule specs added at 379083
2 changes: 0 additions & 2 deletions specs/.gitignore

This file was deleted.

81 changes: 0 additions & 81 deletions specs/AGENTS.md

This file was deleted.

21 changes: 0 additions & 21 deletions specs/LICENSE

This file was deleted.

69 changes: 0 additions & 69 deletions specs/README.md

This file was deleted.

Loading