Github user dilipbiswal commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17713#discussion_r112805110
  
    --- Diff: 
sql/core/src/test/resources/sql-tests/inputs/subquery/negative-cases/subq-input-typecheck.sql
 ---
    @@ -0,0 +1,47 @@
    +-- The test file contains negative test cases
    +-- of invalid queries where error messages are expected.
    --- End diff --
    
    @gatorsmile Actually there are a few minor difference in the errors that 
are issued. Thats the reason i decided to create the new tests for them to 
capture these new errors. Here are the difference.
    
    1) In Subquery.
       When the the number of columns in left hand and right hand sides of in 
subquery didn't match we raised the error from 
[here](https://github.com/dilipbiswal/spark/blob/d95e4d9d6a9705c534549add6d4a73d554e47274/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala#L1429-L1435)
 in Analyzer. This handled both In and Scalar subquery.
       Now we capture it in checkInputTypes 
[here](https://github.com/dilipbiswal/spark/blob/39e8cf752f5bd3325edbb93e69ee09b92026242f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala#L145-L154)
 and return a slightly clearer error message to the user.
    
    2) Scalar Subquery
       The number of output column > 1 condition was being handled in two 
places, one in Analyzer 
[here](https://github.com/dilipbiswal/spark/blob/39e8cf752f5bd3325edbb93e69ee09b92026242f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala#L145-L154)
   that dealt with correlated scalar subquery and one in checkAnalysis 
[here](https://github.com/apache/spark/blob/760c8d088df1d35d7b8942177d47bc1677daf143/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L134-L136)
 dealt with non-correlated scalar subquery. This is now consolidated at a 
single place 
[here.](https://github.com/dilipbiswal/spark/blob/39e8cf752f5bd3325edbb93e69ee09b92026242f/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala#L402-L405)



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