Skip to content

Preserve the complete plan envelope #27

Open

Description

@yongchul

Priority: P1
Gap: Existing + Drift
Dependencies: #25; type aliases also depend on #42

The internal plan retains only roots and version. Add representations and
bidirectional conversion for advanced extensions, expected type URLs, dynamic
parameter bindings, type aliases, execution behavior, and extension URNs and
declarations. Include extension type declarations, which the serializer's
collector can identify but does not emit.

Acceptance criteria:

  • Every field on the baseline Plan message is either preserved or rejected
    with a documented, typed error.
  • Unknown Any payloads survive a proto-to-core-to-proto round trip.
  • Extension type, type variation, and function anchors remain stable.
  • Tests cover parameter bindings, aliases, execution behavior, and URNs.

Evidence: Plan.cs and the two plan
converters only carry roots, version, and collected function/type-variation
declarations.


Baseline: substrait-csharp b05373705290e2dd8427ff920442e72141056160 compared with substrait-io/substrait main at 8ca7db0e8e0969b78fc54c65d8587796fa0363ab. Tracking item 3 of 24.

Activity

  1. added
    enhancement
    on Sep 15, 2026
  2. yongchul commented on Oct 13, 2026

    @yongchul
    ContributorAuthor

    Proposed UDT follow-up after #83

    Reviewed against merged main 8ddcbb0e80c6548cd76ba54fbd4f56c2905b17fc. The core UDT/type-parameter slice (#76) is complete. This follow-up remains part of this issue; it does not require a duplicate tracker.

    The original baseline description is historical: plans already retain ordered root/non-root relations, advanced extensions, and expected type URLs. At that baseline, extension URNs/declarations are used for import lookup but are not retained in the core plan.

    The agreed scope now combines both steps below in one follow-up PR.

    1. Enable self-contained UDT plan export

    • Emit collected type declarations, including dependencies in nested DataType parameters, using one shared context across all root/non-root entries.
    • Preserve existing fresh-plan numbering and ordering: type/function anchors start at 0, variations at 1, and URNs at 1. Keep each reference namespace independent.
    • Cover repeated identities, distinct namespaces, mixed type/type-variation/function declarations, deterministic output, and binary/JSON round trips.
    • Preserve strict registered-definition resolution and permissive identity retention without definitions. Undeclared numeric references must continue to fail.

    2. Retain serialization bindings while keeping the core model canonical

    • Keep immutable snapshots of imported URNs and all three declaration kinds in PlanMetadata, including original order, numeric anchors, aliases, apparently unused entries, and unknown fields.
    • Do not remove or renumber retained entries: opaque extension payloads may reference any of them, even if no core node does. Do not inspect or rewrite opaque payloads.
    • Keep core references semantic, without per-node numeric-anchor provenance. Export each identity through its smallest existing declaration anchor, while retaining every alias in the table. This is not a byte-for-byte round-trip guarantee.
    • Seed allocation from retained tables. Added dependencies reuse the smallest matching URN anchor and receive the first free anchor in their declaration namespace. Newly constructed plans without imported tables still export only their used dependencies.
    • Preserve the snapshots through every import entry point, plan construction, and PlanBuilder metadata edits. Public protobuf inputs/outputs remain detached; privately parsed messages can be retained without redundant cloning.
    • Include retained tables in metadata equality/hashing because their bindings can change opaque payload meaning. Consequently, a new plan and its imported export may have equal core relations but different metadata.
    • Support the full protobuf uint32 anchor domain without removing existing signed collector APIs. Reject duplicate numeric anchors within a namespace, missing URNs, blank names/URNs, unset mappings, and reserved variation anchor 0 explicitly. Multiple anchors for one semantic identity remain valid.
    • Cover sparse/high anchors including uint.MaxValue, aliases in all declaration namespaces, opaque payload retention, new-dependency collisions, source/output detachment, builder snapshots, and binary/JSON/stream/file entry points. Update generated facades, public API baselines, and compatibility documentation.

    Validation and boundaries

    Use focused TUnit plan/type/metadata tests on .NET 8 and .NET 10, followed by the documented formatting, all-target build, metadata-generation check, and full suite before publishing.

    Neither step closes the whole plan-envelope issue. Parameter bindings, aliases, and execution behavior remain separate work here. YAML definitions/parameter contracts remain in #46; user-defined literal payloads in #40; cross-kind completion coverage in #79.

  3. anasik commented on Nov 26, 2026

    @anasik
    Contributor

    @yongchul taking this

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions