Github user sanjaydasgupta commented on the issue:

    https://github.com/apache/zeppelin/pull/2502
  
    Allow me to take your suggestions from last to first @felixcheung 
    
    I have tested a variant of the function 
[interpolateVariable(...)](https://github.com/apache/zeppelin/pull/2502/files/906b698187bf5d4f358cb1263bdb15bfb0b286f4#diff-851965d16af3e64741e7375e5bf9b6c5R92)
 to return a `scala.Tuple2[Bool, String]` (with the Bool indicating 
success/failure, and the String containing either the interpolated command or 
the error message). The resulting code is elegant and intuitive, but could be a 
stumbling block for those not familiar with Scala. Please let me know if it is 
ok to add a bit of Scala in this way.
    
    After thinking hard about the implications (to other interpreters) of 
assumptions we make now about the legal forms of the use of '{' and '}', I 
tried to seek inspiration from Jupyter's implementation of a similar feature 
(when spawning a shell command using !). The following clear cases exist:
    
    1) any `{varname}` (formed with exactly one '{' and '}') is interpolated 
into the command -- only if `varname` is defined. If `varname` is not defined, 
no error is reported, and the pattern is left as is -- to be handled by the 
spawned shell command.
    
    2) any `{{something}}` (formed with exactly two '{' and '}' characters) is 
interpolated as `{something}`. There is no change in this behavior even when 
`something` has a defined value.
    
    3) All other occurrences of '{' and '}' (singly or in groups) are treated 
as ordinary characters, and passed through unchanged to the underlying shell 
command.
    
    Considering all the different usages of '{' and '}' that there might be in 
many different interpreters (to which we extend this feature progressively), it 
may be reasonable to follow something like the above convention from Jupyter. 
    
    Please let me know your views on these. Thanks for your time and help with 
this.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to