[ https://issues.apache.org/jira/browse/FLINK-9907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16552693#comment-16552693
]
ASF GitHub Bot commented on FLINK-9907:
---------------------------------------
Github user yanghua commented on a diff in the pull request:
https://github.com/apache/flink/pull/6382#discussion_r204369826
--- Diff: flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/ScalarFunctionsTest.scala
---
@@ -2063,6 +2063,22 @@ class ScalarFunctionsTest extends ScalarTypesTestBase {
expectedSha256)
}
+ @Test
+ def testCrc32(): Unit = {
+ val expectedCrc32 = "3632233996"
+ testAllApis(
+ "test".crc32(),
+ "crc32('test')",
+ "CRC32('test')",
+ expectedCrc32)
+
+ testAllApis(
+ 'f33.crc32(),
+ "crc32(f33)",
+ "CRC32(f33)",
+ "null")
--- End diff --
I think add more test case, for example :
```
testAllApis(
'f33.crc32(),
"f33.crc32()",
"CRC32(f33)",
"null")
```
looks better to me.
> add CRC32 checksum in table Api and sql
> ---------------------------------------
>
> Key: FLINK-9907
> URL: https://issues.apache.org/jira/browse/FLINK-9907
> Project: Flink
> Issue Type: New Feature
> Components: Table API & SQL
> Reporter: xueyu
> Priority: Major
> Labels: pull-request-available
>
> CRC32 returns the cyclic redundancy check value of a given string as a 32-bit unsigned
value, null if string is null. In mysql and hive the syntax like
> select CRC32('test') = 3632233996
> Though it is not a hash function, however the pattern and behavior looks similar with
hash functions (md5, sha1, sha2 etc..), so I put codegen in HashCalcCallGen
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
|