dongjoon-hyun commented on a change in pull request #24911: [SPARK-28109][SQL] 
Fix TRIM(type trimStr FROM str) returns incorrect value
URL: https://github.com/apache/spark/pull/24911#discussion_r295492327
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
 ##########
 @@ -702,33 +702,40 @@ class PlanParserSuite extends AnalysisTest {
   }
 
   test("TRIM function") {
-    intercept("select ltrim(both 'S' from 'SS abc S'", "missing ')' at 
'<EOF>'")
-    intercept("select rtrim(trailing 'S' from 'SS abc S'", "missing ')' at 
'<EOF>'")
+    def assertTrimPlans(inputSQL: String, expectedExpression: Expression): 
Unit = {
+      comparePlans(
+        parsePlan(inputSQL),
+        Project(Seq(UnresolvedAlias(expectedExpression)), OneRowRelation())
+      )
+    }
 
-    assertEqual(
+    intercept("select ltrim(both 'S' from 'SS abc S'", "mismatched input 
'from' expecting {')'")
+    intercept("select rtrim(trailing 'S' from 'SS abc S'", "mismatched input 
'from' expecting {')'")
 
 Review comment:
   This is the change of error message, but it looks okay. The previous error 
message is the following.
   ```
   spark-sql> select ltrim(both 'S' from 'SS abc S';
   Error in query:
   missing ')' at '<EOF>'(line 1, pos 37)
   
   == SQL ==
   select ltrim(both 'S' from 'SS abc S'
   -------------------------------------^^^
   ```

----------------------------------------------------------------
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