lihaosky commented on code in PR #26603: URL: https://github.com/apache/flink/pull/26603#discussion_r2113140874
########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/RexModelCall.java: ########## @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.planner.calcite; + +import org.apache.flink.table.planner.plan.schema.ModelProviderModel; + +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rex.RexCall; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlSpecialOperator; + +import java.util.List; + +/** + * A {@link RexCall} that represents a call to a model provider model. + * + * <p>This is used to represent calls to models in the Flink SQL planner. + */ +public class RexModelCall extends RexCall { Review Comment: This is a generic `RexNode` representation for `SqlModelCall`. It can also be used by `ml_evaluate`. `RexModelCall` is one of the operands of `ml_predict` RexNode. I have a unfinished PR: https://github.com/apache/flink/pull/26612/files/72a9f54128e016dd18f2898d32b68808582ed9b6..f825b959dde78377ff46d3a31424703307f4c52d, you can see how I plan to use this in later stage ########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/RexModelCall.java: ########## @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.planner.calcite; + +import org.apache.flink.table.planner.plan.schema.ModelProviderModel; + +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rex.RexCall; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlSpecialOperator; + +import java.util.List; + +/** + * A {@link RexCall} that represents a call to a model provider model. + * + * <p>This is used to represent calls to models in the Flink SQL planner. + */ +public class RexModelCall extends RexCall { + + private ModelProviderModel modelProviderModel; + private RelDataType inputType; + + public RexModelCall( + ModelProviderModel modelProviderModel, RelDataType inputType, RelDataType outputType) { + super( + outputType, + new SqlSpecialOperator("RexModelCall", SqlKind.OTHER_FUNCTION), + List.of()); Review Comment: This is not the whole `ml_predict` function, this is just the `sqlmodelcall` which the the `MODEL identifier` part in the `ml_predict` function ########## flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/calcite/RexModelCall.java: ########## @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.table.planner.calcite; + +import org.apache.flink.table.planner.plan.schema.ModelProviderModel; + +import org.apache.calcite.rel.type.RelDataType; +import org.apache.calcite.rex.RexCall; +import org.apache.calcite.sql.SqlKind; +import org.apache.calcite.sql.SqlSpecialOperator; + +import java.util.List; + +/** + * A {@link RexCall} that represents a call to a model provider model. + * + * <p>This is used to represent calls to models in the Flink SQL planner. + */ +public class RexModelCall extends RexCall { + + private ModelProviderModel modelProviderModel; Review Comment: We perform `ModelProvider` discovery during rel converter. This is similar to how table source is translated to RelNode and the `TableSourceTable` encapsulate both `DynamicTable` and `ContextResovledTable`: https://github.com/apache/flink/blob/master/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/schema/CatalogSourceTable.java#L103-L127 -- 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]
