aglinxinyuan opened a new pull request, #9248: URL: https://github.com/apache/texera/pull/9248
### What changes were proposed in this PR? 11 operator enum test suites (`AggregationFunctionSpec`, `MatchingTypeSpec`, `ComparisonTypeSpec`, `TimeIntervalTypeSpec`, `ClassificationMetricsFncSpec`, `RegressionMetricsFncSpec`, `RedditSourceOperatorFunctionSpec`, `DecodingMethodSpec`, `FileAttributeTypeSpec`, `FileDecodingMethodSpec`, and `JoinTypeSpec`) each repeated identical boilerplate verifying: 1. Every constant maps to its expected wire string via its getter (`getName` or `getJoinType`), and `values()` length matches the expected mapping count. 2. Jackson serializes constants to JSON strings and deserializes them back. A new test trait, `OperatorEnumBehaviors`, introduces `checkEnumMappingAndJsonRoundTrip[E]`. Each spec now supplies its mapping table as literal `Constant -> "wire"` pairs. Test names and spec-specific assertions (such as symbol parsing in `ComparisonTypeSpec` or core type conversions in `FileAttributeTypeSpec`) remain intact. | Surface | Pinned | | --- | --- | | Wire mapping | constant wire representation via `getName` / `getJoinType`, `values()` length, and `toString` | | Serialization | Jackson `writeValueAsString` and `readValue` round-trip through wire string | ### Any related issues, documentation, discussions? Closes #9247. ### How was this PR tested? - `sbt "WorkflowOperator/testOnly org.apache.texera.amber.operator.aggregate.AggregationFunctionSpec org.apache.texera.amber.operator.dictionary.MatchingTypeSpec org.apache.texera.amber.operator.filter.ComparisonTypeSpec org.apache.texera.amber.operator.intervalJoin.TimeIntervalTypeSpec org.apache.texera.amber.operator.machineLearning.Scorer.ClassificationMetricsFncSpec org.apache.texera.amber.operator.machineLearning.Scorer.RegressionMetricsFncSpec org.apache.texera.amber.operator.source.apis.reddit.RedditSourceOperatorFunctionSpec org.apache.texera.amber.operator.source.fetcher.DecodingMethodSpec org.apache.texera.amber.operator.source.scan.FileAttributeTypeSpec org.apache.texera.amber.operator.source.scan.FileDecodingMethodSpec org.apache.texera.amber.operator.hashJoin.JoinTypeSpec"`: 11 suites, 26 tests pass. Test names matched the baseline before and after. - Mutation check: corrupting a wire string in `AggregationFunctionSpec` fails both its mapping and round-trip tests; corrupting round-trip deserialization in `OperatorEnumBehaviors` fails round-trip in `MatchingTypeSpec`. Restoring from saved bytes returns tests to green. - `sbt "WorkflowOperator/Test/scalafmtCheck" "WorkflowOperator/scalafmtCheck" "WorkflowOperator/Test/scalafix --check"` ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Antigravity (Gemini 3.8 Flash) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
