Skip to content

Commit da8ef98

Browse files
rustyconoverclaude
andcommitted
Add MultiplyFunction to worker and show const flag in catalog CLI
- Add MultiplyFunction to ExampleWorker's functions list - Update arrow_schema_to_json to extract and display const metadata for ConstParam arguments Now the catalog CLI shows: - multiply: {"name": "factor", "type": "int64", "const": true} - polars_multiply: {"name": "factor", "type": "any", "const": true} Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 84586b2 commit da8ef98

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

vgi/client/cli_utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def arrow_schema_to_json(serialized: bytes) -> list[dict[str, Any]]:
172172
serialized: Serialized Arrow schema bytes
173173
174174
Returns:
175-
List of column definitions with name, type, and optional varargs flag
175+
List of column definitions with name, type, and optional flags (varargs, const)
176176
177177
"""
178178
reader = pa.BufferReader(serialized)
@@ -181,6 +181,7 @@ def arrow_schema_to_json(serialized: bytes) -> list[dict[str, Any]]:
181181
for f in schema:
182182
type_str = str(f.type)
183183
is_varargs = False
184+
is_const = False
184185
if f.metadata:
185186
# Check for vgi:any metadata (output schema)
186187
if f.metadata.get(b"vgi:any") == b"true":
@@ -193,10 +194,15 @@ def arrow_schema_to_json(serialized: bytes) -> list[dict[str, Any]]:
193194
# Check for varargs metadata
194195
if f.metadata.get(b"vgi_varargs") == b"true":
195196
is_varargs = True
197+
# Check for const metadata (ConstParam)
198+
if f.metadata.get(b"vgi_const") == b"true":
199+
is_const = True
196200

197201
entry: dict[str, Any] = {"name": f.name, "type": type_str}
198202
if is_varargs:
199203
entry["varargs"] = True
204+
if is_const:
205+
entry["const"] = True
200206
result.append(entry)
201207
return result
202208

vgi/examples/worker.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from vgi.examples.scalar import (
2525
AddValuesFunction,
2626
DoubleFunction,
27+
MultiplyFunction,
2728
NullHandlingFunction,
2829
RandomIntFunction,
2930
SumValuesFunction,
@@ -108,6 +109,7 @@ class Settings:
108109
# ScalarFunctionGenerator - transform to single-column output
109110
AddValuesFunction,
110111
DoubleFunction,
112+
MultiplyFunction,
111113
NullHandlingFunction,
112114
RandomIntFunction,
113115
SumValuesFunction,

0 commit comments

Comments
 (0)