You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "xuyangzhong (via GitHub)" <gi...@apache.org> on 2024/02/07 01:40:29 UTC

Re: [PR] [FLINK-25054][table-planner] Extend the exception message for SHA2 function [flink]

xuyangzhong commented on code in PR #24099:
URL: https://github.com/apache/flink/pull/24099#discussion_r1480779909


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/CodeGeneratorContext.scala:
##########
@@ -1052,7 +1052,7 @@ class CodeGeneratorContext(
          |      "Algorithm for 'SHA-" + $bitLen + "' is not available.", e);
          |  }
          |} else {
-         |  throw new RuntimeException("Unsupported algorithm.");
+         |  throw new RuntimeException("Unsupported SHA2 function with hashLength of $bitLen.");

Review Comment:
   Nit: should we also list the supported algorithms here ?



##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/ScalarFunctionsTest.scala:
##########
@@ -2449,6 +2449,13 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
     // non-constant bit length
     testAllApis("test".sha2('f44), "SHA2('test', f44)", expectedSha256)
 
+    testExpectedAllApisException(
+      "test".sha2(128),
+      "SHA2('test', 128)",
+      "Could not instantiate generated class",

Review Comment:
   Nit: assert the expected message in exception.



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