[
https://issues.apache.org/jira/browse/DRILL-7603?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17045718#comment-17045718
]
ASF GitHub Bot commented on DRILL-7603:
---------------------------------------
dobesv commented on pull request #1996: DRILL-7603: Allow default schema to be
set for HTTP queries
URL: https://github.com/apache/drill/pull/1996#discussion_r384639275
##########
File path:
exec/java-exec/src/test/java/org/apache/drill/exec/server/rest/TestQueryWrapper.java
##########
@@ -0,0 +1,103 @@
+/*
+ * 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.server.rest;
+
+import io.netty.channel.DefaultChannelPromise;
+import io.netty.channel.local.LocalAddress;
+import org.apache.drill.exec.ExecConstants;
+import org.apache.drill.exec.proto.UserBitShared;
+import org.apache.drill.exec.rpc.user.UserSession;
+import org.apache.drill.exec.server.Drillbit;
+import org.apache.drill.exec.server.options.SystemOptionManager;
+import org.apache.drill.exec.server.rest.auth.DrillUserPrincipal;
+import org.apache.drill.exec.work.WorkManager;
+import org.apache.drill.test.ClusterFixture;
+import org.apache.drill.test.ClusterTest;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+public class TestQueryWrapper extends ClusterTest {
+
+ private static DrillRestServer server;
+ private static WorkManager workManager;
+ private static WebServer webServer;
+
+ private void setupServer() throws IOException {
+ boolean impersonationEnabled = false;
+ setupServer(impersonationEnabled);
+ }
+
+ private void setupServer(boolean impersonationEnabled) {
+ cluster = ClusterFixture.bareBuilder(dirTestWatcher)
+ .clusterSize(1)
+ .configProperty(ExecConstants.ALLOW_LOOPBACK_ADDRESS_BINDING, true)
+ .configProperty(ExecConstants.IMPERSONATION_ENABLED,
impersonationEnabled)
+ .build();
+ Drillbit drillbit = cluster.drillbit();
+ workManager = drillbit.getManager();
+ webServer = drillbit.getWebServer();
+ final ServletContextHandler servletContextHandler = new
ServletContextHandler(ServletContextHandler.SESSIONS);
+ servletContextHandler.setContextPath("/");
+ server = new DrillRestServer(workManager,
servletContextHandler.getServletContext(), drillbit);
+ }
+
+ private QueryWrapper.QueryResult run(String sql) throws Exception {
+ return runWithDefaultSchema(sql, null);
+ }
+
+ private QueryWrapper.QueryResult runWithDefaultSchema(String sql, String
defaultSchema) throws Exception {
+ if (cluster == null) {
Review comment:
Some of the tests use different options. Although maybe not in this
particular PR.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Cannot set default schema using REST API / Web UI
> -------------------------------------------------
>
> Key: DRILL-7603
> URL: https://issues.apache.org/jira/browse/DRILL-7603
> Project: Apache Drill
> Issue Type: Improvement
> Components: Web Server
> Reporter: Dobes Vandermeer
> Assignee: Dobes Vandermeer
> Priority: Minor
>
> Currently, to set the default schema you must run the `USE <schema>` command.
> However, the Web UI and REST API do not keep a session open so the `USE`
> command does not affect the next query sent to the API.
> To support a default schema for REST API & Web UI I propose a parameter to
> the API "defaultSchema" which sets the default schema for that query.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)