How about changing getType and getData code to use contains and not startWith and trim the head before the magic word? My assumption that if the user used the magic word that is what he wants to see. Later we can add your suggestion for complex type. With the current state, I find it hard to use the tables UI when I manipulate data in spark and python
Eran On Tue, Jul 21, 2015 at 10:53 PM DuyHai Doan <[email protected]> wrote: > Yes you may create a JIRA "Improve magic display system" > > On Tue, Jul 21, 2015 at 9:46 PM, IT CTO <[email protected]> wrote: > > > Thanks for the detailed answer. As a work-around, can we suppress the sc > > output? > > BTW, should I open a jira bug for this? > > Eran > > > > בתאריך יום ג׳, 21 ביולי 2015, 21:53 מאת DuyHai Doan < > [email protected] > > >: > > > > > Ha, this is a very CLASSICAL caveat with Zeppelin display system. > > > > > > How is that ? Because to determine the type of the returned message > > > (InterpreterResult class), Zeppelin is using this piece of code: > > > > > > private Type getType(String msg) { > > > if (msg == null) { > > > return Type.TEXT; > > > } > > > Type[] types = Type.values(); > > > for (Type t : types) { > > > String magic = "%" + t.name().toLowerCase(); > > > if (msg.startsWith(magic + " ") || msg.startsWith(magic + "\n")) { > > > return t; > > > } > > > } > > > return Type.TEXT; > > > } > > > > > > > > > Obviously, the statement "val bankText = sc.parallelize(1 to 10)" is > > > interpreter by the Spark REPL and will generate the output > > > > > > "bankText: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[4] at" > > > > > > So the returned message does NOT start with %table but with the above > > text > > > so for Zeppelin, the Type is Type.TEXT. > > > > > > The caveat here is that Zeppelin code is using msg.startsWith(xxx) to > > check > > > for the %magic. > > > > > > We should definitely refactor the result message display system with: > > > > > > 1) parse the whole output String and every time the is a %magic mixed > > with > > > plain text, return a Type.COMPOSITE (new type to be added) > > > > > > 2) On the AngularJS side, we need to extract any %magic bloc, display > > them > > > properly and display the remaining text as plain text > > > > > > Again, I'll have a look into it when I have some bandwidth > > > > > > > > > > > > On Tue, Jul 21, 2015 at 7:14 PM, IT CTO <[email protected]> wrote: > > > > > > > Code is very simple > > > > /// Not working paragraph : > > > > %spark > > > > val bankText = sc.parallelize(1 to 10) > > > > println("%table col1\tcol2\naaa\t123\n") > > > > > > > > OUTPUT IS: > > > > > > > > bankText: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[4] at > > > > parallelize at <console>:23 %table col1 col2 aaa 123 > > > > > > > > > > > > > > > > /// working paragraph: > > > > println("%table col1\tcol2\naaa\t123\n") > > > > > > > > OUTPUT is the table display as expected with all buttons and options > > > > col1col2aaa123 > > > > Eran > > > > > > > > On Tue, Jul 21, 2015 at 8:09 PM madhuka udantha < > > > [email protected]> > > > > wrote: > > > > > > > > > Hi Eran, > > > > > > > > > > We can't see the images that you are sharing. I think it is not > > > possible > > > > to > > > > > attach them directly on ML. IMO you could try dropbox etc. > > > > > > > > > > Thanks. > > > > > > > > > > On Tue, Jul 21, 2015 at 7:52 PM, IT CTO <[email protected]> wrote: > > > > > > > > > > > Just install the latest build and tried the following: > > > > > > [image: Selection_001.png] > > > > > > > > > > > > this is not what I was expecting from the print. > > > > > > actually, if I remove the sc line it works well... > > > > > > [image: Selection_002.png] > > > > > > > > > > > > Any idea why this is happening? > > > > > > Eran > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Cheers, > > > > > Madhuka Udantha > > > > > http://madhukaudantha.blogspot.com > > > > > > > > > > > > > > >
