Skip to content

Conversation

@yuancu
Copy link
Collaborator

@yuancu yuancu commented Oct 28, 2025

Description

This PR fixes a bug where nested fields of generated structs (like those created by the geoip() function) were not accessible, returning incorrect field names and null values.

Problem

When accessing nested fields from generated structs using dot notation, the system would:

  1. Return incorrect field names
  2. Return null values instead of the actual nested field data
  3. Return incorrect types

Solution

The fix involves two main changes:

QualifiedNameResolver.java:

  • Fixed the joinParts calculation logic when creating item access for nested fields
  • Added proper aliasing to preserve the original qualified field name in query results

Testing

  • Added integration tests in CalciteGeoIpFunctionsIT.java to verify the fix
  • Added YAML test cases to validate both logical and physical query plans
  • Tests confirm that accessing info.dummy_sub_field now returns the correct field name and value

Related Issues

Resolves #4682

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

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

Labels

backport 2.19-dev bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Nested fields of generated structs not accessible

2 participants