This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new cf6bf0f  [SPARK-27346][SQL] Loosen the newline assert condition on 
'examples' field in ExpressionInfo
cf6bf0f is described below

commit cf6bf0fcc67739a9995e2d2492587added79ffc3
Author: Hyukjin Kwon <gurwls...@apache.org>
AuthorDate: Wed Apr 3 08:27:41 2019 +0900

    [SPARK-27346][SQL] Loosen the newline assert condition on 'examples' field 
in ExpressionInfo
    
    ## What changes were proposed in this pull request?
    
    I haven't tested by myself on Windows and I am not 100% sure if this is 
going to cause an actual problem.
    
    However, this one line:
    
    
https://github.com/apache/spark/blob/827383a97c11a61661440ff86ce0c3382a2a23b2/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java#L82
    
    made me to investigate a lot today.
    
    Given my speculation, if Spark is built in Linux and it's executed on 
Windows, it looks possible for multiline strings, like,
    
    
https://github.com/apache/spark/blob/5264164a67df498b73facae207eda12ee133be7d/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala#L146-L150
    
    to throw an exception because the newline in the binary is `\n` but 
`System.lineSeparator` returns `\r\n`.
    
    I think this is not yet found because this particular codes are not 
released yet (see SPARK-26426).
    
    Looks just better to loosen the condition and forget about this stuff.
    
    This should be backported into branch-2.4 as well.
    
    ## How was this patch tested?
    
    N/A
    
    Closes #24274 from HyukjinKwon/SPARK-27346.
    
    Authored-by: Hyukjin Kwon <gurwls...@apache.org>
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
    (cherry picked from commit 949d71283932ba4ce50aa6b329665e0f8be7ecf1)
    Signed-off-by: Hyukjin Kwon <gurwls...@apache.org>
---
 .../java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java
 
b/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java
index d5a1b77..20bdd87 100644
--- 
a/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java
+++ 
b/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/ExpressionInfo.java
@@ -79,7 +79,7 @@ public class ExpressionInfo {
         assert name != null;
         assert arguments != null;
         assert examples != null;
-        assert examples.isEmpty() || 
examples.startsWith(System.lineSeparator() + "    Examples:");
+        assert examples.isEmpty() || examples.contains("    Examples:");
         assert note != null;
         assert since != null;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to