Skip to content

fix: preserve SQL aliases in gRPC ResultSet serialization#2858

Merged
robfrank merged 2 commits intomainfrom
fix/2854-grpc-resultset-alias
Dec 3, 2025
Merged

fix: preserve SQL aliases in gRPC ResultSet serialization#2858
robfrank merged 2 commits intomainfrom
fix/2854-grpc-resultset-alias

Conversation

@robfrank
Copy link
Collaborator

@robfrank robfrank commented Dec 3, 2025

This pull request addresses issue #2854 by fixing a critical bug in the gRPC server that prevented SQL column aliases from being preserved in query results. The main change is a switch from Record-level to Result-level serialization in the gRPC server, ensuring that aliased columns and metadata properties are correctly included in the response, matching the behavior of the HTTP handler. Comprehensive regression tests have been added and enabled to verify the fix, and related test dependencies are updated.

gRPC Server Serialization Improvements

  • Changed ArcadeDbGrpcService.executeQuery() to use a new convertResultToGrpcRecord() method that serializes from Result objects, allowing SQL aliases to be preserved in gRPC responses.
  • Added explicit injection of metadata properties (@rid, @type) into the properties map for element-backed results to work around client-side limitations and ensure consistent metadata availability.

Testing Enhancements

  • Added and enabled the regression test sqlAliasesArePreservedInGrpcResultSet() in RemoteGrpcDatabaseRegressionTest.java to verify that both original and aliased properties, as well as metadata, are present in gRPC query results. [1] [2]
  • Removed @Disabled from all existing tests in RemoteGrpcDatabaseRegressionTest.java and refactored the test class to extend BaseGraphServerTest, enabling full integration testing with an embedded server. [1] [2] [3] [4] [5] [6]
  • Added a new integration test GrpcServerPluginIT to further verify gRPC plugin behavior with real data and aliases.

Build and Dependency Updates

  • Updated grpc-client/pom.xml to include test-scoped dependencies on arcadedb-grpcw and arcadedb-server, ensuring all necessary components are available for integration testing.

Documentation

  • Added 2854-grpc-resultset-alias.md with a detailed description of the bug, analysis, solution, implementation steps, and verification process.

@robfrank robfrank added this to the 25.11.1 milestone Dec 3, 2025
@robfrank robfrank linked an issue Dec 3, 2025 that may be closed by this pull request
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @robfrank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug where SQL column aliases were not preserved during gRPC ResultSet serialization. The core solution involves refactoring the gRPC server's serialization logic to process Result objects directly, rather than Record objects, which inherently lack alias information. Additionally, it ensures that essential metadata properties like @rid and @type are consistently included in gRPC responses, working around client-side parsing limitations. The changes are thoroughly validated with new and re-enabled integration tests, and comprehensive documentation has been added.

Highlights

  • gRPC Serialization Fix: Switched gRPC result serialization from Record-level to Result-level to correctly preserve SQL column aliases, aligning with HTTP handler behavior.
  • Metadata Injection: Implemented explicit injection of @rid and @type metadata into gRPC result properties for element-backed results, addressing client-side limitations.
  • Enhanced Testing: Added a new regression test (sqlAliasesArePreservedInGrpcResultSet) to verify alias and metadata preservation, and a new integration test (GrpcServerPluginIT) for gRPC plugin behavior.
  • Test Infrastructure Improvement: Refactored RemoteGrpcDatabaseRegressionTest to extend BaseGraphServerTest and removed @Disabled annotations, enabling full integration testing.
  • Documentation: Included a detailed markdown document (2854-grpc-resultset-alias.md) explaining the bug, analysis, solution, and verification.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mergify
Copy link
Contributor

mergify bot commented Dec 3, 2025

🧪 CI Insights

Here's what we observed from your CI run for 9734849.

🟢 All jobs passed!

But CI Insights is watching 👀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully addresses a critical bug in the gRPC server where SQL column aliases were not being preserved in query results. The core of the fix is a shift from Record-level to Result-level serialization, which is a solid approach that aligns the gRPC behavior with the existing HTTP handler. The changes are well-supported by new and updated tests, and the addition of a detailed markdown file explaining the fix is excellent. I've identified a few minor issues, including a duplicated dependency in the pom.xml, a placeholder test name, and some redundant code in the new tests that could be cleaned up.

@codacy-production
Copy link

codacy-production bot commented Dec 3, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+1.07%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (cf34e11) 71560 46382 64.82%
Head commit (9734849) 70174 (-1386) 46234 (-148) 65.88% (+1.07%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2858) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@robfrank robfrank force-pushed the fix/2854-grpc-resultset-alias branch from bd03b1e to 9734849 Compare December 3, 2025 21:16
@robfrank robfrank merged commit 1c12f84 into main Dec 3, 2025
18 of 22 checks passed
@robfrank robfrank deleted the fix/2854-grpc-resultset-alias branch December 3, 2025 22:18
robfrank added a commit that referenced this pull request Feb 11, 2026
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.

gRPC: ResultSet serialization is missing alias

1 participant