cloud-fan commented on code in PR #39747:
URL: https://github.com/apache/spark/pull/39747#discussion_r1091349674
##########
sql/core/src/test/resources/sql-tests/inputs/string-functions.sql:
##########
@@ -231,3 +231,39 @@ CREATE TEMPORARY VIEW fmtTable(fmtField) AS SELECT * FROM
VALUES ('invalidFormat
SELECT to_binary('abc', fmtField) FROM fmtTable;
-- Clean up
DROP VIEW IF EXISTS fmtTable;
+-- luhn_check
+-- basic cases
+select luhn_check('4111111111111111');
+select luhn_check('5500000000000004');
+select luhn_check('340000000000009');
+select luhn_check('6011000000000004');
+select luhn_check('378282246310005');
+select luhn_check('6011000990139424');
+
+-- spaces in the beginning/middle/end
+select luhn_check('4111111111111111 ');
+select luhn_check('4111111 111111111');
+select luhn_check(' 4111111111111111');
+-- space
+select luhn_check('');
+select luhn_check(' ');
+-- non-digits
+select luhn_check('510B105105105106');
+select luhn_check('ABCDED');
+-- null
+select luhn_check(null);
+-- non string (test implicit cast)
+select luhn_check(6011111111111117);
+select luhn_check(6011111111111118);
+select luhn_check(123.456);
+
+select luhn_check('0');
+
+SELECT luhn_check(c1) from values ("4111111111111111"), ("5105105105105106")
as tab(c1);
Review Comment:
why do we need extra tests for `from values`?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]