Skip to content

protocol: add v2 protocol design - #18

Draft
tkilias wants to merge 21 commits into
mainfrom
documentation/design_v2_protocol
Draft

protocol: add v2 protocol design#18
tkilias wants to merge 21 commits into
mainfrom
documentation/design_v2_protocol

Conversation

@tkilias

@tkilias tkilias commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds the v2 UDF protocol design and FlatBuffer schema.

The design separates low-level transport rules, generic call lifecycle, generic data-stream behavior, and high-level DB/UDFRunner orchestration. It includes Mermaid source diagrams and their rendered SVGs.

Impact

Defines the proposed v2 protocol contract, including framing, stream ownership, schema and record-batch ordering, flow control, transport bindings, close semantics, and high-level call behavior.

Validation

  • Rendered and visually inspected all updated Mermaid state diagrams.
  • Ran git diff --check before squashing the branch.

Comment thread udf-runner-cpp/v2/json_schema/call_metadata.schema.json
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
| `TIMESTAMP` | `Timestamp(unit, "")` | Select the smallest unit preserving declared precision. |
| `TIMESTAMP WITH LOCAL TIME ZONE` | `Timestamp(unit, "UTC")` | Normalize Exasol's UTC-normalized value for transport. |
| `DATE` | `Date(Day)` | Preserve calendar-day semantics. |
| `CHAR` | `Utf8` | Preserve fixed-length padding and character metadata as Exasol semantics. |

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are not sending the padding or receiving the padding

- `DOUBLE PRECISION` maps to `FloatingPoint(Double)`.
- `1 <= p <= 9` maps to `Decimal(32)` with `bit_width = 32`.
- `10 <= p <= 18` maps to `Decimal(64)` with `bit_width = 64`.
- `19 <= p <= 36` maps to `Decimal(128)` with `bit_width = 128`.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `19 <= p <= 36` maps to `Decimal(128)` with `bit_width = 128`.
- `19 <= p <= 38` maps to `Decimal(128)` with `bit_width = 128`.

Comment on lines +24 to +40
Every `Run` and Function call uses one `call_metadata` JSON payload. It may be sent on control stream `0` before any
call is sent or between calls, or in the same `StreamMessage` as `OpenCall`. It conforms to
[call_metadata.schema.json](../../../../../udf-runner-cpp/v2/json_schema/call_metadata.schema.json) and supplies the
per-invocation execution context and iterator settings. Metadata sent before any call or between calls applies to
subsequent calls. Metadata sent with `OpenCall` applies to that call and subsequent calls. The latest received value
replaces the previous value. It is not sent during an active call.

Column definitions are carried separately in one `column_metadata` JSON payload. It conforms to
[column_metadata.schema.json](../../../../../udf-runner-cpp/v2/json_schema/column_metadata.schema.json) and may be
sent on control stream `0` before any call is sent or between calls, or in the same `StreamMessage` as `OpenCall`.
Metadata sent before any call or between calls applies to subsequent calls. Metadata sent with `OpenCall` applies to
that call and subsequent calls. The latest received value replaces the previous value. It is not sent during an active
call. Column `type` values use official Exasol type families, while `type_name` carries the
complete parameterized Exasol SQL declaration. Their Arrow physical representation and metadata rules are defined in
[type_mapping.md](type_mapping.md). The shared column-definition contract is defined in
[column.schema.json](../../../../../udf-runner-cpp/v2/json_schema/column.schema.json) and is referenced by both column
metadata and import specifications.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the rule for when the metadata can be sent and when it is valid or get overriden is identical can be explained ones

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant