|
|
@ -15,31 +15,29 @@
|
|
|
|
* limitations under the License.
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
package com.ververica.cdc.common.data.binary;
|
|
|
|
package org.apache.flink.cdc.common.data.binary;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.annotation.Internal;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.ArrayData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.DecimalData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.LocalZonedTimestampData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.MapData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.RecordData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.StringData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.TimestampData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.data.ZonedTimestampData;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.DataType;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.DataTypeRoot;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.DecimalType;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.LocalZonedTimestampType;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.TimestampType;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.types.ZonedTimestampType;
|
|
|
|
|
|
|
|
import org.apache.flink.cdc.common.utils.Preconditions;
|
|
|
|
import org.apache.flink.core.memory.MemorySegment;
|
|
|
|
import org.apache.flink.core.memory.MemorySegment;
|
|
|
|
import org.apache.flink.core.memory.MemorySegmentFactory;
|
|
|
|
import org.apache.flink.core.memory.MemorySegmentFactory;
|
|
|
|
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.annotation.Internal;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.ArrayData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.DecimalData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.LocalZonedTimestampData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.MapData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.RecordData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.StringData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.TimestampData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.data.ZonedTimestampData;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.types.DataType;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.types.DecimalType;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.types.LocalZonedTimestampType;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.types.TimestampType;
|
|
|
|
|
|
|
|
import com.ververica.cdc.common.types.ZonedTimestampType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.nio.ByteOrder;
|
|
|
|
import java.nio.ByteOrder;
|
|
|
|
|
|
|
|
|
|
|
|
import static com.ververica.cdc.common.types.DataTypeRoot.DECIMAL;
|
|
|
|
|
|
|
|
import static com.ververica.cdc.common.utils.Preconditions.checkArgument;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* An implementation of {@link RecordData} which is backed by {@link MemorySegment} instead of
|
|
|
|
* An implementation of {@link RecordData} which is backed by {@link MemorySegment} instead of
|
|
|
|
* Object. It can significantly reduce the serialization/deserialization of Java objects.
|
|
|
|
* Object. It can significantly reduce the serialization/deserialization of Java objects.
|
|
|
@ -110,14 +108,14 @@ public final class BinaryRecordData extends BinarySection implements RecordData,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static boolean isMutable(DataType type) {
|
|
|
|
public static boolean isMutable(DataType type) {
|
|
|
|
return isInFixedLengthPart(type) || type.getTypeRoot() == DECIMAL;
|
|
|
|
return isInFixedLengthPart(type) || type.getTypeRoot() == DataTypeRoot.DECIMAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private final int arity;
|
|
|
|
private final int arity;
|
|
|
|
private final int nullBitsSizeInBytes;
|
|
|
|
private final int nullBitsSizeInBytes;
|
|
|
|
|
|
|
|
|
|
|
|
public BinaryRecordData(int arity) {
|
|
|
|
public BinaryRecordData(int arity) {
|
|
|
|
checkArgument(arity >= 0);
|
|
|
|
Preconditions.checkArgument(arity >= 0);
|
|
|
|
this.arity = arity;
|
|
|
|
this.arity = arity;
|
|
|
|
this.nullBitsSizeInBytes = calculateBitSetWidthInBytes(arity);
|
|
|
|
this.nullBitsSizeInBytes = calculateBitSetWidthInBytes(arity);
|
|
|
|
}
|
|
|
|
}
|