snuyanzin commented on code in PR #28777:
URL: https://github.com/apache/flink/pull/28777#discussion_r3610468668
##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/MapToMapAndMultisetToMultisetCastRule.java:
##########
@@ -132,23 +137,25 @@ protected String generateCodeBlockInternal(
final String innerTargetKeyTypeTerm =
boxedTypeTermForType(innerTargetKeyType);
final String innerTargetValueTypeTerm =
boxedTypeTermForType(innerTargetValueType);
- final String keyArrayTerm = methodCall(inputTerm, "keyArray");
- final String valueArrayTerm = methodCall(inputTerm, "valueArray");
- final String size = methodCall(inputTerm, "size");
+ final String keyArray = newName(codeGeneratorContext, "keyArray");
+ final String valueArray = newName(codeGeneratorContext, "valueArray");
+ final String size = newName(codeGeneratorContext, "size");
final String map = newName(codeGeneratorContext, "map");
final String key = newName(codeGeneratorContext, "key");
final String value = newName(codeGeneratorContext, "value");
return new CastRuleUtils.CodeWriter()
- .declStmt(className(Map.class), map,
constructorCall(HashMap.class))
+ .declStmt(int.class, size, methodCall(inputTerm, "size"))
+ .declStmt(ArrayData.class, keyArray, methodCall(inputTerm,
"keyArray"))
+ .declStmt(ArrayData.class, valueArray, methodCall(inputTerm,
"valueArray"))
+ .declStmt(className(Map.class), map,
constructorCall(HashMap.class, size))
Review Comment:
also jmh shows significant boost after that
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]