-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-30790][SQL] The dataType of map() should be map<null,null> #27542
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 3 commits
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 |
|---|---|---|
|
|
@@ -29,12 +29,11 @@ import org.apache.spark.unsafe.array.ByteArrayMethods | |
| */ | ||
| class ArrayBasedMapBuilder(keyType: DataType, valueType: DataType) extends Serializable { | ||
| assert(!keyType.existsRecursively(_.isInstanceOf[MapType]), "key of map cannot be/contain map") | ||
| assert(keyType != NullType, "map key cannot be null type.") | ||
|
|
||
| private lazy val keyToIndex = keyType match { | ||
| // Binary type data is `byte[]`, which can't use `==` to check equality. | ||
| case _: AtomicType | _: CalendarIntervalType if !keyType.isInstanceOf[BinaryType] => | ||
| new java.util.HashMap[Any, Int]() | ||
| case _: AtomicType | _: CalendarIntervalType | _: NullType | ||
|
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. This is done to handle this -> |
||
| if !keyType.isInstanceOf[BinaryType] => new java.util.HashMap[Any, Int]() | ||
| case _ => | ||
| // for complex types, use interpreted ordering to be able to compare unsafe data with safe | ||
| // data, e.g. UnsafeRow vs GenericInternalRow. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2007,12 +2007,13 @@ object SQLConf { | |
| .booleanConf | ||
| .createWithDefault(false) | ||
|
|
||
| val LEGACY_ARRAY_DEFAULT_TO_STRING = | ||
| buildConf("spark.sql.legacy.arrayDefaultToStringType.enabled") | ||
| val LEGACY_CREATE_EMPTY_COLLECTION_USING_STRING_TYPE = | ||
| buildConf("spark.sql.legacy.createEmptyCollectionUsingStringType.enabled") | ||
|
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. I've sent a config naming proposal to dev list, and |
||
| .internal() | ||
| .doc("When set to true, it returns an empty array of string type when the `array` " + | ||
| "function is called without any parameters. Otherwise, it returns an empty " + | ||
| "array of `NullType`") | ||
| .doc("When set to true, it returns an empty array of string type and an empty map with " + | ||
|
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. let's match the migration guide: |
||
| "string type as key/value type when `array` and `map` functions are called without any " + | ||
| "parameters, respectively. Otherwise, it returns an empty array of `NullType` and " + | ||
| "empty map with `NullType` as key/value type, respectively. ") | ||
| .booleanConf | ||
| .createWithDefault(false) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.