This is an automated email from the ASF dual-hosted git repository. ron pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push: new 19c3e881ed3 [FLINK-36492][table-common] Remove all deprecated methods in ListView (#25565) 19c3e881ed3 is described below commit 19c3e881ed3793f49d47a4d0fe605f033a8ad039 Author: Gantigmaa Selenge <39860586+tinasele...@users.noreply.github.com> AuthorDate: Wed Jan 15 02:54:58 2025 +0000 [FLINK-36492][table-common] Remove all deprecated methods in ListView (#25565) Signed-off-by: Gantigmaa Selenge <tina.sele...@gmail.com> --- .../apache/flink/table/api/dataview/ListView.java | 25 ++--------- .../table/dataview/ListViewTypeInfoFactory.java | 48 ---------------------- .../planner/typeutils/LegacyDataViewUtils.scala | 22 +++------- 3 files changed, 8 insertions(+), 87 deletions(-) diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/dataview/ListView.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/dataview/ListView.java index 576ca5dc597..4249becd126 100644 --- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/dataview/ListView.java +++ b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/dataview/ListView.java @@ -20,11 +20,8 @@ package org.apache.flink.table.api.dataview; import org.apache.flink.annotation.PublicEvolving; import org.apache.flink.api.common.state.ListState; -import org.apache.flink.api.common.typeinfo.TypeInfo; -import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.table.annotation.DataTypeHint; import org.apache.flink.table.api.DataTypes; -import org.apache.flink.table.dataview.ListViewTypeInfoFactory; import org.apache.flink.table.functions.AggregateFunction; import org.apache.flink.table.functions.TableAggregateFunction; import org.apache.flink.table.types.DataType; @@ -87,9 +84,11 @@ import java.util.Objects; * * }</pre> * + * <p>{@code ListView(TypeInformation<?> elementType)} method was deprecated and then removed. + * Please use a {@link DataTypeHint} instead. + * * @param <T> element type */ -@TypeInfo(ListViewTypeInfoFactory.class) @PublicEvolving public class ListView<T> implements DataView { @@ -186,22 +185,4 @@ public class ListView<T> implements DataView { ListView.class, DataTypes.FIELD("list", DataTypes.ARRAY(elementDataType).bridgedTo(List.class))); } - - // -------------------------------------------------------------------------------------------- - // Legacy - // -------------------------------------------------------------------------------------------- - - @Deprecated public transient TypeInformation<?> elementType; - - /** - * Creates a {@link ListView} for elements of the specified type. - * - * @param elementType The type of the list view elements. - * @deprecated This method uses the old type system. Please use a {@link DataTypeHint} instead - * if the reflective type extraction is not successful. - */ - @Deprecated - public ListView(TypeInformation<?> elementType) { - this.elementType = elementType; - } } diff --git a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/dataview/ListViewTypeInfoFactory.java b/flink-table/flink-table-common/src/main/java/org/apache/flink/table/dataview/ListViewTypeInfoFactory.java deleted file mode 100644 index cb8c75aecfe..00000000000 --- a/flink-table/flink-table-common/src/main/java/org/apache/flink/table/dataview/ListViewTypeInfoFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.dataview; - -import org.apache.flink.annotation.Internal; -import org.apache.flink.api.common.typeinfo.TypeInfoFactory; -import org.apache.flink.api.common.typeinfo.TypeInformation; -import org.apache.flink.api.java.typeutils.GenericTypeInfo; -import org.apache.flink.table.api.dataview.ListView; - -import java.lang.reflect.Type; -import java.util.Map; - -/** TypeInformation factory for {@link ListView}. */ -@Internal -@Deprecated -public class ListViewTypeInfoFactory<T> extends TypeInfoFactory<ListView<T>> { - - @Override - public TypeInformation<ListView<T>> createTypeInfo( - Type t, Map<String, TypeInformation<?>> genericParameters) { - TypeInformation<?> elementType = genericParameters.get("T"); - - if (elementType == null) { - // we might can get the elementType later from the ListView constructor - elementType = new GenericTypeInfo<>(Object.class); - } - - //noinspection unchecked - return new ListViewTypeInfo<>((TypeInformation<T>) elementType); - } -} diff --git a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/typeutils/LegacyDataViewUtils.scala b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/typeutils/LegacyDataViewUtils.scala index fa29cfe749c..56389c2e612 100644 --- a/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/typeutils/LegacyDataViewUtils.scala +++ b/flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/typeutils/LegacyDataViewUtils.scala @@ -178,35 +178,23 @@ object LegacyDataViewUtils { map case list: ListViewTypeInfo[_] => - val listView = instance match { - case b: BinaryRawValueData[_] => - b.getJavaObject.asInstanceOf[ListView[_]] - case _ => - instance.asInstanceOf[ListView[_]] - } - val newTypeInfo = if (listView != null && listView.elementType != null) { - // use explicit element type if user has defined - new ListViewTypeInfo(listView.elementType) - } else { - list - } if (!isStateBackedDataViews) { // add data view field if it is not backed by a state backend. // data view fields which are backed by state backend are not serialized. - newTypeInfo.setNullSerializer(false) + list.setNullSerializer(false) } else { - newTypeInfo.setNullSerializer(true) + list.setNullSerializer(true) // create list view specs with unique is (used as state name) val listViewSpec = new ListViewSpec( "agg" + aggIndex + "$" + fieldName, fieldIndex, // dataview field index in pojo - fromLegacyInfoToDataType(newTypeInfo), - newTypeInfo.getElementType.createSerializer(new SerializerConfigImpl) + fromLegacyInfoToDataType(list), + list.getElementType.createSerializer(new SerializerConfigImpl) ) spec = Some(listViewSpec) } - newTypeInfo + list case t: TypeInformation[_] => t }