You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/03/06 01:42:16 UTC

[GitHub] [flink] KurtYoung commented on a change in pull request #7904: [FLINK-11827][table-runtime-blink] Introduce DataFormatConverters to convert internal data format and java format

KurtYoung commented on a change in pull request #7904: [FLINK-11827][table-runtime-blink] Introduce DataFormatConverters to convert internal data format and java format
URL: https://github.com/apache/flink/pull/7904#discussion_r262759077
 
 

 ##########
 File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryArray.java
 ##########
 @@ -49,6 +52,28 @@ public static int calculateHeaderInBytes(int numFields) {
 		return 4 + ((numFields + 31) / 32) * 4;
 	}
 
+	public static int calculateElementSize(InternalType type) {
+		if (type.equals(InternalTypes.BOOLEAN)) {
+			return 1;
+		} else if (type.equals(InternalTypes.BYTE)) {
+			return 1;
+		} else if (type.equals(InternalTypes.SHORT)) {
+			return 2;
+		} else if (type.equals(InternalTypes.INT)) {
+			return 4;
+		} else if (type.equals(InternalTypes.FLOAT)) {
+			return 4;
+		} else if (type.equals(InternalTypes.CHAR)) {
+			return 2;
+		} else if (type.equals(InternalTypes.DATE)) {
+			return 4;
+		} else if (type.equals(InternalTypes.TIME)) {
+			return 4;
+		} else {
+			return 8;
 
 Review comment:
   Why the string type or map type's size is 8?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services