Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlLine integration #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

snuyanzin
Copy link

@snuyanzin snuyanzin commented Jun 14, 2019

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
Copy link
Author

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
Copy link
Owner

vlsi commented Oct 12, 2020

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

import java.util.Set;

public class MCPApplication extends Application {
private static final Set<String> ALLOWED_SQLLINE_COMMANDS = new HashSet<String>() {{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@snuyanzin , I might be late here :) Do you remember by chance why do you limit the set of commands?

Copy link
Author

@snuyanzin snuyanzin Oct 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember there are database specific commands e.g. !isolation, !drop and etc.
The idea was to limit to set of commands which makes sense for mat-calcite-plugin.

Agree that the list of commands itself is the subject for discussion.

@snuyanzin
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants