mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
[ZEPPELIN-2297] updating completions
This commit is contained in:
parent
ef6c9cb0c8
commit
5308f1e651
60 changed files with 266 additions and 96 deletions
|
|
@ -166,7 +166,8 @@ public class AlluxioInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
String[] words = splitAndRemoveEmpty(splitAndRemoveEmpty(buf, "\n"), " ");
|
||||
String lastWord = "";
|
||||
if (words.length > 0) {
|
||||
|
|
|
|||
|
|
@ -97,11 +97,11 @@ public class AlluxioInterpreterTest {
|
|||
new InterpreterCompletion("copyToLocal", "copyToLocal", CompletionType.command.name()));
|
||||
List expectedResultNone = new ArrayList<>();
|
||||
|
||||
List<InterpreterCompletion> resultOne = alluxioInterpreter.completion("c", 0);
|
||||
List<InterpreterCompletion> resultTwo = alluxioInterpreter.completion("co", 0);
|
||||
List<InterpreterCompletion> resultThree = alluxioInterpreter.completion("copy", 0);
|
||||
List<InterpreterCompletion> resultNotMatch = alluxioInterpreter.completion("notMatch", 0);
|
||||
List<InterpreterCompletion> resultAll = alluxioInterpreter.completion("", 0);
|
||||
List<InterpreterCompletion> resultOne = alluxioInterpreter.completion("c", 0, null);
|
||||
List<InterpreterCompletion> resultTwo = alluxioInterpreter.completion("co", 0, null);
|
||||
List<InterpreterCompletion> resultThree = alluxioInterpreter.completion("copy", 0, null);
|
||||
List<InterpreterCompletion> resultNotMatch = alluxioInterpreter.completion("notMatch", 0, null);
|
||||
List<InterpreterCompletion> resultAll = alluxioInterpreter.completion("", 0, null);
|
||||
|
||||
Assert.assertEquals(expectedResultOne, resultOne);
|
||||
Assert.assertEquals(expectedResultTwo, resultTwo);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ public class AngularInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,8 @@ public class BeamInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -332,7 +332,8 @@ public class BigQueryInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,8 @@ public class CassandraInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -240,7 +240,8 @@ public class ElasticsearchInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
public List<InterpreterCompletion> completion(String s, int i,
|
||||
InterpreterContext interpreterContext) {
|
||||
final List suggestions = new ArrayList<>();
|
||||
|
||||
for (final String cmd : COMMANDS) {
|
||||
|
|
|
|||
|
|
@ -309,9 +309,9 @@ public class ElasticsearchInterpreterTest {
|
|||
final List<InterpreterCompletion> expectedResultOne = Arrays.asList(new InterpreterCompletion("count", "count", CompletionType.command.name()));
|
||||
final List<InterpreterCompletion> expectedResultTwo = Arrays.asList(new InterpreterCompletion("help", "help", CompletionType.command.name()));
|
||||
|
||||
final List<InterpreterCompletion> resultOne = interpreter.completion("co", 0);
|
||||
final List<InterpreterCompletion> resultTwo = interpreter.completion("he", 0);
|
||||
final List<InterpreterCompletion> resultAll = interpreter.completion("", 0);
|
||||
final List<InterpreterCompletion> resultOne = interpreter.completion("co", 0, null);
|
||||
final List<InterpreterCompletion> resultTwo = interpreter.completion("he", 0, null);
|
||||
final List<InterpreterCompletion> resultAll = interpreter.completion("", 0, null);
|
||||
|
||||
Assert.assertEquals(expectedResultOne, resultOne);
|
||||
Assert.assertEquals(expectedResultTwo, resultTwo);
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ public abstract class FileInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.*;
|
|||
import com.google.gson.Gson;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.zeppelin.completer.CompletionType;
|
||||
import org.apache.zeppelin.interpreter.InterpreterContext;
|
||||
import org.apache.zeppelin.interpreter.InterpreterException;
|
||||
import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
|
||||
|
||||
|
|
@ -248,7 +249,8 @@ public class HDFSFileInterpreter extends FileInterpreter {
|
|||
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
logger.info("Completion request at position\t" + cursor + " in string " + buf);
|
||||
final List<InterpreterCompletion> suggestions = new ArrayList<>();
|
||||
if (StringUtils.isEmpty(buf)) {
|
||||
|
|
|
|||
|
|
@ -111,8 +111,8 @@ public class HDFSFileInterpreterTest extends TestCase {
|
|||
new InterpreterCompletion("ls", "ls", CompletionType.command.name()));
|
||||
List expectedResultTwo = Arrays.asList(
|
||||
new InterpreterCompletion("pwd", "pwd", CompletionType.command.name()));
|
||||
List<InterpreterCompletion> resultOne = t.completion("l", 0);
|
||||
List<InterpreterCompletion> resultTwo = t.completion("p", 0);
|
||||
List<InterpreterCompletion> resultOne = t.completion("l", 0, null);
|
||||
List<InterpreterCompletion> resultTwo = t.completion("p", 0, null);
|
||||
|
||||
assertEquals(expectedResultOne, resultOne);
|
||||
assertEquals(expectedResultTwo, resultTwo);
|
||||
|
|
|
|||
|
|
@ -373,7 +373,8 @@ public class FlinkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ public class GeodeOqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -145,7 +145,8 @@ public class HbaseInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ public class DevInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -331,7 +331,8 @@ public class IgniteInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,7 +184,8 @@ public class IgniteSqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new LinkedList<>();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,15 +127,12 @@ public class JDBCInterpreter extends Interpreter {
|
|||
|
||||
private final HashMap<String, Properties> basePropretiesMap;
|
||||
private final HashMap<String, JDBCUserConfigurations> jdbcUserConfigurationsMap;
|
||||
private final Map<String, SqlCompleter> propertyKeySqlCompleterMap;
|
||||
|
||||
private static final List<InterpreterCompletion> NO_COMPLETION = new ArrayList<>();
|
||||
private int maxLineResults;
|
||||
|
||||
public JDBCInterpreter(Properties property) {
|
||||
super(property);
|
||||
jdbcUserConfigurationsMap = new HashMap<>();
|
||||
propertyKeySqlCompleterMap = new HashMap<>();
|
||||
basePropretiesMap = new HashMap<>();
|
||||
maxLineResults = MAX_LINE_DEFAULT;
|
||||
}
|
||||
|
|
@ -183,9 +180,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
if (!isEmpty(property.getProperty("zeppelin.jdbc.auth.type"))) {
|
||||
JDBCSecurityImpl.createSecureConfiguration(property);
|
||||
}
|
||||
for (String propertyKey : basePropretiesMap.keySet()) {
|
||||
propertyKeySqlCompleterMap.put(propertyKey, createSqlCompleter(null));
|
||||
}
|
||||
|
||||
setMaxLineResults();
|
||||
}
|
||||
|
||||
|
|
@ -414,7 +409,7 @@ public class JDBCInterpreter extends Interpreter {
|
|||
connection = getConnectionFromPool(url, user, propertyKey, properties);
|
||||
}
|
||||
}
|
||||
propertyKeySqlCompleterMap.put(propertyKey, createSqlCompleter(connection));
|
||||
|
||||
return connection;
|
||||
}
|
||||
|
||||
|
|
@ -746,12 +741,25 @@ public class JDBCInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
List<InterpreterCompletion> candidates = new ArrayList<>();
|
||||
SqlCompleter sqlCompleter = propertyKeySqlCompleterMap.get(getPropertyKey(buf));
|
||||
String propertyKey = getPropertyKey(buf);
|
||||
Connection connection = null;
|
||||
try {
|
||||
if (interpreterContext != null) {
|
||||
connection = getConnection(propertyKey, interpreterContext);
|
||||
}
|
||||
} catch (ClassNotFoundException | SQLException | IOException e) {
|
||||
logger.warn("SQLCompleter will created without use connection");
|
||||
}
|
||||
|
||||
SqlCompleter sqlCompleter = createSqlCompleter(connection);
|
||||
|
||||
if (sqlCompleter != null) {
|
||||
sqlCompleter.complete(buf, cursor - 1, candidates);
|
||||
}
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ public class SqlCompleter {
|
|||
*/
|
||||
public void initFromConnection(Connection connection, String schemaFilter) {
|
||||
|
||||
try {
|
||||
try (Connection c = connection) {
|
||||
Map<String, Set<String>> tables = new HashMap<>();
|
||||
Map<String, Set<String>> columns = new HashMap<>();
|
||||
Set<String> schemas = new HashSet<>();
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
|
|||
|
||||
jdbcInterpreter.interpret("", interpreterContext);
|
||||
|
||||
List<InterpreterCompletion> completionList = jdbcInterpreter.completion("sel", 3);
|
||||
List<InterpreterCompletion> completionList = jdbcInterpreter.completion("sel", 3, null);
|
||||
|
||||
InterpreterCompletion correctCompletionKeyword = new InterpreterCompletion("select ", "select ", CompletionType.keyword.name());
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,8 @@ public class KylinInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -420,7 +420,8 @@ public class LensInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,8 @@ public class Markdown extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -435,7 +435,8 @@ public class PythonInterpreter extends Interpreter implements ExecuteResultHandl
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ public class KnitR extends Interpreter implements WrappedInterpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
List completion = intp.completion(s, i);
|
||||
public List<InterpreterCompletion> completion(String s, int i,
|
||||
InterpreterContext interpreterContext) {
|
||||
List completion = intp.completion(s, i, interpreterContext);
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,8 +77,9 @@ public class RRepl extends Interpreter implements WrappedInterpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String s, int i) {
|
||||
List completion = intp.completion(s, i);
|
||||
public List<InterpreterCompletion> completion(String s, int i,
|
||||
InterpreterContext interpreterContext) {
|
||||
List completion = intp.completion(s, i, interpreterContext);
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,8 @@ public class ScaldingInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return NO_COMPLETION;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,8 @@ public class ShellInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,7 +286,8 @@ public class DepInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
if (Utils.isScala2_10()) {
|
||||
ScalaCompleter c = (ScalaCompleter) Utils.invokeMethod(completer, "completer");
|
||||
Candidates ret = c.complete(buf, cursor);
|
||||
|
|
|
|||
|
|
@ -458,7 +458,8 @@ public class PySparkInterpreter extends Interpreter implements ExecuteResultHand
|
|||
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
if (buf.length() < cursor) {
|
||||
cursor = buf.length();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1057,7 +1057,8 @@ public class SparkInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
if (completer == null) {
|
||||
logger.warn("Can't find completer");
|
||||
return new LinkedList<>();
|
||||
|
|
|
|||
|
|
@ -208,7 +208,8 @@ public class SparkRInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,8 @@ public class SparkSqlInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class PySparkInterpreterTest {
|
|||
@Test
|
||||
public void testCompletion() {
|
||||
if (getSparkVersionNumber() > 11) {
|
||||
List<InterpreterCompletion> completions = pySparkInterpreter.completion("sc.", "sc.".length());
|
||||
List<InterpreterCompletion> completions = pySparkInterpreter.completion("sc.", "sc.".length(), null);
|
||||
assertTrue(completions.size() > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ public class SparkInterpreterTest {
|
|||
|
||||
@Test
|
||||
public void testCompletion() {
|
||||
List<InterpreterCompletion> completions = repl.completion("sc.", "sc.".length());
|
||||
List<InterpreterCompletion> completions = repl.completion("sc.", "sc.".length(), null);
|
||||
assertTrue(completions.size() > 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,11 +152,12 @@ public class ClassloaderInterpreter
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
ClassLoader oldcl = Thread.currentThread().getContextClassLoader();
|
||||
Thread.currentThread().setContextClassLoader(cl);
|
||||
try {
|
||||
List completion = intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor, interpreterContext);
|
||||
return completion;
|
||||
} catch (Exception e) {
|
||||
throw new InterpreterException(e);
|
||||
|
|
|
|||
|
|
@ -98,10 +98,12 @@ public abstract class Interpreter {
|
|||
*
|
||||
* @param buf statements
|
||||
* @param cursor cursor position in statements
|
||||
* @param interpreterContext
|
||||
* @return list of possible completion. Return empty list if there're nothing to return.
|
||||
*/
|
||||
@ZeppelinApi
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,9 +124,10 @@ public class LazyOpenInterpreter
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
open();
|
||||
List completion = intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor, interpreterContext);
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -441,7 +441,8 @@ public class RemoteInterpreter extends Interpreter {
|
|||
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
RemoteInterpreterProcess interpreterProcess = getInterpreterProcess();
|
||||
Client client = null;
|
||||
try {
|
||||
|
|
@ -452,7 +453,8 @@ public class RemoteInterpreter extends Interpreter {
|
|||
|
||||
boolean broken = false;
|
||||
try {
|
||||
List completion = client.completion(sessionKey, className, buf, cursor);
|
||||
List completion = client.completion(sessionKey, className, buf, cursor,
|
||||
convert(interpreterContext));
|
||||
return completion;
|
||||
} catch (TException e) {
|
||||
broken = true;
|
||||
|
|
|
|||
|
|
@ -562,10 +562,10 @@ public class RemoteInterpreterServer
|
|||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String noteId,
|
||||
String className, String buf, int cursor)
|
||||
String className, String buf, int cursor, RemoteInterpreterContext remoteInterpreterContext)
|
||||
throws TException {
|
||||
Interpreter intp = getInterpreter(noteId, className);
|
||||
List completion = intp.completion(buf, cursor);
|
||||
List completion = intp.completion(buf, cursor, convert(remoteInterpreterContext, null));
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class InterpreterCompletion implements org.apache.thrift.TBase<InterpreterCompletion, InterpreterCompletion._Fields>, java.io.Serializable, Cloneable, Comparable<InterpreterCompletion> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("InterpreterCompletion");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteApplicationResult implements org.apache.thrift.TBase<RemoteApplicationResult, RemoteApplicationResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteApplicationResult> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteApplicationResult");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterContext> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterEvent> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResult> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteInterpreterResultMessage implements org.apache.thrift.TBase<RemoteInterpreterResultMessage, RemoteInterpreterResultMessage._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResultMessage> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResultMessage");
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class RemoteInterpreterService {
|
||||
|
||||
public interface Iface {
|
||||
|
|
@ -70,7 +70,7 @@ public class RemoteInterpreterService {
|
|||
|
||||
public String getFormType(String sessionKey, String className) throws org.apache.thrift.TException;
|
||||
|
||||
public List<InterpreterCompletion> completion(String sessionKey, String className, String buf, int cursor) throws org.apache.thrift.TException;
|
||||
public List<InterpreterCompletion> completion(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext) throws org.apache.thrift.TException;
|
||||
|
||||
public void shutdown() throws org.apache.thrift.TException;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ public class RemoteInterpreterService {
|
|||
|
||||
public void getFormType(String sessionKey, String className, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
|
||||
|
||||
public void completion(String sessionKey, String className, String buf, int cursor, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
|
||||
public void completion(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
|
||||
|
||||
public void shutdown(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
|
||||
|
||||
|
|
@ -349,19 +349,20 @@ public class RemoteInterpreterService {
|
|||
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getFormType failed: unknown result");
|
||||
}
|
||||
|
||||
public List<InterpreterCompletion> completion(String sessionKey, String className, String buf, int cursor) throws org.apache.thrift.TException
|
||||
public List<InterpreterCompletion> completion(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext) throws org.apache.thrift.TException
|
||||
{
|
||||
send_completion(sessionKey, className, buf, cursor);
|
||||
send_completion(sessionKey, className, buf, cursor, interpreterContext);
|
||||
return recv_completion();
|
||||
}
|
||||
|
||||
public void send_completion(String sessionKey, String className, String buf, int cursor) throws org.apache.thrift.TException
|
||||
public void send_completion(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext) throws org.apache.thrift.TException
|
||||
{
|
||||
completion_args args = new completion_args();
|
||||
args.setSessionKey(sessionKey);
|
||||
args.setClassName(className);
|
||||
args.setBuf(buf);
|
||||
args.setCursor(cursor);
|
||||
args.setInterpreterContext(interpreterContext);
|
||||
sendBase("completion", args);
|
||||
}
|
||||
|
||||
|
|
@ -1064,9 +1065,9 @@ public class RemoteInterpreterService {
|
|||
}
|
||||
}
|
||||
|
||||
public void completion(String sessionKey, String className, String buf, int cursor, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
|
||||
public void completion(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
|
||||
checkReady();
|
||||
completion_call method_call = new completion_call(sessionKey, className, buf, cursor, resultHandler, this, ___protocolFactory, ___transport);
|
||||
completion_call method_call = new completion_call(sessionKey, className, buf, cursor, interpreterContext, resultHandler, this, ___protocolFactory, ___transport);
|
||||
this.___currentMethod = method_call;
|
||||
___manager.call(method_call);
|
||||
}
|
||||
|
|
@ -1076,12 +1077,14 @@ public class RemoteInterpreterService {
|
|||
private String className;
|
||||
private String buf;
|
||||
private int cursor;
|
||||
public completion_call(String sessionKey, String className, String buf, int cursor, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
|
||||
private RemoteInterpreterContext interpreterContext;
|
||||
public completion_call(String sessionKey, String className, String buf, int cursor, RemoteInterpreterContext interpreterContext, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
|
||||
super(client, protocolFactory, transport, resultHandler, false);
|
||||
this.sessionKey = sessionKey;
|
||||
this.className = className;
|
||||
this.buf = buf;
|
||||
this.cursor = cursor;
|
||||
this.interpreterContext = interpreterContext;
|
||||
}
|
||||
|
||||
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
|
||||
|
|
@ -1091,6 +1094,7 @@ public class RemoteInterpreterService {
|
|||
args.setClassName(className);
|
||||
args.setBuf(buf);
|
||||
args.setCursor(cursor);
|
||||
args.setInterpreterContext(interpreterContext);
|
||||
args.write(prot);
|
||||
prot.writeMessageEnd();
|
||||
}
|
||||
|
|
@ -1933,7 +1937,7 @@ public class RemoteInterpreterService {
|
|||
|
||||
public completion_result getResult(I iface, completion_args args) throws org.apache.thrift.TException {
|
||||
completion_result result = new completion_result();
|
||||
result.success = iface.completion(args.sessionKey, args.className, args.buf, args.cursor);
|
||||
result.success = iface.completion(args.sessionKey, args.className, args.buf, args.cursor, args.interpreterContext);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -2742,7 +2746,7 @@ public class RemoteInterpreterService {
|
|||
}
|
||||
|
||||
public void start(I iface, completion_args args, org.apache.thrift.async.AsyncMethodCallback<List<InterpreterCompletion>> resultHandler) throws TException {
|
||||
iface.completion(args.sessionKey, args.className, args.buf, args.cursor,resultHandler);
|
||||
iface.completion(args.sessionKey, args.className, args.buf, args.cursor, args.interpreterContext,resultHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -9809,6 +9813,7 @@ public class RemoteInterpreterService {
|
|||
private static final org.apache.thrift.protocol.TField CLASS_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("className", org.apache.thrift.protocol.TType.STRING, (short)2);
|
||||
private static final org.apache.thrift.protocol.TField BUF_FIELD_DESC = new org.apache.thrift.protocol.TField("buf", org.apache.thrift.protocol.TType.STRING, (short)3);
|
||||
private static final org.apache.thrift.protocol.TField CURSOR_FIELD_DESC = new org.apache.thrift.protocol.TField("cursor", org.apache.thrift.protocol.TType.I32, (short)4);
|
||||
private static final org.apache.thrift.protocol.TField INTERPRETER_CONTEXT_FIELD_DESC = new org.apache.thrift.protocol.TField("interpreterContext", org.apache.thrift.protocol.TType.STRUCT, (short)5);
|
||||
|
||||
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
|
||||
static {
|
||||
|
|
@ -9820,13 +9825,15 @@ public class RemoteInterpreterService {
|
|||
public String className; // required
|
||||
public String buf; // required
|
||||
public int cursor; // required
|
||||
public RemoteInterpreterContext interpreterContext; // required
|
||||
|
||||
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
|
||||
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
|
||||
SESSION_KEY((short)1, "sessionKey"),
|
||||
CLASS_NAME((short)2, "className"),
|
||||
BUF((short)3, "buf"),
|
||||
CURSOR((short)4, "cursor");
|
||||
CURSOR((short)4, "cursor"),
|
||||
INTERPRETER_CONTEXT((short)5, "interpreterContext");
|
||||
|
||||
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
|
||||
|
||||
|
|
@ -9849,6 +9856,8 @@ public class RemoteInterpreterService {
|
|||
return BUF;
|
||||
case 4: // CURSOR
|
||||
return CURSOR;
|
||||
case 5: // INTERPRETER_CONTEXT
|
||||
return INTERPRETER_CONTEXT;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
@ -9902,6 +9911,8 @@ public class RemoteInterpreterService {
|
|||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
|
||||
tmpMap.put(_Fields.CURSOR, new org.apache.thrift.meta_data.FieldMetaData("cursor", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
|
||||
tmpMap.put(_Fields.INTERPRETER_CONTEXT, new org.apache.thrift.meta_data.FieldMetaData("interpreterContext", org.apache.thrift.TFieldRequirementType.DEFAULT,
|
||||
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, RemoteInterpreterContext.class)));
|
||||
metaDataMap = Collections.unmodifiableMap(tmpMap);
|
||||
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(completion_args.class, metaDataMap);
|
||||
}
|
||||
|
|
@ -9913,7 +9924,8 @@ public class RemoteInterpreterService {
|
|||
String sessionKey,
|
||||
String className,
|
||||
String buf,
|
||||
int cursor)
|
||||
int cursor,
|
||||
RemoteInterpreterContext interpreterContext)
|
||||
{
|
||||
this();
|
||||
this.sessionKey = sessionKey;
|
||||
|
|
@ -9921,6 +9933,7 @@ public class RemoteInterpreterService {
|
|||
this.buf = buf;
|
||||
this.cursor = cursor;
|
||||
setCursorIsSet(true);
|
||||
this.interpreterContext = interpreterContext;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -9938,6 +9951,9 @@ public class RemoteInterpreterService {
|
|||
this.buf = other.buf;
|
||||
}
|
||||
this.cursor = other.cursor;
|
||||
if (other.isSetInterpreterContext()) {
|
||||
this.interpreterContext = new RemoteInterpreterContext(other.interpreterContext);
|
||||
}
|
||||
}
|
||||
|
||||
public completion_args deepCopy() {
|
||||
|
|
@ -9951,6 +9967,7 @@ public class RemoteInterpreterService {
|
|||
this.buf = null;
|
||||
setCursorIsSet(false);
|
||||
this.cursor = 0;
|
||||
this.interpreterContext = null;
|
||||
}
|
||||
|
||||
public String getSessionKey() {
|
||||
|
|
@ -10048,6 +10065,30 @@ public class RemoteInterpreterService {
|
|||
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __CURSOR_ISSET_ID, value);
|
||||
}
|
||||
|
||||
public RemoteInterpreterContext getInterpreterContext() {
|
||||
return this.interpreterContext;
|
||||
}
|
||||
|
||||
public completion_args setInterpreterContext(RemoteInterpreterContext interpreterContext) {
|
||||
this.interpreterContext = interpreterContext;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void unsetInterpreterContext() {
|
||||
this.interpreterContext = null;
|
||||
}
|
||||
|
||||
/** Returns true if field interpreterContext is set (has been assigned a value) and false otherwise */
|
||||
public boolean isSetInterpreterContext() {
|
||||
return this.interpreterContext != null;
|
||||
}
|
||||
|
||||
public void setInterpreterContextIsSet(boolean value) {
|
||||
if (!value) {
|
||||
this.interpreterContext = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFieldValue(_Fields field, Object value) {
|
||||
switch (field) {
|
||||
case SESSION_KEY:
|
||||
|
|
@ -10082,6 +10123,14 @@ public class RemoteInterpreterService {
|
|||
}
|
||||
break;
|
||||
|
||||
case INTERPRETER_CONTEXT:
|
||||
if (value == null) {
|
||||
unsetInterpreterContext();
|
||||
} else {
|
||||
setInterpreterContext((RemoteInterpreterContext)value);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -10099,6 +10148,9 @@ public class RemoteInterpreterService {
|
|||
case CURSOR:
|
||||
return Integer.valueOf(getCursor());
|
||||
|
||||
case INTERPRETER_CONTEXT:
|
||||
return getInterpreterContext();
|
||||
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
|
@ -10118,6 +10170,8 @@ public class RemoteInterpreterService {
|
|||
return isSetBuf();
|
||||
case CURSOR:
|
||||
return isSetCursor();
|
||||
case INTERPRETER_CONTEXT:
|
||||
return isSetInterpreterContext();
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
|
@ -10171,6 +10225,15 @@ public class RemoteInterpreterService {
|
|||
return false;
|
||||
}
|
||||
|
||||
boolean this_present_interpreterContext = true && this.isSetInterpreterContext();
|
||||
boolean that_present_interpreterContext = true && that.isSetInterpreterContext();
|
||||
if (this_present_interpreterContext || that_present_interpreterContext) {
|
||||
if (!(this_present_interpreterContext && that_present_interpreterContext))
|
||||
return false;
|
||||
if (!this.interpreterContext.equals(that.interpreterContext))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -10198,6 +10261,11 @@ public class RemoteInterpreterService {
|
|||
if (present_cursor)
|
||||
list.add(cursor);
|
||||
|
||||
boolean present_interpreterContext = true && (isSetInterpreterContext());
|
||||
list.add(present_interpreterContext);
|
||||
if (present_interpreterContext)
|
||||
list.add(interpreterContext);
|
||||
|
||||
return list.hashCode();
|
||||
}
|
||||
|
||||
|
|
@ -10249,6 +10317,16 @@ public class RemoteInterpreterService {
|
|||
return lastComparison;
|
||||
}
|
||||
}
|
||||
lastComparison = Boolean.valueOf(isSetInterpreterContext()).compareTo(other.isSetInterpreterContext());
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
if (isSetInterpreterContext()) {
|
||||
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.interpreterContext, other.interpreterContext);
|
||||
if (lastComparison != 0) {
|
||||
return lastComparison;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -10296,6 +10374,14 @@ public class RemoteInterpreterService {
|
|||
sb.append("cursor:");
|
||||
sb.append(this.cursor);
|
||||
first = false;
|
||||
if (!first) sb.append(", ");
|
||||
sb.append("interpreterContext:");
|
||||
if (this.interpreterContext == null) {
|
||||
sb.append("null");
|
||||
} else {
|
||||
sb.append(this.interpreterContext);
|
||||
}
|
||||
first = false;
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
@ -10303,6 +10389,9 @@ public class RemoteInterpreterService {
|
|||
public void validate() throws org.apache.thrift.TException {
|
||||
// check for required fields
|
||||
// check for sub-struct validity
|
||||
if (interpreterContext != null) {
|
||||
interpreterContext.validate();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
|
||||
|
|
@ -10373,6 +10462,15 @@ public class RemoteInterpreterService {
|
|||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
case 5: // INTERPRETER_CONTEXT
|
||||
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
|
||||
struct.interpreterContext = new RemoteInterpreterContext();
|
||||
struct.interpreterContext.read(iprot);
|
||||
struct.setInterpreterContextIsSet(true);
|
||||
} else {
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
|
||||
}
|
||||
|
|
@ -10406,6 +10504,11 @@ public class RemoteInterpreterService {
|
|||
oprot.writeFieldBegin(CURSOR_FIELD_DESC);
|
||||
oprot.writeI32(struct.cursor);
|
||||
oprot.writeFieldEnd();
|
||||
if (struct.interpreterContext != null) {
|
||||
oprot.writeFieldBegin(INTERPRETER_CONTEXT_FIELD_DESC);
|
||||
struct.interpreterContext.write(oprot);
|
||||
oprot.writeFieldEnd();
|
||||
}
|
||||
oprot.writeFieldStop();
|
||||
oprot.writeStructEnd();
|
||||
}
|
||||
|
|
@ -10436,7 +10539,10 @@ public class RemoteInterpreterService {
|
|||
if (struct.isSetCursor()) {
|
||||
optionals.set(3);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 4);
|
||||
if (struct.isSetInterpreterContext()) {
|
||||
optionals.set(4);
|
||||
}
|
||||
oprot.writeBitSet(optionals, 5);
|
||||
if (struct.isSetSessionKey()) {
|
||||
oprot.writeString(struct.sessionKey);
|
||||
}
|
||||
|
|
@ -10449,12 +10555,15 @@ public class RemoteInterpreterService {
|
|||
if (struct.isSetCursor()) {
|
||||
oprot.writeI32(struct.cursor);
|
||||
}
|
||||
if (struct.isSetInterpreterContext()) {
|
||||
struct.interpreterContext.write(oprot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(org.apache.thrift.protocol.TProtocol prot, completion_args struct) throws org.apache.thrift.TException {
|
||||
TTupleProtocol iprot = (TTupleProtocol) prot;
|
||||
BitSet incoming = iprot.readBitSet(4);
|
||||
BitSet incoming = iprot.readBitSet(5);
|
||||
if (incoming.get(0)) {
|
||||
struct.sessionKey = iprot.readString();
|
||||
struct.setSessionKeyIsSet(true);
|
||||
|
|
@ -10471,6 +10580,11 @@ public class RemoteInterpreterService {
|
|||
struct.cursor = iprot.readI32();
|
||||
struct.setCursorIsSet(true);
|
||||
}
|
||||
if (incoming.get(4)) {
|
||||
struct.interpreterContext = new RemoteInterpreterContext();
|
||||
struct.interpreterContext.read(iprot);
|
||||
struct.setInterpreterContextIsSet(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-22")
|
||||
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2017-3-27")
|
||||
public class ZeppelinServerResourceParagraphRunner implements org.apache.thrift.TBase<ZeppelinServerResourceParagraphRunner, ZeppelinServerResourceParagraphRunner._Fields>, java.io.Serializable, Cloneable, Comparable<ZeppelinServerResourceParagraphRunner> {
|
||||
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ZeppelinServerResourceParagraphRunner");
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ service RemoteInterpreterService {
|
|||
void cancel(1: string sessionKey, 2: string className, 3: RemoteInterpreterContext interpreterContext);
|
||||
i32 getProgress(1: string sessionKey, 2: string className, 3: RemoteInterpreterContext interpreterContext);
|
||||
string getFormType(1: string sessionKey, 2: string className);
|
||||
list<InterpreterCompletion> completion(1: string sessionKey, 2: string className, 3: string buf, 4: i32 cursor);
|
||||
list<InterpreterCompletion> completion(1: string sessionKey, 2: string className, 3: string buf, 4: i32 cursor, 5: RemoteInterpreterContext interpreterContext);
|
||||
void shutdown();
|
||||
|
||||
string getStatus(1: string sessionKey, 2:string jobId);
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ public class MockInterpreterA extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,8 @@ public class MockInterpreterAngular extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ public class MockInterpreterB extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ public class MockInterpreterEnv extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ public class MockInterpreterOutputStream extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ public class MockInterpreterResourcePool extends Interpreter {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ public class MockInterpreter1 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -299,7 +299,9 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
return null;
|
||||
}
|
||||
|
||||
List completion = repl.completion(body, cursor);
|
||||
InterpreterContext interpreterContext = getInterpreterContextWithoutRunner(null);
|
||||
|
||||
List completion = repl.completion(body, cursor, interpreterContext);
|
||||
return completion;
|
||||
}
|
||||
|
||||
|
|
@ -535,7 +537,9 @@ public class Paragraph extends Job implements Serializable, Cloneable {
|
|||
final Paragraph self = this;
|
||||
|
||||
Credentials credentials = note.getCredentials();
|
||||
if (authenticationInfo != null) {
|
||||
setAuthenticationInfo(new AuthenticationInfo(getUser()));
|
||||
|
||||
if (authenticationInfo.getUser() != null) {
|
||||
UserCredentials userCredentials =
|
||||
credentials.getUserCredentials(authenticationInfo.getUser());
|
||||
authenticationInfo.setUserCredentials(userCredentials);
|
||||
|
|
|
|||
|
|
@ -98,7 +98,8 @@ Map<String, Object> vars = new HashMap<>();
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,8 @@ public class MockInterpreter11 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,8 @@ public class MockInterpreter2 extends Interpreter{
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor) {
|
||||
public List<InterpreterCompletion> completion(String buf, int cursor,
|
||||
InterpreterContext interpreterContext) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue