Skip to content

feat: fix schema procedure types and mandatory for Simba BI connector#4186

Open
imilinovic wants to merge 5 commits into
masterfrom
feat/schema-expand-v2
Open

feat: fix schema procedure types and mandatory for Simba BI connector#4186
imilinovic wants to merge 5 commits into
masterfrom
feat/schema-expand-v2

Conversation

@imilinovic
Copy link
Copy Markdown
Contributor

@imilinovic imilinovic commented May 28, 2026

Make schema.node_type_properties / rel_type_properties emit type strings the Simba BI connector (PowerBI/Tableau) recognises, so properties map to proper SQL types instead of degrading to VARCHAR:

  • Bool -> Boolean, Double -> Float, ZonedDateTime -> DateTime, Point2d/3d -> Point
  • Int kept (the connector maps "Integer" to VARCHAR despite its docs claiming BIGINT)

Fix mandatory semantics: now driven by existence constraints (label-aware) instead of the sampling-ratio heuristic. Relationships always report mandatory=false (no rel-type existence constraints in Memgraph).

Breaking

  • propertyTypes strings rename: BoolBoolean, DoubleFloat, ZonedDateTimeDateTime, Point2d/Point3dPoint. Consumers that pattern-matched the old strings must update.
  • mandatory semantics change without a column rename: same field, new meaning. Code that relied on sample-coverage mandatory (e.g. true whenever every sampled node carried the property) will now see false unless an existence constraint is declared. Relationships always report false.

@imilinovic imilinovic added this to the mg-v3.11.0 milestone May 28, 2026
@imilinovic imilinovic self-assigned this May 28, 2026
@imilinovic imilinovic added bug bug Docs needed Docs needed customer customer labels May 28, 2026
@imilinovic
Copy link
Copy Markdown
Contributor Author

imilinovic commented May 28, 2026

Tracking

  • [Link to Epic/Issue]

Standard development

CI Testing Labels

  • Select the appropriate CI test labels (CI -build=build-name -test=test-suite)

Documentation checklist

  • Add the documentation label
  • Add the bug / feature label
  • Add the milestone for which this feature is intended
    • If not known, set for a later milestone
  • Write a release note, including added/changed clauses
    • schema.node_type_properties() / schema.rel_type_properties() rename type strings (BoolBoolean, DoubleFloat, ZonedDateTimeDateTime, Point2d/Point3dPoint) and now derive mandatory from existence constraints rather than sample coverage (always false for relationships). Consumers that pattern-matched the old type strings or relied on the sampling heuristic must be updated. #4186
  • [ Documentation PR link docs: schema procedure types and mandatory for Simba BI connector documentation#1648 ]
    • Is back linked to this development PR

@imilinovic imilinovic force-pushed the feat/schema-expand-v2 branch from a312358 to e44ee5b Compare May 28, 2026 10:00
@imilinovic imilinovic changed the title feat: Fix schema procedure types and mandatory for Simba BI connector feat: fix schema procedure types and mandatory for Simba BI connector May 28, 2026
@imilinovic imilinovic requested a review from DavIvek May 28, 2026 10:23
@imilinovic imilinovic marked this pull request as ready for review May 28, 2026 10:23
Copilot AI review requested due to automatic review settings May 28, 2026 10:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the schema.node_type_properties and schema.rel_type_properties query module outputs to better match the Simba BI (PowerBI/Tableau) connector’s expected type strings and to correct mandatory semantics to be constraint-driven rather than sampling-driven.

Changes:

  • Adjusts emitted type strings to connector-friendly values (e.g., BoolBoolean, DoubleFloat, ZonedDateTimeDateTime, Point2d/3dPoint, lists/maps as List[Any]/Map[Any]).
  • Reworks mandatory for node properties to be derived from existence constraints (label-aware), and sets relationship mandatory to always false.
  • Updates/extends E2E tests to reflect the new type strings and mandatory behavior, including new constraint-focused test cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
query_modules/schema.cpp Updates schema procedure type-string mapping and computes mandatory from existence constraints (nodes) / forces false (rels).
tests/e2e/query_modules/schema_test.py Aligns expectations with new type strings and constraint-based mandatory; adds focused tests for list opacity and existence-constraint semantics.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread query_modules/schema.cpp
@imilinovic imilinovic force-pushed the feat/schema-expand-v2 branch from fa2d6c6 to e076502 Compare May 28, 2026 13:53
@sonarqubecloud
Copy link
Copy Markdown

Make schema.node_type_properties / rel_type_properties emit type strings
the Simba BI connector (PowerBI/Tableau) recognises, so properties map to
proper SQL types instead of degrading to VARCHAR:
- Bool -> Boolean, Double -> Float, ZonedDateTime -> DateTime, Point2d/3d -> Point
- Int kept (the connector maps "Integer" to VARCHAR despite its docs claiming BIGINT)

Fix mandatory semantics: now driven by existence constraints (label-aware)
instead of the sampling-ratio heuristic. Relationships always report
mandatory=false (no rel-type existence constraints in Memgraph).
Use rfind(':') to locate the label/property delimiter — property paths
can contain '.', so first-colon split was only safe by unstated label
invariant. Move BuildExistenceConstraintsByLabel into anonymous namespace.
Trim TypeOf comments to one line each.
BuildExistenceConstraintsByLabel now catches ImmutableObjectException and
degrades to an empty map on virtual graphs, instead of widening the
mgp_list_all_* C-API contract to silently return empty.

Adds e2e coverage: virtual-graph invocation, multi-label negative case,
constraint with no matching nodes, sample x constraint interaction, and
a drift sentinel asserting that rel-type existence constraints are
still rejected at parse time.
@imilinovic imilinovic force-pushed the feat/schema-expand-v2 branch from 11a6821 to a7bcb82 Compare May 29, 2026 08:20
The sentinel asserted that the parser still rejects rel-type existence
constraints — a meta-check against the language layer rather than the
schema procedure itself. It provides no signal about RelTypeProperties
correctness, so remove it and keep the hardcoded mandatory=false
explained by a one-line comment.
The previous comment claimed labels cannot contain ':', justifying rfind.
That's false — both labels and property names can contain ':' via backticked
Cypher identifiers (CypherLexer.g4:178). The producer doesn't escape, so the
format is genuinely ambiguous in that edge case; rfind is just a tie-break.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants