Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 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.typeutils;
import org.apache.flink.api.common.typeutils.CompatibilityResult;
import org.apache.flink.api.common.typeutils.CompatibilityUtil;
import org.apache.flink.api.common.typeutils.CompositeTypeSerializerConfigSnapshot;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.TypeSerializerConfigSnapshot;
import org.apache.flink.api.common.typeutils.UnloadableDummyTypeSerializer;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.core.memory.DataInputView;
import org.apache.flink.core.memory.DataOutputView;
import org.apache.flink.table.dataformat.BaseMap;
import org.apache.flink.table.dataformat.BinaryArray;
import org.apache.flink.table.dataformat.BinaryArrayWriter;
import org.apache.flink.table.dataformat.BinaryMap;
import org.apache.flink.table.dataformat.GenericMap;
import org.apache.flink.table.dataformat.util.BaseRowUtil;
import org.apache.flink.table.types.DataTypes;
import org.apache.flink.table.types.InternalType;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Serializer for BaseMap.
*/
public class BaseMapSerializer extends TypeSerializer {
private final InternalType keyType;
private final InternalType valueType;
private final TypeSerializer keySerializer;
private final TypeSerializer valueSerializer;
private final BinaryMapSerializer binarySerializer;
private BinaryArray reuseKeyArray;
private BinaryArray reuseValueArray;
private BinaryArrayWriter reuseKeyWriter;
private BinaryArrayWriter reuseValueWriter;
public BaseMapSerializer(InternalType keyType, InternalType valueType) {
this.keyType = keyType;
this.valueType = valueType;
this.keySerializer = DataTypes.createInternalSerializer(keyType);
this.valueSerializer = DataTypes.createInternalSerializer(valueType);
this.binarySerializer = BinaryMapSerializer.INSTANCE;
}
public InternalType getKeyType() {
return keyType;
}
public InternalType getValueType() {
return valueType;
}
@Override
public boolean isImmutableType() {
return false;
}
@Override
public TypeSerializer duplicate() {
return null;
}
@Override
public BaseMap createInstance() {
return new GenericMap();
}
@Override
public BaseMap copy(BaseMap from) {
return copy(from, null);
}
@Override
public BaseMap copy(BaseMap from, BaseMap reuse) {
if (from instanceof GenericMap) {
Map