vlsi / mat-calcite-plugin

Heap query plugin for Eclipse Memory Analyzer
Apache License 2.0
148 stars 24 forks source link

SqlLine integration #17

Open snuyanzin opened 5 years ago

snuyanzin commented 5 years ago

The PR suggests initial integration with SqlLine mentioned at #9. Some sqlline commands are hidden, especially for mat-calcite-plugin there is added !open_dump Short demo how it currently looks like https://asciinema.org/a/251789, https://asciinema.org/a/251617

Startup: ./MemoryAnalyzer -application MatCalcitePlugin.execute sqlline

snuyanzin commented 5 years ago

The issue which I currently faced is that it looks like jna/jansi could not handle ctrl-c correctly in eclipse env... It leads to endless loop. Right now I do not see any way to cope with it without changes in third party (at least sqlline)

vlsi commented 3 years ago

I tried with MAT 1.10.0 + Sqlline 1.9.0 + macOS, and it seems to work (including ctrl+c)

snuyanzin commented 3 years ago

I tried with MAT 1.10.0 + Sqlline 1.9.0 + macOS, and it seems to work (including ctrl+c)

just checked: for me it is still reproducing. It seems Linux specific. Based on trace jline3 uses System specific pty (in my case LinuxNativePty). I suppose that could be a reason why on macOS it could work

com.sun.jna.LastErrorException: [5] Input/output error
    at com.sun.jna.Native.invokeVoid(Native Method)
    at com.sun.jna.Function.invoke(Function.java:415)
    at com.sun.jna.Function.invoke(Function.java:361)
    at com.sun.jna.Library$Handler.invoke(Library.java:265)
    at com.sun.proxy.$Proxy4.tcsetattr(Unknown Source)
    at org.jline.terminal.impl.jna.linux.LinuxNativePty.doSetAttr(LinuxNativePty.java:89)
    at org.jline.terminal.impl.AbstractPty.setAttr(AbstractPty.java:29)
    at org.jline.terminal.impl.AbstractPosixTerminal.setAttributes(AbstractPosixTerminal.java:52)
    at org.jline.terminal.impl.AbstractTerminal.enterRawMode(AbstractTerminal.java:138)
    at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:605)
    at org.jline.reader.impl.LineReaderImpl.readLine(LineReaderImpl.java:498)
    at sqlline.SqlLine.begin(SqlLine.java:545)
    at com.github.vlsi.mat.calcite.Executor.start(Executor.java:48)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1498)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1471)