Phixsura commented on PR #38698: URL: https://github.com/apache/shardingsphere/pull/38698#issuecomment-4598917367
Pushed `8c938b29` on top of current master. For the numeric-to-int rounding: switched `castToShort` / `castToInteger` / `castToLong` from `HALF_EVEN` to `HALF_UP`, so `2.5::int4` is 3 and `-2.5::int4` is -3. Pinned in `PostgreSQLCastEvaluatorTest`, in `ConditionValueTest` (cast entry), and in `InsertClauseShardingConditionEngineTest` (INSERT routing). Flipping it back to `HALF_EVEN` reds both the 2.5 and -2.5 cases. For typmod: went with the "treat modifier-bearing targets as unsupported" option. `normalize()` no longer strips the parenthesised part, so `varchar(1)`, `char(2)`, `numeric(3,1)` and the like fall through to `OTHER` and `evaluate` returns `Optional.empty()`, which leaves the cast in place and routes broadcast. Negative cases live in the evaluator unit test plus the INSERT and WHERE paths. Restoring the paren-strip in `normalize()` reds all four typmod cases. For the WHERE production path: added four cases in `WhereClauseShardingConditionEngineTest` that drive `createShardingConditions` through `ExpressionExtractor.extractAndPredicates` and `ConditionValueGeneratorFactory.generate`: - `col = ?::int4` with String `"42"` returns `[42]` (Integer, not the raw String) - `col IN (?::int4)` returns `[42]` - `col BETWEEN ?::int4 AND ?::int4` with `"1"` / `"100"` returns the range `[1, 100]` - `col = ?::numeric(3,1)` returns an empty condition list `./mvnw test -pl features/sharding/core` is 921/921; spotless and checkstyle clean. On openGauss: the evaluator itself is dialect-agnostic Java semantics, so PG and openGauss take the same path through it. I did not add a separate openGauss E2E this round; happy to add one if you want it. -- 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]
