difin commented on code in PR #6421:
URL: https://github.com/apache/hive/pull/6421#discussion_r3070060599
##########
beeline/src/java/org/apache/hive/beeline/Commands.java:
##########
@@ -1183,6 +1183,141 @@ public boolean sh(String line) {
}
}
+ public boolean nlsql(String line) {
+ if (line == null || line.length() == 0) {
+ return false;
+ }
+
+ if (!line.startsWith("nlsql")) {
+ return false;
+ }
+
+ String nlQuery = line.substring("nlsql".length()).trim();
+ if (nlQuery.isEmpty()) {
+ return beeLine.error("Usage: !nlsql <natural language query>");
+ }
+
+ // Must be connected
+ if (beeLine.getDatabaseConnection() == null ||
beeLine.getDatabaseConnection().getUrl() == null) {
+ return beeLine.error("Not connected. Use !connect first.");
+ }
+
+ // Locate the Python script
+ String hiveHome = System.getenv("HIVE_HOME");
+ String scriptPath;
+ if (hiveHome != null) {
+ scriptPath = hiveHome + File.separator + "scripts" + File.separator +
+ "nlsql" + File.separator + "nlsql_agent.py";
+ } else {
+ scriptPath = "scripts" + File.separator + "nlsql" + File.separator +
+ "nlsql_agent.py";
Review Comment:
same
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]