zhengruifeng commented on code in PR #44689:
URL: https://github.com/apache/spark/pull/44689#discussion_r1452017640


##########
python/pyspark/sql/tests/connect/test_connect_basic.py:
##########
@@ -558,6 +558,35 @@ def test_invalid_column(self):
         ):
             cdf1.select(cdf2.a).schema
 
+    def test_invalid_star(self):

Review Comment:
   ```
   In [4]: cdf1 = spark.createDataFrame([Row(a=1, b=2, c=3)])
   
   In [5]: cdf2 = spark.createDataFrame([Row(a=2, b=0)])
   
   In [6]: cdf3 = cdf1.select(cdf1.a)
   
   In [7]: cdf3.select(cdf1["*"]).schema
   ...
   AnalysisException: 
[MISSING_ATTRIBUTES.RESOLVED_ATTRIBUTE_MISSING_FROM_INPUT] Resolved 
attribute(s) "b", "c" missing from "a" in operator !Project [a#0L, b#1L, c#2L]. 
 SQLSTATE: XX000;
   !Project [a#0L, b#1L, c#2L]
   +- Project [a#0L]
      +- LogicalRDD [a#0L, b#1L, c#2L], false
   
   
   In [8]: cdf1.select(cdf2["*"]).schema
   ...
   AnalysisException: 
[MISSING_ATTRIBUTES.RESOLVED_ATTRIBUTE_APPEAR_IN_OPERATION] Resolved 
attribute(s) "a", "b" missing from "a", "b", "c" in operator !Project [a#6L, 
b#7L]. Attribute(s) with the same name appear in the operation: "a", "b".
   Please check if the right attribute(s) are used. SQLSTATE: XX000;
   !Project [a#6L, b#7L]
   +- LogicalRDD [a#0L, b#1L, c#2L], false
   
   
   In [9]: cdf1.join(cdf1).select(cdf1["*"]).schema
   Out[9]: StructType([StructField('a', LongType(), True), StructField('b', 
LongType(), True), StructField('c', LongType(), True)])
   ```
   
   `cdf1.join(cdf1).select(cdf1["*"])` won't fail due to 
AMBIGUOUS_COLUMN_REFERENCE



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to