drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] arina-ielchiieva commented on a change in pull request #1462: DRILL-3853: Upgrade to SqlLine 1.5.0
Date Tue, 11 Sep 2018 17:28:09 GMT
arina-ielchiieva commented on a change in pull request #1462: DRILL-3853: Upgrade to SqlLine
1.5.0
URL: https://github.com/apache/drill/pull/1462#discussion_r216753360
 
 

 ##########
 File path: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillSqlLineApplication.java
 ##########
 @@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.drill.exec.client;
+
+import jline.console.completer.StringsCompleter;
+import org.apache.drill.common.util.DrillVersionInfo;
+import sqlline.Application;
+import sqlline.CommandHandler;
+import sqlline.OutputFormat;
+import sqlline.ReflectiveCommandHandler;
+import sqlline.SqlLine;
+import sqlline.SqlLineOpts;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.stream.Collectors;
+
+public class DrillSqlLineApplication extends Application {
+
+  private static final String INFO_MESSAGE_TEMPLATE = "apache drill %s\n%s";
+
+  private static final List<String> QUOTES = Arrays.asList(
+      "start your sql engine",
+      "this isn't your grandfather's sql",
+      "a little sql for your nosql",
+      "json ain't no thang",
+      "drill baby drill",
+      "just drill it",
+      "say hello to my little drill",
+      "what ever the mind of man can conceive and believe, drill can query",
+      "the only truly happy people are children, the creative minority and drill users",
+      "a drill is a terrible thing to waste",
+      "got drill?",
+      "a drill in the hand is better than two in the bush"
+  );
+
+  private static final List<String> COMMANDS_TO_EXCLUDE = Arrays.asList(
+      "describe", "indexes", "primarykeys", "exportedkeys", "manual",
+      "importedkeys", "procedures", "typeinfo", "dropall", "metadata",
+      "nativesql", "dbinfo", "rehash", "batch", "all", "go", "isolation",
+      "autocommit", "commit", "rollback", "scan", "sql", "call",
+      //exclude connect command and then add it back to ensure connection url examples are
updated
+      "connect"
+  );
+
+  @Override
+  public String getInfoMessage() {
+    return String.format(INFO_MESSAGE_TEMPLATE,
+      DrillVersionInfo.getVersion(),
+      QUOTES.get(new Random().nextInt(QUOTES.size())));
+  }
+
+  @Override
+  public Collection<String> initDrivers() {
+    return Collections.singletonList("org.apache.drill.jdbc.Driver");
+  }
+
+  @Override
+  public Map<String, OutputFormat> getOutputFormats(SqlLine sqlLine) {
+    return sqlLine.getOutputFormats();
+  }
+
+  @Override
+  public Collection<String> getConnectionUrlExamples() {
+    return Arrays.asList("jdbc:drill:", "jdbc:drill:zk=local");
 
 Review comment:
   Done.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message