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-26681][SQL] Support Ammonite inner-class scopes. #23607

Closed
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -53,6 +53,12 @@ object OuterScopes {
val outer = outerScopes.get(outerClassName)
if (outer == null) {
outerClassName match {
case AmmoniteREPLClass(cellClassName) =>
() => {
val objClass = Utils.classForName(cellClassName)
val objInstance = objClass.getField("MODULE$").get(null)
objClass.getMethod("instance").invoke(objInstance)
}
// If the outer class is generated by REPL, users don't need to register it as it has
// only one instance and there is a way to retrieve it: get the `$read` object, call the
// `INSTANCE()` method to get the single instance of class `$read`. Then call `$iw()`
@@ -95,4 +101,8 @@ object OuterScopes {

// The format of REPL generated wrapper class's name, e.g. `$line12.$read$$iw$$iw`
private[this] val REPLClass = """^(\$line(?:\d+)\.\$read)(?:\$\$iw)+$""".r

// The format of ammonite REPL generated wrapper class's name,
// e.g. `ammonite.$sess.cmd8$Helper$Foo` -> `ammonite.$sess.cmd8.instance.Foo`
private[this] val AmmoniteREPLClass = """^(ammonite\.\$sess\.cmd(?:\d+)\$).*""".r
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.