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 2022/03/14 15:22:57 UTC

[GitHub] [flink] slinkydeveloper commented on a change in pull request #19001: [FLINK-26520][table] Implement SEARCH operator in codegen

slinkydeveloper commented on a change in pull request #19001:
URL: https://github.com/apache/flink/pull/19001#discussion_r826071344



##########
File path: flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGenUtils.scala
##########
@@ -209,13 +209,27 @@ object CodeGenUtils {
     case _: JShort => s"((short)$value)"
     case _: JInt => value.toString
     case _: JLong => value.toString + "L"
-    case _: JFloat => value.toString + "f"
-    case _: JDouble => value.toString + "d"
+    case _: JFloat => value match {
+      case JFloat.NEGATIVE_INFINITY => "java.lang.Float.NEGATIVE_INFINITY"
+      case JFloat.POSITIVE_INFINITY => "java.lang.Float.POSITIVE_INFINITY"
+      case _ => value.toString + "f"
+    }
+    case _: JDouble => value match {
+      case JDouble.NEGATIVE_INFINITY => "java.lang.Double.NEGATIVE_INFINITY"
+      case JDouble.POSITIVE_INFINITY => "java.lang.Double.POSITIVE_INFINITY"
+      case _ => value.toString + "d"
+    }
     case sd: StringData =>
       qualifyMethod(BINARY_STRING_DATA_FROM_STRING) + "(\"" +
         EncodingUtils.escapeJava(sd.toString) + "\")"
     case td: TimestampData =>
       s"$TIMESTAMP_DATA.fromEpochMillis(${td.getMillisecond}L, ${td.getNanoOfMillisecond})"
+    case decimalData: DecimalData =>
+      s"""$DECIMAL_UTIL.castFrom(

Review comment:
       In this particular case, it doesn't really make a difference, as we store literal values in static variables anyway. I rather prefer to keep the implementation simple here.




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org