twalthr commented on code in PR #29636:
URL: https://github.com/apache/flink/pull/29636#discussion_r4398561879
##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/ScalarOperatorGens.scala:
##########
@@ -1747,11 +1747,18 @@ object ScalarOperatorGens {
tmpValue
)
} else if (isCharacterString(keyType)) {
- val fieldName = key.literalValue.get.toString
+ val fieldAccess = key.literalValue match {
+ case Some(fieldName) if fieldName != null =>
+ val getterTerm =
+ ctx.addReusableObject(new VariantFieldGetter(fieldName.toString),
"variantFieldGetter")
+ s"$getterTerm.getField($variantTerm)"
+ // A key that is not a literal, or a NULL literal, whose access code
never runs.
+ case _ => s"$variantTerm.getField($keyTerm.toString())"
Review Comment:
Flink's StringData is defined as UTF-8. So yes we can add this performance
optimization.
--
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]