flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [flink] klion26 commented on a change in pull request #7958: [FLINK-11881][table-planner-blink] Introduce code generated typed sort to blink table
Date Tue, 12 Mar 2019 06:29:03 GMT
klion26 commented on a change in pull request #7958: [FLINK-11881][table-planner-blink] Introduce
code generated typed sort to blink table
URL: https://github.com/apache/flink/pull/7958#discussion_r264533487
 
 

 ##########
 File path: flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/dataformat/BinaryGeneric.java
 ##########
 @@ -79,4 +79,16 @@ public void materialize() {
 		int offset = (int) (offsetAndSize >> 32);
 		return new BinaryGeneric<>(segments, offset + baseOffset, size, null);
 	}
+
+	public static <T> T getJavaObjectFromBinaryGeneric(BinaryGeneric<T> value, TypeSerializer<T>
ser) {
+		if (value.getJavaObject() == null) {
+			try {
+				value.setJavaObject(InstantiationUtil.deserializeFromByteArray(ser,
+						SegmentsUtil.copyToBytes(value.getSegments(), value.getOffset(), value.getSizeInBytes())));
+			} catch (IOException e) {
+				throw new RuntimeException(e);
 
 Review comment:
   I'm not sure throw `RuntimeException`(unchecked exception) in flink is recommended or not,
and If there is a reason you really want to throw an unchecked exception, maybe you should
use `FlinkRuntimeException`.

----------------------------------------------------------------
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

Mime
View raw message