You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "guixiaowen (via GitHub)" <gi...@apache.org> on 2024/04/08 16:39:26 UTC
[PR] [SPARK-47767]Show offset value in TakeOrderedAndProjectExec [spark]
guixiaowen opened a new pull request, #45931:
URL: https://github.com/apache/spark/pull/45931
### What changes were proposed in this pull request?
Show the offset value in TakeOrderedAndProjectExec.
For example:
`
explain select * from test_limit_offset order by a limit 2 offset 1;
plan
== Physical Plan ==
TakeOrderedAndProject(limit=3, orderBy=[a#171 ASC NULLS FIRST](https://issues.apache.org/jira/browse/SPARK-47767#171%20ASC%20NULLS%20FIRST), output=[a#171](https://issues.apache.org/jira/browse/SPARK-47767#171))
+- Scan hive spark_catalog.bigdata_qa.test_limit_offset [a#171](https://issues.apache.org/jira/browse/SPARK-47767#171), HiveTableRelation [`spark_catalog`.`test`.`test_limit_offset`, org.apache.hadoop.hive.ql.io.orc.OrcSerde, Data Cols: [a#171](https://issues.apache.org/jira/browse/SPARK-47767#171), Partition Cols: []]
`
No offset is displayed. If it is displayed, it will be more user-friendly
### Why are the changes needed?
No offset is displayed. If it is displayed, it will be more user-friendly
### Does this PR introduce _any_ user-facing change?
After this pr, the offset in TakeOrderedAndProjectExec will be displayed.
`
explain select * from test_limit_offset order by a limit 2 offset 1;
plan
== Physical Plan ==
TakeOrderedAndProject(limit=3, offset=1, orderBy=[a#171 ASC NULLS FIRST](https://issues.apache.org/jira/browse/SPARK-47767#171%20ASC%20NULLS%20FIRST), output=[a#171](https://issues.apache.org/jira/browse/SPARK-47767#171))
+- Scan hive spark_catalog.bigdata_qa.test_limit_offset [a#171](https://issues.apache.org/jira/browse/SPARK-47767#171), HiveTableRelation [`spark_catalog`.`test`.`test_limit_offset`, org.apache.hadoop.hive.ql.io.orc.OrcSerde, Data Cols: [a#171](https://issues.apache.org/jira/browse/SPARK-47767#171), Partition Cols: []]
`
### How was this patch tested?
ut
### Was this patch authored or co-authored using generative AI tooling?
<!--
If generative AI tooling has been used in the process of authoring this patch, please include the
phrase: 'Generated-by: ' followed by the name of the tool and its version.
If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1556759763
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ s"TakeOrderedAndProject(limit=$limit, offset=$offset, " +
Review Comment:
I think we should probably handle the case when `offset` is not set? It would show it as `0`.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1567621607
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset == 0) { "" } else { s" offset=$offset," }
Review Comment:
> It seems the GA failure is unrelated.
@beliefer OK. Thank you.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on PR #45931:
URL: https://github.com/apache/spark/pull/45931#issuecomment-2059429386
> Could you add one test case like `EXPLAIN ... LIMIT ... OFFSET ... ORDER BY ...` at https://github.com/apache/spark/blob/master/sql/core/src/test/resources/sql-tests/inputs/explain.sql ?
@beliefer OK.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1567304723
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset == 0) { "" } else { s" offset=$offset," }
Review Comment:
It seems the GA failure is unrelated.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "amaliujia (via GitHub)" <gi...@apache.org>.
amaliujia commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1566291325
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,9 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset > 0) { s" offset=$offset, " } else { "" }
Review Comment:
I assume we only need to skip when offset = 0?
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1567314958
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset == 0) { "" } else { s" offset=$offset," }
Review Comment:
It seems the GA failure is unrelated.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1567204208
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset == 0) { "" } else { s" offset=$offset," }
Review Comment:
> How about `val offsetStr = if (offset > 0) s" offset=$offset," else ""` ?
@beliefer Thank you for your review. I made the modifications according to what you said, but there are some UTs that cannot run through. Can you help me take a look.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #45931: [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec
URL: https://github.com/apache/spark/pull/45931
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on PR #45931:
URL: https://github.com/apache/spark/pull/45931#issuecomment-2060168379
> Could you add one test case like `EXPLAIN ... LIMIT ... OFFSET ... ORDER BY ...` at https://github.com/apache/spark/blob/master/sql/core/src/test/resources/sql-tests/inputs/explain.sql ?
@beliefer Thank you for you review. I just changed the prompt message. This will not affect the UT test.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #45931:
URL: https://github.com/apache/spark/pull/45931#issuecomment-2059030991
Could you add one test case like `EXPLAIN ... LIMIT ... OFFSET ... ORDER BY ...` int `explain.sql` ?
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1566011613
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ s"TakeOrderedAndProject(limit=$limit, offset=$offset, " +
Review Comment:
> I think we should probably handle the case when `offset` is not set? It would show it as `0`.
@HyukjinKwon Thank you for your review. I handled this case. Please review 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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1566636044
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,9 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset > 0) { s" offset=$offset, " } else { "" }
Review Comment:
> I assume we only need to skip when offset = 0?
@amaliujia Thank you for your review. I made some modifications.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "guixiaowen (via GitHub)" <gi...@apache.org>.
guixiaowen commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1558776883
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ s"TakeOrderedAndProject(limit=$limit, offset=$offset, " +
Review Comment:
> I think we should probably handle the case when `offset` is not set? It would show it as `0`.
Thank you for your review. I will handle the case when `offset` is not set.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #45931:
URL: https://github.com/apache/spark/pull/45931#issuecomment-2063164089
Merged to master.
--
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] [SPARK-47767][SQL] Show offset value in TakeOrderedAndProjectExec [spark]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #45931:
URL: https://github.com/apache/spark/pull/45931#discussion_r1567035887
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala:
##########
@@ -358,7 +358,8 @@ case class TakeOrderedAndProjectExec(
val orderByString = truncatedString(sortOrder, "[", ",", "]", maxFields)
val outputString = truncatedString(output, "[", ",", "]", maxFields)
- s"TakeOrderedAndProject(limit=$limit, orderBy=$orderByString, output=$outputString)"
+ val offsetStr = if (offset == 0) { "" } else { s" offset=$offset," }
Review Comment:
How about `val offsetStr = if (offset > 0) s" offset=$offset," else ""` ?
--
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