-
Notifications
You must be signed in to change notification settings - Fork 3
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
sqlflow integrate with zeppelin (SQLFlowInterpreter.java) #11
Conversation
SQLFlowInterpreter.java
Outdated
private Map<String, String> parameters = new HashMap<String, String>(); | ||
|
||
public static final String SQLFLOW_SERVERADDR = "sqlflow.serverAddr"; | ||
public static final String MYSQL_USERNAME = "mysql.username"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only support mysql databases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't just support mysql database. For other SQL engines, including Oracle, Hive, SparkSQL, Flink, etc., developers can expand and improve according to actual needs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we still use mysql.username
to specific the hive username ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initial version has not yet opened the connection to the hive database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This initial version has not yet opened the connection to the hive database.
Let's do this under the new issue.
SQLFlowInterpreter.java
Outdated
// Create user | ||
SQLFlow client = EnvironmentSpecificSQLFlowClient.getClient( | ||
new MessageHandlerZeppelin(context), parameters); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless blank.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless blank removed.
SQLFlowInterpreter.java
Outdated
@Override | ||
public InterpreterResult interpret(String query, InterpreterContext context) | ||
throws InterpreterException { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless blank removed.
SQLFlowInterpreter.java
Outdated
return new InterpreterResult(InterpreterResult.Code.ERROR); | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless blank removed.
useless blank removed.
fix #3
This file is to let sqlflow inherit the interpreter interface provided by Zeppelin, so as to connect the two and realize the abstract class of Zeppelin. In this file, you can read the configuration file parameters, construct the sqlflow client, start and close the interpreter, and so on.
Create a new class named
org.Apache.Zeppelin.Sqlflow
and let it inherit fromorg.Apache.Zeppelin.Interpreter.Interpreter
. Since an abstract class is inherited, constructors and overridden methods are required, with 6 methods:Among these methods, the most critical one is
public InterpreterResult interpret(String query, InterpreterContext interpreterContext)
; It is a bridge between sqlflow and Zeppelin. The collection, creation and release of user information will be realized through this method.Examples are as follows:
The specific code can refer to
SQLFlowInterpreter.java