<commit_before>#+TITLE: Apache Zeppelin

#+TITLE: Apache Zeppelin

* Table of Contents :TOC_2_gh:
 - [[#how-to][How-to]]
   - [[#install-interpreters][Install Interpreters]]
 - [[#reference][Reference]]
   - [[#zeppelin-envsh][zeppelin-env.sh]]
   - [[#dynamic-form][Dynamic Form]]
 - [[#topics][Topics]]
   - [[#interpreter-mode][Interpreter mode]]
 - [[#staging][Staging]]

* How-to
** Install Interpreters
- https://zeppelin.apache.org/docs/0.7.1/manual/interpreterinstallation.html

#+BEGIN_SRC shell
  ./bin/install-interpreter.sh --all
  ./bin/install-interpreter.sh --name md,shell,jdbc,python
  ./bin/install-interpreter.sh --list
#+END_SRC

* Reference
** zeppelin-env.sh
- https://github.com/apache/zeppelin/blob/master/conf/zeppelin-env.sh.template

#+BEGIN_SRC shell
  # Double the memory for zeppelin itself
  # '-XX:MaxPermSize=512m' is omitted because it's deprecated in Java8
  export ZEPPELIN_MEM='-Xms2048m -Xmx2048m'
#+END_SRC

** Dynamic Form
- https://zeppelin.apache.org/docs/0.7.1/manual/dynamicform.html
- [[https://github.com/apache/zeppelin/blob/master/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java][GitHub Code Reference]]

*** Text input form
#+BEGIN_EXAMPLE
  ${formName}
  ${formName=defaultValue}
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${name}
  ${name=Yeongho}
#+END_EXAMPLE

#+BEGIN_SRC scala
  println("Hello "+z.input("name"))
  println("Hello "+z.input("name", "sun"))
#+END_SRC

*** Select form
#+BEGIN_EXAMPLE
  ${formName=defaultValue,option1|option2...}
  ${formName=defaultValue,option1(DisplayName)|option2(DisplayName)...}
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${fruit=apple,apple|banana|orange}
  ${fruit=apple,1(apple)|2(banana)|3(orange)}
#+END_EXAMPLE

#+BEGIN_SRC scala
  println("Hello "+z.select("day", Seq(("1","mon"),
                                       ("2","tue"),
                                       ("3","wed"),
                                       ("4","thurs"),
                                       ("5","fri"),
                                       ("6","sat"),
                                       ("7","sun"))))
#+END_SRC

*** Checkbox form
#+BEGIN_EXAMPLE
  ${checkbox:formName=defaultValue1|defaultValue2...,option1|option2...}
  ${checkbox(delimiter):formName=...}:
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${checkbox:fruit=apple|banana,apple|banana|orange}
  > apple,banana 
  ${checkbox( and ):fruit=apple|banana,apple|banana|orange}
  > apple and banana 
  ${checkbox( and ):fruit=apple(사과),apple|banana|orange}  # Label can also be placed
  > apple and banana 
#+END_EXAMPLE

#+BEGIN_SRC scala
  val options = Seq(("apple","Apple"), ("banana","Banana"), ("orange","Orange"))
  println("Hello "+z.checkbox("fruit", options).mkString(" and "))
#+END_SRC

* Topics
** Interpreter mode
- https://medium.com/@leemoonsoo/apache-zeppelin-interpreter-mode-explained-bae0525d0555

[[file:img/screenshot_2017-07-24_19-04-03.png]]

[[file:img/screenshot_2017-07-24_19-04-15.png]]

[[file:img/screenshot_2017-07-24_19-04-38.png]]

* Staging
<commit_msg>Update zeppelin interpreter mode images<commit_after>#+TITLE: Apache Zeppelin

#+TITLE: Apache Zeppelin

* Table of Contents :TOC_2_gh:
 - [[#how-to][How-to]]
   - [[#install-interpreters][Install Interpreters]]
 - [[#reference][Reference]]
   - [[#zeppelin-envsh][zeppelin-env.sh]]
   - [[#dynamic-form][Dynamic Form]]
 - [[#topics][Topics]]
   - [[#interpreter-mode][Interpreter mode]]
 - [[#staging][Staging]]

* How-to
** Install Interpreters
- https://zeppelin.apache.org/docs/0.7.1/manual/interpreterinstallation.html

#+BEGIN_SRC shell
  ./bin/install-interpreter.sh --all
  ./bin/install-interpreter.sh --name md,shell,jdbc,python
  ./bin/install-interpreter.sh --list
#+END_SRC

* Reference
** zeppelin-env.sh
- https://github.com/apache/zeppelin/blob/master/conf/zeppelin-env.sh.template

#+BEGIN_SRC shell
  # Double the memory for zeppelin itself
  # '-XX:MaxPermSize=512m' is omitted because it's deprecated in Java8
  export ZEPPELIN_MEM='-Xms2048m -Xmx2048m'
#+END_SRC

** Dynamic Form
- https://zeppelin.apache.org/docs/0.7.1/manual/dynamicform.html
- [[https://github.com/apache/zeppelin/blob/master/spark/src/main/java/org/apache/zeppelin/spark/ZeppelinContext.java][GitHub Code Reference]]

*** Text input form
#+BEGIN_EXAMPLE
  ${formName}
  ${formName=defaultValue}
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${name}
  ${name=Yeongho}
#+END_EXAMPLE

#+BEGIN_SRC scala
  println("Hello "+z.input("name"))
  println("Hello "+z.input("name", "sun"))
#+END_SRC

*** Select form
#+BEGIN_EXAMPLE
  ${formName=defaultValue,option1|option2...}
  ${formName=defaultValue,option1(DisplayName)|option2(DisplayName)...}
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${fruit=apple,apple|banana|orange}
  ${fruit=apple,1(apple)|2(banana)|3(orange)}
#+END_EXAMPLE

#+BEGIN_SRC scala
  println("Hello "+z.select("day", Seq(("1","mon"),
                                       ("2","tue"),
                                       ("3","wed"),
                                       ("4","thurs"),
                                       ("5","fri"),
                                       ("6","sat"),
                                       ("7","sun"))))
#+END_SRC

*** Checkbox form
#+BEGIN_EXAMPLE
  ${checkbox:formName=defaultValue1|defaultValue2...,option1|option2...}
  ${checkbox(delimiter):formName=...}:
#+END_EXAMPLE

#+BEGIN_EXAMPLE
  ${checkbox:fruit=apple|banana,apple|banana|orange}
  > apple,banana 
  ${checkbox( and ):fruit=apple|banana,apple|banana|orange}
  > apple and banana 
  ${checkbox( and ):fruit=apple(사과),apple|banana|orange}  # Label can also be placed
  > apple and banana 
#+END_EXAMPLE

#+BEGIN_SRC scala
  val options = Seq(("apple","Apple"), ("banana","Banana"), ("orange","Orange"))
  println("Hello "+z.checkbox("fruit", options).mkString(" and "))
#+END_SRC

* Topics
** Interpreter mode
- https://medium.com/@leemoonsoo/apache-zeppelin-interpreter-mode-explained-bae0525d0555

[[file:img/screenshot_2017-07-24_19-04-03.png]]

[[file:img/screenshot_2017-08-04_21-26-42.png]]

[[file:img/screenshot_2017-08-04_21-26-52.png]]

* Staging

{'fraction_non_alphanumeric': 0.18142904181758315, 'fraction_numerical': 0.0286466908133026, 'mean_word_length': 3.5779954785229844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3906747', 'n_tokens_mistral': 2374, 'n_tokens_neox': 2188, 'n_words': 308}