From 64dc0329ea1f9c9e96d2fe12b1cd72f8d0460377 Mon Sep 17 00:00:00 2001 From: Ryo OKUBO Date: Tue, 22 Dec 2020 11:34:49 +0900 Subject: [PATCH] Use BinaryStringData directly to keep java8 compatibility --- .../protobuf/deserialize/PbCodegenSimpleDeserializer.java | 3 ++- .../formats/protobuf/deserialize/ProtoToRowConverter.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java b/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java index ca12d1b14be30e..cb5a26f946e657 100644 --- a/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java +++ b/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/PbCodegenSimpleDeserializer.java @@ -45,7 +45,8 @@ public String codegen(String returnVarName, String messageGetStr) { case STRING: case ENUM: sb.append( - returnVarName + " = StringData.fromString(" + messageGetStr + ".toString());"); + returnVarName + " = BinaryStringData.fromString(" + messageGetStr + + ".toString());"); break; } return sb.toString(); diff --git a/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/ProtoToRowConverter.java b/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/ProtoToRowConverter.java index b12f0917c670ea..167cf715aec69b 100644 --- a/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/ProtoToRowConverter.java +++ b/flink-formats/flink-protobuf/src/main/java/org/apache/flink/formats/protobuf/deserialize/ProtoToRowConverter.java @@ -28,6 +28,7 @@ import org.apache.flink.table.data.GenericRowData; import org.apache.flink.table.data.RowData; import org.apache.flink.table.data.StringData; +import org.apache.flink.table.data.binary.BinaryStringData; import org.apache.flink.table.types.logical.RowType; import com.google.protobuf.Descriptors; @@ -63,7 +64,7 @@ public ProtoToRowConverter( se.setDefaultImports( RowData.class.getName(), ArrayData.class.getName(), - StringData.class.getName(), + BinaryStringData.class.getName(), GenericRowData.class.getName(), GenericMapData.class.getName(), GenericArrayData.class.getName(),