Skip to content
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

[SPARK-8883][SQL]Remove the OverrideFunctionRegistry #7260

Closed
wants to merge 2 commits into from

Conversation

chenghao-intel
Copy link
Contributor

Remove the OverrideFunctionRegistry from the Spark SQL, as the subclasses of FunctionRegistry have their own way to the delegate to the right underlying FunctionRegistry.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jul 7, 2015

Test build #36662 has started for PR 7260 at commit 2ca8459.

@SparkQA
Copy link

SparkQA commented Jul 7, 2015

Test build #36662 has finished for PR 7260 at commit 2ca8459.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Merged build finished. Test FAILed.

@AmplabJenkins
Copy link

Merged build triggered.

@AmplabJenkins
Copy link

Merged build started.

@SparkQA
Copy link

SparkQA commented Jul 7, 2015

Test build #36688 has started for PR 7260 at commit 164d093.

@SparkQA
Copy link

SparkQA commented Jul 7, 2015

Test build #36688 has finished for PR 7260 at commit 164d093.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@@ -371,7 +371,7 @@ class HiveContext(sc: SparkContext) extends SQLContext(sc) {
// Note that HiveUDFs will be overridden by functions registered in this context.
@transient
override protected[sql] lazy val functionRegistry: FunctionRegistry =
new OverrideFunctionRegistry(new HiveFunctionRegistry(FunctionRegistry.builtin))
new HiveFunctionRegistry(FunctionRegistry.builtin)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this throw UnsupportedOperationException when we register a UDF?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it will not throws exception. HiveFunctionRegistry seems now is like a delegation, the function registry actually will apply to FunctionRegistry.builtin directly. And I think that's the original purpose of the master code. See UDFSuite.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm missing something, but doesn't HiveFunctionRegistry just throw an exception?

  override def registerFunction(name: String, builder: FunctionBuilder): Unit =
    throw new UnsupportedOperationException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the tricky thing, as this code path is hidden(never be called) as we had the wrapper of OverrideFunctionRegistry, see code in HiveContext:

override protected[sql] lazy val functionRegistry: FunctionRegistry =
    new OverrideFunctionRegistry(new HiveFunctionRegistry(FunctionRegistry.builtin))

Since the OverrideFunctionRegistry is removed, we should update this part too.
UPDATE: I mean we should update the code of HiveFunctionRegistry.registerFunction.

@marmbrus
Copy link
Contributor

marmbrus commented Jul 7, 2015

Removing a class is not "minor". That should be reserved for things like fixing a spelling mistake in documentation.

@chenghao-intel
Copy link
Contributor Author

Sorry, @marmbrus , I am not so sure your mean, are you suggesting to create a associated jira issue or not removing the class for now?

@marmbrus
Copy link
Contributor

marmbrus commented Jul 8, 2015

Please create a JIRA
On Jul 7, 2015 5:18 PM, "Cheng Hao" notifications@github.com wrote:

Sorry, @marmbrus https://github.com/marmbrus , I am not so sure your
mean, are you suggesting to create a associated jira issue or not removing
the class for now?


Reply to this email directly or view it on GitHub
#7260 (comment).

@chenghao-intel chenghao-intel changed the title [SQL][Minor] Remove the OverrideFunctionRegistry [SPARK-8883][SQL]Remove the OverrideFunctionRegistry Jul 8, 2015
@@ -76,7 +76,7 @@ private[hive] class HiveFunctionRegistry(underlying: analysis.FunctionRegistry)
}

override def registerFunction(name: String, builder: FunctionBuilder): Unit =
throw new UnsupportedOperationException
underlying.registerFunction(name, builder)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unit test in hive to make sure function registration works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test does exist in the master branch.
See: 'org.apache.spark.sql.hive.UDFSuite' and 'org.apache.spark.sql.UDFSuite'

@rxin
Copy link
Contributor

rxin commented Jul 8, 2015

Alright thanks. Merging this in.

@asfgit asfgit closed this in 351a36d Jul 8, 2015
@chenghao-intel chenghao-intel deleted the override branch July 8, 2015 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants