You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "n-young-db (via GitHub)" <gi...@apache.org> on 2023/12/05 22:08:07 UTC

[PR] [SPARK-46274][SQL] Fix Range operator computeStats() to check long validity before converting [spark]

n-young-db opened a new pull request, #44191:
URL: https://github.com/apache/spark/pull/44191

   ### What changes were proposed in this pull request?
   
   Range operator's `computeStats()` function unsafely casts from `BigInt` to `Long` and causes issues downstream with statistics estimation. Adds bounds checking to avoid crashing.
   
   ### Why are the changes needed?
   
   Downstream statistics estimation will crash and fail loudly; to avoid this and help maintain clean code we should fix this.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   UT
   
   ### 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] [SPARK-46274][SQL] Fix Range operator computeStats() to check long validity before converting [spark]

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

   thanks, merging to master/3.5!


-- 
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-46274][SQL] Fix Range operator computeStats() to check long validity before converting [spark]

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

   cc @cloud-fan 


-- 
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-46274][SQL] Fix Range operator computeStats() to check long validity before converting [spark]

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


##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/statsEstimation/BasicStatsEstimationSuite.scala:
##########
@@ -176,6 +176,25 @@ class BasicStatsEstimationSuite extends PlanTest with StatsEstimationTestBase {
         expectedStatsCboOff = rangeStats, extraConfig)
   }
 
+  test("range with invalid output") {
+    val numElements = BigInt(Long.MaxValue) - BigInt(Long.MinValue)
+    val range = Range(Long.MinValue, Long.MaxValue, 1, None)
+    val rangeStats = Statistics(
+          sizeInBytes = numElements * 8,

Review Comment:
   Would need to fix the indentation. Has to be 2-spaced



-- 
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-46274][SQL] Fix Range operator computeStats() to check long validity before converting [spark]

Posted by "cloud-fan (via GitHub)" <gi...@apache.org>.
cloud-fan closed pull request #44191:  [SPARK-46274][SQL] Fix Range operator computeStats() to check long validity before converting
URL: https://github.com/apache/spark/pull/44191


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