You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/09/26 02:50:01 UTC

[GitHub] [spark] zhengruifeng opened a new pull request, #43115: [TEST ONLY][SQL] Test resolve column reference with PLAN_ID

zhengruifeng opened a new pull request, #43115:
URL: https://github.com/apache/spark/pull/43115

   ### What changes were proposed in this pull request?
   https://github.com/apache/spark/pull/39925 introduced a new approach to resolve column references with PLAN_ID, this PR tests what will happen if we apply it in regular Spark SQL.
   
   
   ### Why are the changes needed?
   NA
   
   
   ### Does this PR introduce _any_ user-facing change?
   NO
   
   
   ### How was this patch tested?
   CI
   
   ### Was this patch authored or co-authored using generative AI tooling?
   NO


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #43115:
URL: https://github.com/apache/spark/pull/43115#discussion_r1347550748


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1489,7 +1476,7 @@ class Dataset[T] private[sql](
       case ParserUtils.qualifiedEscapedIdentifier(nameParts, columnNameRegex) =>
         Column(UnresolvedRegex(columnNameRegex, Some(nameParts), caseSensitive))
       case _ =>
-        Column(addDataFrameIdToCol(resolve(colName)))
+        Column(addPlanId(UnresolvedAttribute.quotedString(colName)))

Review Comment:
   I think we can still eagerly resolve the column here to make sure it exists, then create an `UnresolvedAttribute` from the resolved `AttributeReference`: `UnresolvedAttribute(Seq(attr.name))`.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on a diff in pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #43115:
URL: https://github.com/apache/spark/pull/43115#discussion_r1336569941


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1446,15 +1446,15 @@ class Dataset[T] private[sql](
       if (sqlContext.conf.supportQuotedRegexColumnName) {
         colRegex(colName)
       } else {
-        Column(addDataFrameIdToCol(resolve(colName)))
+        Column(addPlanId(UnresolvedAttribute.quotedString(colName)))
       }
   }
 
   /**
    * Selects column based on the column index (0-based) and returns it as a [[Column]].
    */
   private[sql] def col(index: Int): Column = {
-    Column(addDataFrameIdToCol(queryExecution.analyzed.output(index)))

Review Comment:
   right now PLAN_ID is not actually used in GetColumnByOrdinal resolution, maybe we should  add it in 
   https://github.com/apache/spark/blob/2a10c8d93aa9033842471e4f676fddb3b3f90940/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ColumnResolutionHelper.scala#L493-L506



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] cloud-fan commented on a diff in pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on code in PR #43115:
URL: https://github.com/apache/spark/pull/43115#discussion_r1338097284


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1446,15 +1446,15 @@ class Dataset[T] private[sql](
       if (sqlContext.conf.supportQuotedRegexColumnName) {
         colRegex(colName)
       } else {
-        Column(addDataFrameIdToCol(resolve(colName)))
+        Column(addPlanId(UnresolvedAttribute.quotedString(colName)))
       }
   }
 
   /**
    * Selects column based on the column index (0-based) and returns it as a [[Column]].
    */
   private[sql] def col(index: Int): Column = {
-    Column(addDataFrameIdToCol(queryExecution.analyzed.output(index)))

Review Comment:
   where do we use it? I feel it's risky to get dataframe column references by ordinal. If it's ambiguous, there is no way to fix it, as it can't use qualified names.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID
URL: https://github.com/apache/spark/pull/43115


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on a diff in pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #43115:
URL: https://github.com/apache/spark/pull/43115#discussion_r1338108449


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1446,15 +1446,15 @@ class Dataset[T] private[sql](
       if (sqlContext.conf.supportQuotedRegexColumnName) {
         colRegex(colName)
       } else {
-        Column(addDataFrameIdToCol(resolve(colName)))
+        Column(addPlanId(UnresolvedAttribute.quotedString(colName)))
       }
   }
 
   /**
    * Selects column based on the column index (0-based) and returns it as a [[Column]].
    */
   private[sql] def col(index: Int): Column = {
-    Column(addDataFrameIdToCol(queryExecution.analyzed.output(index)))

Review Comment:
   PySpark already provided `df[i]` with a `int i` to get the i-th column;
   and PySpark support order by ordinal `df.orderBy(1, 2, 3)`;
   
   `GetColumnByOrdinal` is used to support duplicated column names in above two cases.



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43115:
URL: https://github.com/apache/spark/pull/43115#issuecomment-2081715244

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on a diff in pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #43115:
URL: https://github.com/apache/spark/pull/43115#discussion_r1338106440


##########
sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala:
##########
@@ -1446,15 +1446,15 @@ class Dataset[T] private[sql](
       if (sqlContext.conf.supportQuotedRegexColumnName) {
         colRegex(colName)
       } else {
-        Column(addDataFrameIdToCol(resolve(colName)))
+        Column(addPlanId(UnresolvedAttribute.quotedString(colName)))
       }
   }
 
   /**
    * Selects column based on the column index (0-based) and returns it as a [[Column]].
    */
   private[sql] def col(index: Int): Column = {
-    Column(addDataFrameIdToCol(queryExecution.analyzed.output(index)))

Review Comment:
   it was introduced in https://github.com/apache/spark/pull/42828, only used in Python side



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan commented on PR #43115:
URL: https://github.com/apache/spark/pull/43115#issuecomment-1899644429

   @zhengruifeng can we rebase and rerun the tests? The new df col framework got several bug fixes and let's try it out again.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #43115: [TEST ONLY][SQL] Test resolve column references with PLAN_ID
URL: https://github.com/apache/spark/pull/43115


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [TEST ONLY][SQL] Test resolve column references with PLAN_ID [spark]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #43115:
URL: https://github.com/apache/spark/pull/43115#issuecomment-1897542351

   We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
   If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org