-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-25904][CORE] Allocate arrays smaller than Int.MaxValue #22818
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
64b5ed4
3d77303
ca3efd8
361bf02
f42b1a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -18,7 +18,6 @@ | |||
| package org.apache.spark.sql | ||||
|
|
||||
| import java.io.CharArrayWriter | ||||
| import java.sql.{Date, Timestamp} | ||||
|
|
||||
| import scala.collection.JavaConverters._ | ||||
| import scala.language.implicitConversions | ||||
|
|
@@ -46,7 +45,6 @@ import org.apache.spark.sql.catalyst.parser.{ParseException, ParserUtils} | |||
| import org.apache.spark.sql.catalyst.plans._ | ||||
| import org.apache.spark.sql.catalyst.plans.logical._ | ||||
| import org.apache.spark.sql.catalyst.plans.physical.{Partitioning, PartitioningCollection} | ||||
| import org.apache.spark.sql.catalyst.util.DateTimeUtils | ||||
| import org.apache.spark.sql.execution._ | ||||
| import org.apache.spark.sql.execution.arrow.{ArrowBatchStreamWriter, ArrowConverters} | ||||
| import org.apache.spark.sql.execution.command._ | ||||
|
|
@@ -57,6 +55,7 @@ import org.apache.spark.sql.streaming.DataStreamWriter | |||
| import org.apache.spark.sql.types._ | ||||
| import org.apache.spark.sql.util.SchemaUtils | ||||
| import org.apache.spark.storage.StorageLevel | ||||
| import org.apache.spark.unsafe.array.ByteArrayMethods | ||||
| import org.apache.spark.unsafe.types.CalendarInterval | ||||
| import org.apache.spark.util.Utils | ||||
|
|
||||
|
|
@@ -287,7 +286,7 @@ class Dataset[T] private[sql]( | |||
| _numRows: Int, | ||||
| truncate: Int = 20, | ||||
| vertical: Boolean = false): String = { | ||||
| val numRows = _numRows.max(0).min(Int.MaxValue - 1) | ||||
| val numRows = _numRows.max(0).min(ByteArrayMethods.MAX_ROUNDED_ARRAY_LENGTH - 1) | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the "- 1" really necessary after migrating form
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it is -- we make a
(admittedly its a stretch, you shouldn't be showing 2B rows anyway) |
||||
| // Get rows represented by Seq[Seq[String]], we may get one more line if it has more data. | ||||
| val tmpRows = getRows(numRows, truncate) | ||||
|
|
||||
|
|
@@ -3264,7 +3263,7 @@ class Dataset[T] private[sql]( | |||
| _numRows: Int, | ||||
| truncate: Int): Array[Any] = { | ||||
| EvaluatePython.registerPicklers() | ||||
| val numRows = _numRows.max(0).min(Int.MaxValue - 1) | ||||
| val numRows = _numRows.max(0).min(ByteArrayMethods.MAX_ROUNDED_ARRAY_LENGTH - 1) | ||||
| val rows = getRows(numRows, truncate).map(_.toArray).toArray | ||||
| val toJava: (Any) => Any = EvaluatePython.toJava(_, ArrayType(ArrayType(StringType))) | ||||
| val iter: Iterator[Array[Byte]] = new SerDeUtil.AutoBatchedPickler( | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.