Github user gatorsmile commented on the issue:

    https://github.com/apache/spark/pull/16550
  
    Could you add the following test cases?
    
    ```SQL
    SELECT CAST('' AS int);
    -> NULL
    SELECT CAST('' AS long);
    -> NULL
    
    SELECT CAST(NULL AS int);
    -> NULL
    SELECT CAST(NULL AS long);
    -> NULL
    
    SELECT CAST('123.a' AS int);
    -> NULL
    SELECT CAST('123.a' AS long);
    -> NULL
    
    // 2147483648 is the smallest INTEGER value (0x80000000)
    SELECT CAST('-2147483648' AS int);
    -> -2147483648
    SELECT CAST('-2147483649' AS int);
    -> NULL
    
    // 2147483647 is the largest INTEGER value (0x7FFFFFFF)
    SELECT CAST('2147483647' AS int);
    -> 2147483647
    SELECT CAST('2147483648' AS int);
    -> NULL
    
    // –9223372036854775808 is the smallest INTEGER value (0x80000000)
    SELECT CAST('–9223372036854775808' AS long);
    -> –9223372036854775808
    SELECT CAST('–9223372036854775809' AS long);
    -> NULL
    
    // 9223372036854775807 is the largest LONG value (0x7FFFFFFFFFFFFFFF)
    SELECT CAST('9223372036854775807' AS long);
    -> 9223372036854775807
    SELECT CAST('–9223372036854775808' AS long);
    -> NULL
    ```



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to