Skip to content

feature - implement RFC 020 nested scalar functions#46

Merged
dannymeijer merged 4 commits into
mainfrom
feature/37-rfc020-nested-data
May 27, 2026
Merged

feature - implement RFC 020 nested scalar functions#46
dannymeijer merged 4 commits into
mainfrom
feature/37-rfc020-nested-data

Conversation

@dannymeijer
Copy link
Copy Markdown
Collaborator

@dannymeijer dannymeijer commented May 25, 2026

Summary

Implements RFC 020 nested data functions as scalar, registry-backed InQL helpers for arrays, maps, and named structs. The branch keeps relation-cardinality-changing generator behavior reserved for RFC 021 while adding concrete Substrait mappings and DataFusion-backed execution coverage for nested scalar projections.

Type of change

  • Bug fix
  • New feature
  • Refactor / maintenance
  • Documentation
  • CI / tooling
  • RFC (adds/updates docs/rfcs/*)

Area(s)

  • Package & tests
  • Specification (RFCs)
  • Documentation
  • Automation & repo config
  • Other

Key details

  • User-facing behavior: Authors can build and inspect nested scalar values with helpers such as array(...), cardinality(...), array_contains(...), arrays_overlap(...), element_at(...), array_flatten(...), map_from_arrays(...), map_extract(...), map_contains_key(...), map_keys(...), map_values(...), map_entries(...), and named_struct(...).
  • Internals: Adds a src/functions/nested/ helper family using declaration-side registry metadata, stable Substrait function anchors, concrete extension mappings where supported, and a documented map_contains_key(...) rewrite over existing scalar applications.
  • Source quality cleanup: Nested helpers call registered_application(...) directly instead of routing through a one-line wrapper.
  • Registry guardrail: Updates make registry-metadata to follow @register_function(...) decorator metadata, derive canonical names from checked callable metadata by default, and honor explicit canonical_name overrides. This prevents the guardrail from passing with zero helpers.
  • Risks: Nested function semantics depend on backend nested UDF support. The PR documents one-based indexing and current recoverable element_at(...) adapter behavior instead of pretending a strict/try split exists yet.

Merge Order

#44 and #45 are merged. This PR targets main directly and can be reviewed as the RFC 020 follow-up.

Testing / verification

Post-#45 retarget verification:

  • make fmt INCAN=/Users/danny/Development/encero/incan/target/debug/incan
  • incan test tests/test_nested_data_functions.incn (3 passed)
  • incan test tests/test_function_registry.incn (13 passed)
  • incan test tests/test_substrait_plan.incn (21 passed)
  • incan test tests/test_session_projection.incn (10 passed)
  • make fmt-check INCAN=/Users/danny/Development/encero/incan/target/debug/incan
  • make test-style
  • make registry-metadata INCAN=/Users/danny/Development/encero/incan/target/debug/incan (78 helpers)
  • make build INCAN=/Users/danny/Development/encero/incan/target/debug/incan
  • make test INCAN=/Users/danny/Development/encero/incan/target/debug/incan (127 passed)
  • make smoke-consumer INCAN=/Users/danny/Development/encero/incan/target/debug/incan
  • make pre-commit INCAN=/Users/danny/Development/encero/incan/target/debug/incan (127 passed)

After source-quality cleanup:

  • incan test tests/test_nested_data_functions.incn (3 passed)
  • incan test tests/test_function_registry.incn (13 passed)
  • make pre-commit INCAN=/Users/danny/Development/encero/incan/target/debug/incan (127 passed)
  • make smoke-consumer INCAN=/Users/danny/Development/encero/incan/target/debug/incan

Docs impact

  • No docs changes needed
  • Docs updated
  • Docs follow Divio intent (tutorial/how-to/reference/explanation) where applicable

If docs updated:

  • Link(s): docs/language/reference/functions/nested.md, docs/language/reference/functions/index.md, docs/release_notes/v0_1.md, docs/rfcs/020_nested_data_functions.md

Checklist

  • I kept public docs user-focused and moved internals to contributing docs when appropriate
  • I avoided duplicating canonical install/run instructions in multiple places
  • I added/updated tests where it materially reduces regressions

Closes #37

@incan-triage-bot incan-triage-bot Bot added documentation Improvements or additions to documentation package Library source, tests, incan.toml specification docs/rfcs/ normative RFCs labels May 25, 2026
@dannymeijer dannymeijer deleted the branch main May 27, 2026 13:27
@dannymeijer dannymeijer added this to the InQL-v0.1 milestone May 27, 2026
@dannymeijer dannymeijer reopened this May 27, 2026
@dannymeijer dannymeijer changed the base branch from feature/34-rfc017-aggregate-modifiers to main May 27, 2026 13:31
@dannymeijer dannymeijer force-pushed the feature/37-rfc020-nested-data branch from 76cdb21 to 3a03dd1 Compare May 27, 2026 13:35
@dannymeijer dannymeijer self-assigned this May 27, 2026
@incan-triage-bot incan-triage-bot Bot added the automation CI, Makefile, .github/, repo config label May 27, 2026
@dannymeijer dannymeijer marked this pull request as ready for review May 27, 2026 15:10
@dannymeijer dannymeijer merged commit fea3084 into main May 27, 2026
4 checks passed
@dannymeijer dannymeijer deleted the feature/37-rfc020-nested-data branch May 27, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation CI, Makefile, .github/, repo config documentation Improvements or additions to documentation package Library source, tests, incan.toml specification docs/rfcs/ normative RFCs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RFC 020: Nested data functions

1 participant