Standing-Man commented on code in PR #16848: URL: https://github.com/apache/datafusion/pull/16848#discussion_r2220847542
########## datafusion/sqllogictest/test_files/spark/string/luhn_check.slt: ########## @@ -15,23 +15,114 @@ # specific language governing permissions and limitations # under the License. -# This file was originally created by a porting script from: -# https://github.com/lakehq/sail/tree/43b6ed8221de5c4c4adbedbb267ae1351158b43c/crates/sail-spark-connect/tests/gold_data/function -# This file is part of the implementation of the datafusion-spark function library. -# For more information, please see: -# https://github.com/apache/datafusion/issues/15914 - -## Original Query: SELECT luhn_check('79927398713'); -## PySpark 3.5.5 Result: {'luhn_check(79927398713)': True, 'typeof(luhn_check(79927398713))': 'boolean', 'typeof(79927398713)': 'string'} -#query -#SELECT luhn_check('79927398713'::string); - -## Original Query: SELECT luhn_check('79927398714'); -## PySpark 3.5.5 Result: {'luhn_check(79927398714)': False, 'typeof(luhn_check(79927398714))': 'boolean', 'typeof(79927398714)': 'string'} -#query -#SELECT luhn_check('79927398714'::string); - -## Original Query: SELECT luhn_check('8112189876'); -## PySpark 3.5.5 Result: {'luhn_check(8112189876)': True, 'typeof(luhn_check(8112189876))': 'boolean', 'typeof(8112189876)': 'string'} -#query -#SELECT luhn_check('8112189876'::string); +query B +SELECT luhn_check('79927398713'::string); +---- +true + + +query B +SELECT luhn_check('79927398714'::string); +---- +false + + +query B +SELECT luhn_check('8112189876'::string); +---- +true + +query B +select luhn_check('4111111111111111'::string); +---- +true + +query B +select luhn_check('5500000000000004'::string); +---- +true + +query B +select luhn_check('340000000000009'::string); +---- +true + +query B +select luhn_check('6011000000000004'::string); +---- +true + + +query B +select luhn_check('6011000000000005'::string); +---- +false + + +query B +select luhn_check('378282246310006'::string); +---- +false + + +query B +select luhn_check('0'::string); +---- +true + + +query B +select luhn_check('4111111111111111 '::string) +---- +false + + +query B +select luhn_check('4111111 111111111'::string) +---- +false + +query B +select luhn_check(' 4111111111111111'::string) +---- +false + +query B +select luhn_check(''::string) +---- +false + +query B +select luhn_check(' ') +---- +false + + +query B +select luhn_check('510B105105105106'::string) +---- +false + + +query B +select luhn_check('ABCDED'::string) +---- +false + +query B +select luhn_check(null); +---- +NULL + +query error +select luhn_check(6011111111111117::BIGINT) + + +query error +select luhn_check(6011111111111118::BIGINT) + + +query error +select luhn_check(123.456::decimal(6,3)) Review Comment: Hi @comphead, For inputs like fractional, exponential, or negative numbers, the current implementation just reports that luhn_check doesn't support them. I'm not sure if that's the right approach. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org