-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25374][SQL] SafeProjection supports fallback to an interpreted mode #22468
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
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 |
|---|---|---|
|
|
@@ -609,19 +609,17 @@ class UnsafeRowConverterSuite extends SparkFunSuite with Matchers with PlanTestB | |
| MapType(StringType, IntegerType), | ||
| MapType(MapType(IntegerType, StringType), MapType(StringType, ShortType))) | ||
|
|
||
| val mapResultRow = convertBackToInternalRow(mapRow, fields4).toSeq(fields4) | ||
| val mapExpectedRow = mapRow.toSeq(fields4) | ||
| // Since `ArrayBasedMapData` does not override `equals` and `hashCode`, | ||
| // we need to take care of it to compare rows. | ||
| // we convert it into the two `Seq`s of keys and values for correct comparisons. | ||
| def toComparable(d: Any): Any = d match { | ||
|
||
| case ar: GenericArrayData => | ||
| ar.array.map(toComparable).toSeq | ||
| case map: ArrayBasedMapData => | ||
| val keys = map.keyArray.array.map(toComparable).toSeq | ||
| val values = map.valueArray.array.map(toComparable).toSeq | ||
| (keys, values) | ||
| case o => o | ||
| } | ||
| val mapResultRow = convertBackToInternalRow(mapRow, fields4).toSeq(fields4) | ||
| val mapExpectedRow = mapRow.toSeq(fields4) | ||
| assert(mapResultRow.map(toComparable) === mapExpectedRow.map(toComparable)) | ||
|
|
||
| // UDT tests | ||
|
|
||
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.
maybe we should implement
equalsandhashCodeinArrayBasedMapDataandUnsafeMapData.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.
Or we can use
ExpressionEvalHelper.checkResulthere.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.
fixed code to use
ExpressionEvalHelper.checkResult.I don't remember correctly though, we might have some historical reasons about that;
ArrayBasedMapDatahas nohashCodeandequals. Probably, somebody might know this... cc: @hvanhovell @viiryaThere 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.
ArrayBasedMapData/UnsafeMapDatadoes not haveequals()orhashCode()implemented because we do not have a good story around map equality. Implementing equals/hashcode for map is only half of the solution, we would also need a comparable binary format.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.
Aha, thanks. I remember that its related to SPARK-18134.