-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-16248][SQL] Whitelist the list of Hive fallback functions #13939
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -162,17 +162,6 @@ private[sql] class HiveSessionCatalog( | |
| } | ||
| } | ||
|
|
||
| // We have a list of Hive built-in functions that we do not support. So, we will check | ||
| // Hive's function registry and lazily load needed functions into our own function registry. | ||
| // Those Hive built-in functions are | ||
| // assert_true, collect_list, collect_set, compute_stats, context_ngrams, create_union, | ||
| // current_user ,elt, ewah_bitmap, ewah_bitmap_and, ewah_bitmap_empty, ewah_bitmap_or, field, | ||
| // histogram_numeric, in_file, index, inline, java_method, map_keys, map_values, | ||
| // matchpath, ngrams, noop, noopstreaming, noopwithmap, noopwithmapstreaming, | ||
| // parse_url, parse_url_tuple, percentile, percentile_approx, posexplode, reflect, reflect2, | ||
| // regexp, sentences, stack, std, str_to_map, windowingtablefunction, xpath, xpath_boolean, | ||
| // xpath_double, xpath_float, xpath_int, xpath_long, xpath_number, | ||
| // xpath_short, and xpath_string. | ||
| override def lookupFunction(name: FunctionIdentifier, children: Seq[Expression]): Expression = { | ||
| // TODO: Once lookupFunction accepts a FunctionIdentifier, we should refactor this method to | ||
| // if (super.functionExists(name)) { | ||
|
|
@@ -196,6 +185,10 @@ private[sql] class HiveSessionCatalog( | |
| // built-in function. | ||
| // Hive is case insensitive. | ||
| val functionName = funcName.unquotedString.toLowerCase | ||
| if (!hiveFunctions.contains(functionName)) { | ||
| failFunctionLookup(funcName.unquotedString) | ||
| } | ||
|
|
||
| // TODO: This may not really work for current_user because current_user is not evaluated | ||
| // with session info. | ||
| // We do not need to use executionHive at here because we only load | ||
|
|
@@ -221,4 +214,18 @@ private[sql] class HiveSessionCatalog( | |
| } | ||
| } | ||
| } | ||
|
|
||
| /** List of functions we pass over to Hive. Note that over time this list should go to 0. */ | ||
| // We have a list of Hive built-in functions that we do not support. So, we will check | ||
| // Hive's function registry and lazily load needed functions into our own function registry. | ||
| // Those Hive built-in functions are | ||
| // compute_stats, context_ngrams, create_union, | ||
| // current_user ,elt, ewah_bitmap, ewah_bitmap_and, ewah_bitmap_empty, ewah_bitmap_or, field, | ||
| // histogram_numeric, in_file, index, inline, java_method, map_keys, map_values, | ||
| // matchpath, ngrams, noop, noopstreaming, noopwithmap, noopwithmapstreaming, | ||
| // parse_url, parse_url_tuple, percentile, percentile_approx, posexplode, reflect, reflect2, | ||
| // regexp, sentences, stack, std, str_to_map, windowingtablefunction, xpath, xpath_boolean, | ||
| // xpath_double, xpath_float, xpath_int, xpath_long, xpath_number, | ||
| // xpath_short, and xpath_string. | ||
| private val hiveFunctions = Seq("percentile", "percentile_approx") | ||
|
Member
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. Oh. |
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a TODO above that can be removed?