vinodkc commented on code in PR #39747: URL: https://github.com/apache/spark/pull/39747#discussion_r1092388057
########## sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionImplUtils.java: ########## @@ -35,6 +35,35 @@ public class ExpressionImplUtils { private static final int GCM_IV_LEN = 12; private static final int GCM_TAG_LEN = 128; + /** + * Function to check if a given number string is a valid Luhn number + * @param numberString + * the number string to check + * @return + * true if the number string is a valid Luhn number, false otherwise. + */ + public static boolean isLuhnNumber(UTF8String numberString) { + String digits = numberString.toString(); + // Check if all characters in the input string are digits. + if (!digits.isEmpty() && digits.chars().allMatch(Character::isDigit)) { Review Comment: Done ########## sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionImplUtils.java: ########## @@ -35,6 +35,35 @@ public class ExpressionImplUtils { private static final int GCM_IV_LEN = 12; private static final int GCM_TAG_LEN = 128; + /** + * Function to check if a given number string is a valid Luhn number + * @param numberString + * the number string to check + * @return + * true if the number string is a valid Luhn number, false otherwise. + */ + public static boolean isLuhnNumber(UTF8String numberString) { + String digits = numberString.toString(); + // Check if all characters in the input string are digits. Review Comment: Done -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org