-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25498][SQL] InterpretedMutableProjection should handle UnsafeRow #22512
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 1 commit
3faf314
ef20325
09767a0
df07fc4
388213f
243fae3
3553d91
95411c8
4cdc504
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ | |
|
|
||
| package org.apache.spark.sql.catalyst | ||
|
|
||
| import org.apache.spark.SparkException | ||
| import org.apache.spark.sql.catalyst.expressions._ | ||
| import org.apache.spark.sql.catalyst.util.{ArrayData, MapData} | ||
| import org.apache.spark.sql.types._ | ||
|
|
@@ -157,4 +158,24 @@ object InternalRow { | |
| getValueNullSafe | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns a writer for an `InternalRow` with given data type. | ||
| */ | ||
| def getWriter(ordinal: Int, dt: DataType): (InternalRow, Any) => Unit = dt match { | ||
| case BooleanType => (input, v) => input.setBoolean(ordinal, v.asInstanceOf[Boolean]) | ||
| case ByteType => (input, v) => input.setByte(ordinal, v.asInstanceOf[Byte]) | ||
| case ShortType => (input, v) => input.setShort(ordinal, v.asInstanceOf[Short]) | ||
| case IntegerType | DateType => (input, v) => input.setInt(ordinal, v.asInstanceOf[Int]) | ||
| case LongType | TimestampType => (input, v) => input.setLong(ordinal, v.asInstanceOf[Long]) | ||
| case FloatType => (input, v) => input.setFloat(ordinal, v.asInstanceOf[Float]) | ||
| case DoubleType => (input, v) => input.setDouble(ordinal, v.asInstanceOf[Double]) | ||
| case DecimalType.Fixed(precision, _) => | ||
| (input, v) => input.setDecimal(ordinal, v.asInstanceOf[Decimal], precision) | ||
| case CalendarIntervalType | BinaryType | _: ArrayType | StringType | _: StructType | | ||
| _: MapType | _: ObjectType | _: UserDefinedType[_] => | ||
| (input, v) => input.update(ordinal, v) | ||
| case NullType => (input, v) => {} | ||
|
||
| case _ => throw new SparkException(s"Unsupported data type $dt") | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should recursive into UDT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok