This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 0431757  [ZEPPELIN-4556]. Can't use hive variable substitution due to 
dynamic forms
0431757 is described below

commit 0431757d97d706b3f5a29764511f70b513dc6ed0
Author: Jeff Zhang <zjf...@apache.org>
AuthorDate: Thu Jan 16 10:18:19 2020 +0800

    [ZEPPELIN-4556]. Can't use hive variable substitution due to dynamic forms
    
    ### What is this PR for?
    
    This PR allow user to override the form type via paragraph local 
properties. e.g.
    
    ```
    %jdbc(form=native)
    
    ...
    ```
    
    ### What type of PR is it?
    [ Feature ]
    
    ### Todos
    * [ ] - Task
    
    ### What is the Jira issue?
    * https://issues.apache.org/jira/browse/ZEPPELIN-4556
    
    ### How should this be tested?
    * Verify it manually.
    
    ### Screenshots (if appropriate)
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? No
    
    Author: Jeff Zhang <zjf...@apache.org>
    
    Closes #3597 from zjffdu/ZEPPELIN-4556 and squashes the following commits:
    
    e2143908d [Jeff Zhang] [ZEPPELIN-4556]. Can't use hive variable 
substitution due to dynamic forms
---
 .../src/main/java/org/apache/zeppelin/notebook/Paragraph.java         | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
index e97ea3c..482455c 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/notebook/Paragraph.java
@@ -470,8 +470,8 @@ public class Paragraph extends 
JobWithProgressPoller<InterpreterResult> implemen
 
       // inject form
       String script = this.scriptText;
-      if ("simple".equalsIgnoreCase(localProperties.get("form")) ||
-              interpreter.getFormType() == FormType.SIMPLE) {
+      String form = localProperties.getOrDefault("form", 
interpreter.getFormType().name());
+      if (form.equalsIgnoreCase("simple")) {
         // inputs will be built from script body
         LinkedHashMap<String, Input> inputs = 
Input.extractSimpleQueryForm(script, false);
         LinkedHashMap<String, Input> noteInputs = 
Input.extractSimpleQueryForm(script, true);

Reply via email to