bowenliang123 commented on code in PR #6786: URL: https://github.com/apache/kyuubi/pull/6786#discussion_r1823819701
########## kyuubi-common/src/main/scala/org/apache/kyuubi/engine/result/TColumnGenerator.scala: ########## @@ -33,16 +33,18 @@ trait TColumnGenerator[RowT] extends TRowSetColumnGetter[RowT] { val rowSize = rows.length val ret = new JArrayList[T](rowSize) val nulls = new JBitSet() + val isConvertFuncDefined = Option(convertFunc).isDefined var idx = 0 rows.foreach { row => val isNull = isColumnNullAt(row, ordinal) if (isNull) { nulls.set(idx, true) ret.add(defaultVal) } else { - val value = Option(convertFunc) match { - case Some(f) => f(row, ordinal) - case _ => getColumnAs[T](row, ordinal) + val value = if (isConvertFuncDefined) { + convertFunc(row, ordinal) + } else { + getColumnAs[T](row, ordinal) Review Comment: I would still prefer to use an extracted boolean value for this. I assume that accessing a boolean costs less step and byte code steps for comparing `convertFunc` to `null`, especially since it's repeatedly used and checked once for each row. -- 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: notifications-unsubscr...@kyuubi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@kyuubi.apache.org For additional commands, e-mail: notifications-h...@kyuubi.apache.org