iRakson commented on a change in pull request #26933: [SPARK-30292][SQL]Throw 
Exception when invalid string is cast to numeric type in ANSI mode
URL: https://github.com/apache/spark/pull/26933#discussion_r363317159
 
 

 ##########
 File path: 
common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java
 ##########
 @@ -1294,6 +1294,173 @@ public boolean toByte(IntWrapper intWrapper) {
     return false;
   }
 
+  /**
+   * Parses this UTF8String(trimmed if needed) to long.
+   *
+   * This method is almost similar to `toLong` defined above. It is used for 
parsing the UTF8String
+   * when ANSI mode is enabled.
+   * @return If string contains valid numeric value then it returns the long 
value otherwise a
+   * NumberFormatException  is thrown.
+   */
+
+  public long toLongExact() {
 
 Review comment:
   @cloud-fan I have updated the code. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to