alex-plekhanov commented on code in PR #12726:
URL: https://github.com/apache/ignite/pull/12726#discussion_r2812307197


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/prepare/IgniteConvertletTable.java:
##########
@@ -42,13 +46,29 @@
  * Ignite convertlet table.
  */
 public class IgniteConvertletTable extends ReflectiveConvertletTable {
+    /**
+     * The call is used to register convertlet for {@code REGEXP_SUBSTR} 
function, since it is a library function and
+     * Calcite's convertlet table doesn't support it.
+     * The call itself is never used, since we override {@link #get(SqlCall)} 
method to return convertlet for it.
+     */
+    public static final SqlCall REGEXP_EXTRACT_CALL = new 
SqlCall(SqlParserPos.ZERO) {
+        @Override public SqlOperator getOperator() {
+            return SqlLibraryOperators.REGEXP_EXTRACT;
+        }
+
+        @Override public List<SqlNode> getOperandList() {
+            return List.of();
+        }
+    };
+
     /** Instance. */
     public static final IgniteConvertletTable INSTANCE = new 
IgniteConvertletTable();
 
     /** */
     protected IgniteConvertletTable() {
         // Replace Calcite's convertlet with our own.
         registerOp(SqlStdOperatorTable.TIMESTAMP_DIFF, new 
TimestampDiffConvertlet());
+        registerOp(SqlLibraryOperators.REGEXP_SUBSTR, 
StandardConvertletTable.INSTANCE.get(REGEXP_EXTRACT_CALL));

Review Comment:
   Maybe something like:
   ```
           registerOp(SqlLibraryOperators.REGEXP_SUBSTR, (cx, call) -> 
cx.getRexBuilder().makeCall(
               SqlLibraryOperators.REGEXP_SUBSTR, 
Commons.transform(call.getOperandList(), cx::convertExpression)));
   ```
   ?



-- 
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]

Reply via email to