Skip to content

Conversation

@evindj
Copy link

@evindj evindj commented Jan 25, 2026

Summary

This PR is a small change that will be used later. It is a simple string to enum and enum to string conversion. It does not add any functionality

Test

Added a unit tests for one of the case, just to confirm it works.
./build/src/iceberg/test/expression_test --gtest_filter="ExpressionJson*"  ✔  1322  11:28:25
Running main() from gmock_main.cc
Note: Google Test filter = ExpressionJson*
[==========] Running 3 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 3 tests from ExpressionJsonTest
[ RUN ] ExpressionJsonTest.TrueExpression
[ OK ] ExpressionJsonTest.TrueExpression (0 ms)
[ RUN ] ExpressionJsonTest.FalseExpression
[ OK ] ExpressionJsonTest.FalseExpression (0 ms)
[ RUN ] ExpressionJsonTest.OpToString
[ OK ] ExpressionJsonTest.OpToString (0 ms)
[----------] 3 tests from ExpressionJsonTest (0 ms total)

[----------] Global test environment tear-down
[==========] 3 tests from 1 test suite ran. (0 ms total)
[ PASSED ] 3 tests.

// Helper to test round-trip serialization
// Uses string comparison since expressions may have different internal identity
// but the same semantic meaning (i.e., ToString() output matches)
void TestRoundTrip(const Expression& expr) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You add this helper function but not used anywhere.

expression/expression.cc
expression/expressions.cc
expression/inclusive_metrics_evaluator.cc
expression/json_internal.cc
Copy link
Collaborator

Choose a reason for hiding this comment

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

By convention, this file should be named json.cc, as internal is typically reserved for header files. I'm aware that we already have a json_internal.cc, but that’s legacy. I think json_serde.cc/ json_serde_internal.h would be a better choice. What do you think, @wgtmac?

Copy link
Member

Choose a reason for hiding this comment

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

Agreed

@evindj evindj changed the title [Expr Serde] [PR 1/X] Operation type enum conversion helper [Expr Serde] [PR 2/X] Operation type enum conversion helper Jan 26, 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.

3 participants