[GitHub] [zeppelin] zjffdu commented on issue #3514: [ZEPPELIN-4436]. Interpreter PID file should contain interpreter group id

2019-11-09 Thread GitBox
zjffdu commented on issue #3514: [ZEPPELIN-4436]. Interpreter PID file should 
contain interpreter group id
URL: https://github.com/apache/zeppelin/pull/3514#issuecomment-552172089
 
 
   Thanks @alexott , will merge if no more comments


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] asfgit closed pull request #3499: [ZEPPELIN-4410] Added exception handling when converting old notebooks to newer format

2019-11-09 Thread GitBox
asfgit closed pull request #3499: [ZEPPELIN-4410] Added exception handling when 
converting old notebooks to newer format
URL: https://github.com/apache/zeppelin/pull/3499
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] zjffdu commented on issue #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via Apache Jena ARQ

2019-11-09 Thread GitBox
zjffdu commented on issue #3480: [ZEPPELIN-3644] SPARQL-Interpreter support via 
Apache Jena ARQ
URL: https://github.com/apache/zeppelin/pull/3480#issuecomment-552171907
 
 
   LGTM, will merge if no more comment


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] asfgit closed pull request #3500: [ZEPPELIN-4411] Added current notebook location and name to ui header

2019-11-09 Thread GitBox
asfgit closed pull request #3500: [ZEPPELIN-4411] Added current notebook 
location and name to ui header 
URL: https://github.com/apache/zeppelin/pull/3500
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] zjffdu commented on issue #3496: [ZEPPELIN-4407] Add the ability to copy/paste result table

2019-11-09 Thread GitBox
zjffdu commented on issue #3496: [ZEPPELIN-4407] Add the ability to copy/paste 
result table
URL: https://github.com/apache/zeppelin/pull/3496#issuecomment-552171234
 
 
   ping @amakaur 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Created] (ZEPPELIN-4441) Update interpreter overview page

2019-11-09 Thread Jeff Zhang (Jira)
Jeff Zhang created ZEPPELIN-4441:


 Summary: Update interpreter overview page
 Key: ZEPPELIN-4441
 URL: https://issues.apache.org/jira/browse/ZEPPELIN-4441
 Project: Zeppelin
  Issue Type: Sub-task
Reporter: Jeff Zhang






--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[GitHub] [zeppelin] ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin support for Spark interpreter

2019-11-09 Thread GitBox
ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin 
support for Spark interpreter
URL: https://github.com/apache/zeppelin/pull/3440#discussion_r344469311
 
 

 ##
 File path: 
kotlin/src/main/java/org/apache/zeppelin/kotlin/KotlinInterpreter.java
 ##
 @@ -0,0 +1,189 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.kotlin;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.File;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import org.apache.zeppelin.interpreter.Interpreter;
+import org.apache.zeppelin.interpreter.InterpreterContext;
+import org.apache.zeppelin.interpreter.InterpreterException;
+import org.apache.zeppelin.interpreter.InterpreterOutput;
+import org.apache.zeppelin.interpreter.InterpreterResult;
+import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion;
+import org.apache.zeppelin.interpreter.util.InterpreterOutputStream;
+import org.apache.zeppelin.kotlin.completion.KotlinCompleter;
+import org.apache.zeppelin.kotlin.context.KotlinReceiver;
+import org.apache.zeppelin.kotlin.reflect.KotlinFunctionInfo;
+import org.apache.zeppelin.kotlin.reflect.KotlinVariableInfo;
+import org.apache.zeppelin.kotlin.repl.KotlinRepl;
+import org.apache.zeppelin.kotlin.repl.building.KotlinReplProperties;
+import org.apache.zeppelin.scheduler.Job;
+
+public class KotlinInterpreter extends Interpreter {
+
+  private static Logger logger = 
LoggerFactory.getLogger(KotlinInterpreter.class);
+
+  private InterpreterOutputStream out;
+  private KotlinRepl interpreter;
+  private KotlinReplProperties replProperties;
+  private KotlinCompleter completer;
+
+  public KotlinInterpreter(Properties properties) {
+super(properties);
+replProperties = new KotlinReplProperties();
+
+int maxResult = Integer.parseInt(
+properties.getProperty("zeppelin.kotlin.maxResult", "1000"));
+
+boolean shortenTypes = Boolean.parseBoolean(
+properties.getProperty("zeppelin.kotlin.shortenTypes", "true"));
+String imports = properties.getProperty("zeppelin.interpreter.localRepo", 
"");
+
+completer = new KotlinCompleter();
+replProperties
+.receiver(new KotlinReceiver())
+.maxResult(maxResult)
+.codeOnLoad("")
+.classPath(getImportClasspath(imports))
+.shortenTypes(shortenTypes);
+  }
+
+  public KotlinReplProperties getKotlinReplProperties() {
+return replProperties;
+  }
+
+  @Override
+  public void open() throws InterpreterException {
+interpreter = new KotlinRepl(replProperties);
+
+completer.setCtx(interpreter.getKotlinContext());
+out = new InterpreterOutputStream(logger);
+  }
+
+  @Override
+  public void close() {
+
+  }
+
+  @Override
+  public InterpreterResult interpret(String code,
+ InterpreterContext context) throws 
InterpreterException{
+// saving job's running thread for cancelling
+Job runningJob = getRunningJob(context.getParagraphId());
+if (runningJob != null) {
+  runningJob.info().put("CURRENT_THREAD", Thread.currentThread());
+}
+
+return runWithOutput(code, context.out);
+  }
+
+  @Override
+  public void cancel(InterpreterContext context) throws InterpreterException {
+Job runningJob = getRunningJob(context.getParagraphId());
+if (runningJob != null) {
+  Map info = runningJob.info();
+  Object object = info.get("CURRENT_THREAD");
+  if (object instanceof Thread) {
+try {
+  Thread t = (Thread) object;
+  t.interrupt();
+} catch (Throwable t) {
+  logger.error("Failed to cancel script: " + t, t);
+}
+  }
+}
+  }
+
+  @Override
+  public FormType getFormType() throws InterpreterException {
+return FormType.NATIVE;
+  }
+
+  @Override
+  public int getProgress(InterpreterContext context) throws 
InterpreterException {
+return 0;
+  }
+
+  @Override
+  public List completion(String buf, int cursor,
+  InterpreterContext interpreterContext) throws InterpreterException {
+return 

[GitHub] [zeppelin] ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin support for Spark interpreter

2019-11-09 Thread GitBox
ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin 
support for Spark interpreter
URL: https://github.com/apache/zeppelin/pull/3440#discussion_r344469220
 
 

 ##
 File path: 
kotlin/src/main/java/org/apache/zeppelin/kotlin/reflect/ContextUpdater.java
 ##
 @@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.kotlin.reflect;
+
+import org.jetbrains.kotlin.cli.common.repl.AggregatedReplStageState;
+import org.jetbrains.kotlin.cli.common.repl.ReplHistoryRecord;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import kotlin.Pair;
+import kotlin.reflect.KFunction;
+import kotlin.reflect.KProperty;
+import kotlin.reflect.jvm.ReflectJvmMapping;
+
+/**
+ * ContextUpdater updates current user-defined functions and variables
+ * to use in completion and KotlinContext.
+ */
+public class ContextUpdater {
+  private final Logger logger = LoggerFactory.getLogger(ContextUpdater.class);
+  private final Set objectMethods =
+  new HashSet<>(Arrays.asList(Object.class.getMethods()));
+  
+  private AggregatedReplStageState state;
+  private Map vars;
+  private Set functions;
+
+  public ContextUpdater(AggregatedReplStageState state,
+Map vars, 
+Set functions) {
+this.state = state;
+this.vars = vars;
+this.functions = functions;
+  }
+
+  public void update() {
+try {
+  List lines = getLines();
+  refreshVariables(lines);
+  refreshMethods(lines);
+} catch (ReflectiveOperationException | NullPointerException e) {
+  logger.error("Exception updating current variables", e);
+}
+  }
+
+  private void refreshMethods(List lines) {
+functions.clear();
+for (Object line : lines) {
+  Method[] methods = line.getClass().getMethods();
+  for (Method method : methods) {
+if (objectMethods.contains(method) || method.getName().equals("main")) 
{
 
 Review comment:
   We've decided to add a comment to clarify the nature of lines


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin support for Spark interpreter

2019-11-09 Thread GitBox
ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin 
support for Spark interpreter
URL: https://github.com/apache/zeppelin/pull/3440#discussion_r344468835
 
 

 ##
 File path: 
kotlin/src/main/java/org/apache/zeppelin/kotlin/reflect/ContextUpdater.java
 ##
 @@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.kotlin.reflect;
+
+import org.jetbrains.kotlin.cli.common.repl.AggregatedReplStageState;
+import org.jetbrains.kotlin.cli.common.repl.ReplHistoryRecord;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+import kotlin.Pair;
+import kotlin.reflect.KFunction;
+import kotlin.reflect.KProperty;
+import kotlin.reflect.jvm.ReflectJvmMapping;
+
+/**
+ * ContextUpdater updates current user-defined functions and variables
+ * to use in completion and KotlinContext.
+ */
+public class ContextUpdater {
+  private final Logger logger = LoggerFactory.getLogger(ContextUpdater.class);
+  private final Set objectMethods =
+  new HashSet<>(Arrays.asList(Object.class.getMethods()));
+  
+  private AggregatedReplStageState state;
+  private Map vars;
+  private Set functions;
+
+  public ContextUpdater(AggregatedReplStageState state,
+Map vars, 
+Set functions) {
+this.state = state;
+this.vars = vars;
+this.functions = functions;
+  }
+
+  public void update() {
+try {
+  List lines = getLines();
+  refreshVariables(lines);
+  refreshMethods(lines);
+} catch (ReflectiveOperationException | NullPointerException e) {
+  logger.error("Exception updating current variables", e);
+}
+  }
+
+  private void refreshMethods(List lines) {
+functions.clear();
+for (Object line : lines) {
+  Method[] methods = line.getClass().getMethods();
+  for (Method method : methods) {
+if (objectMethods.contains(method) || method.getName().equals("main")) 
{
 
 Review comment:
   Ok, do you mean that `line` is an instance of `KotlinReceiver` (or its 
subclass) here?
   If yes, let's make an explicit type cast (maybe above in the code).
   If no, please clarify what's the nature of this variable and how may it be 
instantiated.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [zeppelin] ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin support for Spark interpreter

2019-11-09 Thread GitBox
ileasile commented on a change in pull request #3440: [ZEPPELIN-4323] Kotlin 
support for Spark interpreter
URL: https://github.com/apache/zeppelin/pull/3440#discussion_r344463578
 
 

 ##
 File path: 
kotlin/src/main/java/org/apache/zeppelin/kotlin/reflect/KotlinReflectUtil.java
 ##
 @@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.zeppelin.kotlin.reflect;
+
+import kotlin.reflect.KFunction;
+
+/**
+ * Util class for pretty-printing Kotlin variables and functions.
+ */
+public class KotlinReflectUtil {
+  public static String functionSignature(KFunction function) {
+return function.toString().replaceAll("Line_\\d+\\.", "");
 
 Review comment:
   Ah, ok. I haven't noticed the dot in regex.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services