Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys merged PR #23761: URL: https://github.com/apache/flink/pull/23761 -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1407844330 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1407474016 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1407464091 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1407464091 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1407454211 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1406316719 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1406314626 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1406305482 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1406291625 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1406286431 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1404465452 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
jnh5y commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1401353983 ## flink-table/flink-table-common/src/main/java/org/apache/flink/table/functions/LegacyUserDefinedFunctionInference.java: ## @@ -0,0 +1,529 @@ +/* + * 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.functions; + +import org.apache.flink.annotation.Internal; +import org.apache.flink.api.common.functions.InvalidTypesException; +import org.apache.flink.api.common.typeinfo.TypeInformation; +import org.apache.flink.api.java.typeutils.TypeExtractor; +import org.apache.flink.table.api.TableException; +import org.apache.flink.table.api.ValidationException; +import org.apache.flink.table.data.DecimalData; +import org.apache.flink.table.data.RowData; +import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.TimestampData; +import org.apache.flink.table.types.DataType; +import org.apache.flink.table.types.inference.ArgumentCount; +import org.apache.flink.table.types.inference.CallContext; +import org.apache.flink.table.types.inference.ConstantArgumentCount; +import org.apache.flink.table.types.inference.InputTypeStrategy; +import org.apache.flink.table.types.inference.Signature; +import org.apache.flink.table.types.inference.TypeStrategy; +import org.apache.flink.table.types.logical.LogicalType; +import org.apache.flink.table.types.logical.LogicalTypeRoot; +import org.apache.flink.table.types.utils.TypeConversions; +import org.apache.flink.types.Row; + +import org.apache.flink.shaded.guava31.com.google.common.primitives.Primitives; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.math.BigDecimal; +import java.sql.Time; +import java.sql.Timestamp; +import java.time.Instant; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Date; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; + +import static org.apache.flink.table.types.logical.utils.LogicalTypeUtils.toInternalConversionClass; +import static org.apache.flink.table.types.utils.TypeConversions.fromLegacyInfoToDataType; + +/** + * Ported {@code UserDefinedFunctionUtils} to run some of the type inference for legacy functions in + * Table API. + */ +@Internal +@Deprecated +public class LegacyUserDefinedFunctionInference { + +public static InputTypeStrategy getInputTypeStrategy(ImperativeAggregateFunction func) { +return new InputTypeStrategy() { +@Override +public ArgumentCount getArgumentCount() { +return ConstantArgumentCount.any(); +} + +@Override +public Optional> inferInputTypes( +CallContext callContext, boolean throwOnFailure) { +final List argumentDataTypes = callContext.getArgumentDataTypes(); +final DataType accType = getAccumulatorType(func); +final LogicalType[] input = +Stream.concat(Stream.of(accType), argumentDataTypes.stream()) +.map(DataType::getLogicalType) +.toArray(LogicalType[]::new); + +final Optional> foundMethod = +Stream.of( +logicalTypesToInternalClasses(input), +logicalTypesToExternalClasses(input)) +.map( +signature -> +getUserDefinedMethod( +func, +"accumulate", +signature, +input, +cls -> +Stream.concat( +
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1400387732 ## flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/plan/stream/table/validation/AggregateValidationTest.scala: ## @@ -83,21 +83,6 @@ class AggregateValidationTest extends TableTestBase { .select('d.start)) } - @Test - def testTableFunctionInSelection(): Unit = { Review Comment: The test did not verify what it says it does. The stacktrace is as follows (run from master): ``` org.apache.flink.table.api.TableException: Functions implemented for the old type system are not supported. at org.apache.flink.table.functions.TableFunctionDefinition.getTypeInference(TableFunctionDefinition.java:71) at org.apache.flink.table.planner.expressions.converter.FunctionDefinitionConvertRule.convert(FunctionDefinitionConvertRule.java:52) at org.apache.flink.table.planner.expressions.converter.ExpressionConverter.visit(ExpressionConverter.java:97) at org.apache.flink.table.planner.expressions.converter.ExpressionConverter.visit(ExpressionConverter.java:71) at org.apache.flink.table.expressions.CallExpression.accept(CallExpression.java:226) at org.apache.flink.table.planner.plan.QueryOperationConverter.convertExprToRexNode(QueryOperationConverter.java:836) at org.apache.flink.table.planner.plan.QueryOperationConverter.access$800(QueryOperationConverter.java:137) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.lambda$convertToRexNodes$6(QueryOperationConverter.java:623) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.convertToRexNodes(QueryOperationConverter.java:624) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.visit(QueryOperationConverter.java:163) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.visit(QueryOperationConverter.java:159) at org.apache.flink.table.operations.ProjectQueryOperation.accept(ProjectQueryOperation.java:76) at org.apache.flink.table.planner.plan.QueryOperationConverter.defaultMethod(QueryOperationConverter.java:156) at org.apache.flink.table.planner.plan.QueryOperationConverter.defaultMethod(QueryOperationConverter.java:136) at org.apache.flink.table.operations.utils.QueryOperationDefaultVisitor.visit(QueryOperationDefaultVisitor.java:47) at org.apache.flink.table.operations.ProjectQueryOperation.accept(ProjectQueryOperation.java:76) at org.apache.flink.table.planner.calcite.FlinkRelBuilder.queryOperation(FlinkRelBuilder.java:261) at org.apache.flink.table.planner.utils.TableTestUtil$.toRelNode(TableTestBase.scala:1711) at org.apache.flink.table.planner.utils.TableTestUtilBase.doVerifyPlan(TableTestBase.scala:950) at org.apache.flink.table.planner.utils.TableTestUtilBase.verifyExecPlan(TableTestBase.scala:681) at org.apache.flink.table.planner.plan.stream.table.validation.AggregateValidationTest.testTableFunctionInSelection(AggregateValidationTest.scala:97) ``` Since it a) verifies legacy behaviour b) it's impossible to tell when it stopped verifying what it was supposed to check I decided to just remove 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
dawidwys commented on code in PR #23761: URL: https://github.com/apache/flink/pull/23761#discussion_r1400387732 ## flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/plan/stream/table/validation/AggregateValidationTest.scala: ## @@ -83,21 +83,6 @@ class AggregateValidationTest extends TableTestBase { .select('d.start)) } - @Test - def testTableFunctionInSelection(): Unit = { Review Comment: The test did not verify what it says it does. The stacktrace is as follows: ``` org.apache.flink.table.api.TableException: Functions implemented for the old type system are not supported. at org.apache.flink.table.functions.TableFunctionDefinition.getTypeInference(TableFunctionDefinition.java:71) at org.apache.flink.table.planner.expressions.converter.FunctionDefinitionConvertRule.convert(FunctionDefinitionConvertRule.java:52) at org.apache.flink.table.planner.expressions.converter.ExpressionConverter.visit(ExpressionConverter.java:97) at org.apache.flink.table.planner.expressions.converter.ExpressionConverter.visit(ExpressionConverter.java:71) at org.apache.flink.table.expressions.CallExpression.accept(CallExpression.java:226) at org.apache.flink.table.planner.plan.QueryOperationConverter.convertExprToRexNode(QueryOperationConverter.java:836) at org.apache.flink.table.planner.plan.QueryOperationConverter.access$800(QueryOperationConverter.java:137) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.lambda$convertToRexNodes$6(QueryOperationConverter.java:623) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.convertToRexNodes(QueryOperationConverter.java:624) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.visit(QueryOperationConverter.java:163) at org.apache.flink.table.planner.plan.QueryOperationConverter$SingleRelVisitor.visit(QueryOperationConverter.java:159) at org.apache.flink.table.operations.ProjectQueryOperation.accept(ProjectQueryOperation.java:76) at org.apache.flink.table.planner.plan.QueryOperationConverter.defaultMethod(QueryOperationConverter.java:156) at org.apache.flink.table.planner.plan.QueryOperationConverter.defaultMethod(QueryOperationConverter.java:136) at org.apache.flink.table.operations.utils.QueryOperationDefaultVisitor.visit(QueryOperationDefaultVisitor.java:47) at org.apache.flink.table.operations.ProjectQueryOperation.accept(ProjectQueryOperation.java:76) at org.apache.flink.table.planner.calcite.FlinkRelBuilder.queryOperation(FlinkRelBuilder.java:261) at org.apache.flink.table.planner.utils.TableTestUtil$.toRelNode(TableTestBase.scala:1711) at org.apache.flink.table.planner.utils.TableTestUtilBase.doVerifyPlan(TableTestBase.scala:950) at org.apache.flink.table.planner.utils.TableTestUtilBase.verifyExecPlan(TableTestBase.scala:681) at org.apache.flink.table.planner.plan.stream.table.validation.AggregateValidationTest.testTableFunctionInSelection(AggregateValidationTest.scala:97) ``` Since it a) verifies legacy behaviour b) it's impossible to tell when it stopped verifying what it was supposed to check I decided to just remove 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] [FLINK-26782] Remove PlannerExpression and related [flink]
flinkbot commented on PR #23761: URL: https://github.com/apache/flink/pull/23761#issuecomment-1819106461 ## CI report: * 991a9e26507256844791ab24228ece51b27682b8 UNKNOWN Bot commands The @flinkbot bot supports the following commands: - `@flinkbot run azure` re-run the last Azure build -- 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: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org