{"record":{"id":"157c50be3d44d229","repo":"apache/shardingsphere","slug":"this-spi-implementation-does-not-support-the-use-o","errorCode":null,"errorMessage":"This SPI implementation does not support the use of this method.","messagePattern":"This SPI implementation does not support the use of this method\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java","lineNumber":57,"sourceCode":"     */\n    List<String> splitAndEvaluate();\n    \n    /**\n     * This method is used to return the inlineExpression String itself. In some cases, you may want to do\n     * additional processing on inlineExpression to return a specific value, in which case you need to override this method.\n     * Normally there is no need to use this method downstream, because this method only encapsulates the use of Groovy syntax\n     * by ShardingSphere's existing algorithm classes.\n     * An {@link org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser} implementation that implements this method\n     * will provide the following algorithm classes with the ability to convert original expressions.\n     * 1. `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`\n     * 2. `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`\n     * 3. `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`\n     *\n     * @return result processed inline expression defined by the SPI implementation\n     * @throws UnsupportedOperationException Thrown to indicate that the requested operation is not supported.\n     */\n    default String handlePlaceHolder() {\n        throw new UnsupportedOperationException(\"This SPI implementation does not support the use of this method.\");\n    }\n    \n    /**\n     * Evaluate with arguments.\n     * Normally there is no need to use this method downstream, because this method only encapsulates the use of Groovy syntax\n     * by ShardingSphere's existing algorithm classes.\n     * An {@link org.apache.shardingsphere.infra.expr.spi.InlineExpressionParser} implementation that implements this method\n     * will provide the following algorithm classes with the ability to use expressions outside the Groovy language.\n     * 1. `org.apache.shardingsphere.sharding.algorithm.sharding.hint.HintInlineShardingAlgorithm`\n     * 2. `org.apache.shardingsphere.sharding.algorithm.sharding.inline.ComplexInlineShardingAlgorithm`\n     * 3. `org.apache.shardingsphere.sharding.algorithm.sharding.inline.InlineShardingAlgorithm`\n     *\n     * @param map map\n     * @return closure\n     * @throws UnsupportedOperationException By default, users do not need to consider passing in additional parameters.\n     */\n    default String evaluateWithArgs(final Map<String, Comparable<?>> map) {\n        throw new UnsupportedOperationException(\"This SPI implementation does not support the use of this method.\");","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/infra/expr/core/src/main/java/org/apache/shardingsphere/infra/expr/spi/InlineExpressionParser.java#L39-L75","documentation":"InlineExpressionParser is an SPI with two optional Groovy-oriented default methods. handlePlaceHolder() has a default implementation that throws UnsupportedOperationException; it is only meaningful for parsers (like the built-in Groovy one) that understand ShardingSphere's ${...} placeholder expressions. The inline sharding algorithms (HintInlineShardingAlgorithm, ComplexInlineShardingAlgorithm, InlineShardingAlgorithm) call it to rewrite placeholder expressions, so configuring a parser SPI that does not override it makes those algorithms fail.","triggerScenarios":"Setting a non-Groovy InlineExpressionParser SPI (via the expression parser SPI type in props) while a sharding rule uses InlineShardingAlgorithm / ComplexInlineShardingAlgorithm / HintInlineShardingAlgorithm with expressions containing ${...} placeholders like 'ds_${user_id % 2}'.","commonSituations":"Switching expression SPI type to avoid Groovy dependency or startup overhead and forgetting that inline sharding algorithms depend on Groovy placeholder semantics; custom inline-expression parser implementations contributed for other statement types that never implemented handlePlaceHolder; version upgrades where the SPI gained new default methods.","solutions":["Use the default Groovy InlineExpressionParser when inline sharding algorithms are configured (keep the groovy module on the classpath).","Remove ${...} placeholder syntax from algorithm expressions if the alternative parser supports static expressions only.","If you own the parser SPI, override handlePlaceHolder() to implement placeholder handling for your expression syntax."],"exampleFix":"# before (props)\nprops: expression-parser-type: LITERAL  # non-Groovy SPI without handlePlaceHolder\nrules: sharding: algorithm: inline: expression: ds_${user_id % 2}\n\n# after\nprops: expression-parser-type: GROOVY\nrules: sharding: algorithm: inline: expression: ds_${user_id % 2}","handlingStrategy":"validation","validationCode":"boolean placeholdersInRule = ruleExpression.contains(\"${\");\nif (placeholdersInRule && !\"GROOVY\".equalsIgnoreCase(props.get(\"expression-parser-type\"))) { throw new ConfigurationException(\"inline algorithms need the Groovy parser\"); }","typeGuard":null,"tryCatchPattern":"try { parser.handlePlaceHolder(); } catch (UnsupportedOperationException e) { /* requires Groovy-based InlineExpressionParser */ }","preventionTips":["Keep the Groovy expression parser whenever inline sharding algorithms are configured.","Document SPI capability expectations when swapping expression parser implementations."],"tags":["spi","inline-expression","sharding","groovy"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}