Skip to content

fix(engine): Join Field doesn't convert a join layer it only reads attributes from - #3554

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/join-field-lonlat-copy
Dec 1, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/join-field-lonlat-copy

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

When Join Field's target is in longitude/latitude, the join layer was converted too, although the join only uses its attributes. It is now read as it is, as #2611 does for projected targets, and is left out of the notice about features read without geometry. It is still converted when it's also the target, or when its definition query measures shapes.

Joining from a 448,000-polygon parcel layer, the step's peak memory falls from 6.8 GB to 5.0 GB and its time from 5.7 s to 1.6 s (median of three runs). It no longer holds a converted copy of the join layer. The whole workflow's peak doesn't change, because exporting sets it.

This is in the input code every surface shares: desktop, browser, phone, command line, Python, Assistant and MCP. No command, parameter or Undo behavior changes.

Testing

  • A new test joins to a longitude/latitude target from a layer with a feature that can't be placed there: every row joins, without the notice. With a definition query that measures shapes, and with the join layer as the target (given by name and by table number), it is still converted and the notice appears once. The test fails without the fix.
  • The county workflow's four exported CSVs are identical before and after.
  • cargo xtask memory passes before and after.

UI evidence

No visible UI change.

Related issue

Follow-up to #2611. Part of #2032 and #2431.

Summary by CodeRabbit

  • Bug Fixes
    • Attribute-only joins now read matching values without requiring unused geometry to be converted, including when the source is a standalone table.
    • Geometry-dependent queries and joins continue to convert geometry as needed, and features that cannot be placed are handled consistently across named layers and numbered tables.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The query module now detects expressions that measure feature geometry. Geoprocessing tracks attribute-only inputs during CRS selection, excludes inputs with geometry-dependent definition queries from that set, and applies the handling to standalone tables. Tests cover join behavior for unplaceable features.

Changes: Geometry-aware input handling

Layer / File(s) Summary
Geometry measurement detection
crates/data/src/query.rs
The query module adds uses_geometry to detect geometry measurements in expressions. uses_area uses the shared traversal and matches area measurements.
Attribute-only input selection and conversion
crates/engine/src/cmd/gp.rs, crates/engine/src/tests/held_layers.rs
Geoprocessing resolves attribute-only inputs by layer or table, excludes inputs also used for geometry, and carries the remaining keys through CRS selection and input conversion. Geometry-dependent definition queries remove inputs from the attribute-only set. Tests cover joins and conversion for named layers and numbered tables.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • opengeos/RustGIS#2611: It changes how Join Field handles the join layer relative to the target coordinate system, which is also addressed here.

Suggested reviewers: pick2510, giswqs

Merge Risk: Minimal · up to da008

This change skips unnecessary layer conversion for attribute-only joins when the target uses longitude/latitude, and it keeps conversion where geometry is actually used. No concrete merge-blocking risk was found. Confirm that the CI failures are unrelated infrastructure issues before merging.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix in the engine's Join Field step: a join layer that only supplies attributes is no longer converted when the target uses longitude/latitude. The raw summary shows the changes in…
Description check Passed The description covers the Summary, Testing, UI evidence, and Related issue sections of the template. The Summary explains what changed and why, and it gives measured memory and time results. Testing …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the fix in the engine's Join Field step: a join layer that only supplies attributes is no longer converted when the target uses longitude/latitude. The raw summary shows the changes in gp.rs (attributes_only, work_inputs, inputs_in) and in the new held_layers test, which match this title. The title is specific and has no vague wording. It is a little long at 82 characters, and the Conventional Commits prefix is used as the repository's convention.

Full details: Description check

Explanation

The description covers the Summary, Testing, UI evidence, and Related issue sections of the template. The Summary explains what changed and why, and it gives measured memory and time results. Testing lists the new test, the CSV comparison, and the memory check. UI evidence correctly states that there is no visible UI change, and the Related issue section links #2611, #2032, and #2431. The template's Related issue placeholder is filled in with a follow-up reference, so the description is complete.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit checks the map for a geometry sign,
Then keeps attribute keys in a tidy line.
Tables pass through when their shapes are needed,
While join tests show which features succeeded.
I thump for conversions tracked just right!

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 01661814-8265-4095-b693-4174aeddcb62
Commits

Reviewing files that changed from the base of the PR and between e11b061 and da0080a.

Files selected for processing: 3

  • crates/data/src/query.rs
  • crates/engine/src/cmd/gp.rs
  • crates/engine/src/tests/held_layers.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs or crash paths. Two inline quality comments are posted on crates/engine/src/cmd/gp.rs. The comments are buffered, not confirmed as posted.

Bugs

None found. Checked:

  • Join-source reads: dataset() and table() (gp.rs ~2533–2566) agree with attributes_only on which inputs are read raw, for both layer names and table numbers.
  • Name and number matching: same_input handles name-versus-number and case differences, and the test covers both.
  • Panics: the new code has no unwrap, expect or indexing in non-test code.
  • Tool scope: reads_geometry_of is true for every joinField parameter except joinTable, so attributes_only returns nothing for other tools. The other tools' behaviour is unchanged.

Security

None found.

Performance

  • Not introduced by this PR: streamed_inputs (gp.rs ~2012) still loads a streamed attribute-only join source whole into full, and then doesn't convert it. That's the remaining copy this fix doesn't reach. Confidence: high. Pre-existing, so it's a possible follow-up, not a finding against this change.

Quality

  • Kind filter in attributes_only (gp.rs:2076), confidence high, latent: the target filter accepts only ParamKind::Layer, but inputs_in treats five layer kinds as inputs. Nothing breaks today, since joinField's target is K::Layer. Posted inline.
  • Projected-run coverage for the definition-query guard (gp.rs:2149), confidence medium: the guard runs only on the longitude/latitude fallback, and the new test covers only that path. I haven't confirmed a difference between the paths. A projected-run case would settle it. Posted inline.

AGENTS.md

  • No rule break found. Both-ways tests are present: the notice is asserted once where it applies and absent where it doesn't. The PR adds no command, so no cancellation list changes. The xtask rows count isn't affected, since the new code reads no Feature fields.

Checked and not raised

  • Read routes: no changes to layer.add*, project.open* or the other read routes.
  • Overlay tools: no changes to analysis/src/tools.rs overlays.
  • wasm: attributes_only, work_inputs and uses_geometry have no cfg gate and use nothing desktop-only.
  • Existing concerns: none. There were no prior review threads on this PR, so none were left out.

Change size

Compared: the whole PR against main (merge base e11b061 to PR head da0080a).

Measure Value
Files changed 3 (0 added, 3 modified, 0 removed, 0 renamed)
Size before 642.1 KB
Size after 647.4 KB
Total size change +5.3 KB
File Before After Change
crates/engine/src/tests/held_layers.rs 163.3 KB 167.5 KB +4.1 KB
crates/engine/src/cmd/gp.rs 375.6 KB 376.3 KB +778 B
crates/data/src/query.rs 103.1 KB 103.6 KB +457 B

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3554/
Web app https://preview.rustgis.app/pr-3554/app/
Commit da0080a

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 1, 2026
Merged via the queue into opengeos:main with commit 564d60d Dec 1, 2026
42 of 45 checks passed
@Mavrick-F
Mavrick-F deleted the fix/join-field-lonlat-copy branch December 1, 2026 18:53
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