[ https://issues.apache.org/jira/browse/DRILL-3640?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16061706#comment-16061706 ]
ASF GitHub Bot commented on DRILL-3640: --------------------------------------- Github user laurentgo commented on a diff in the pull request: https://github.com/apache/drill/pull/858#discussion_r123866213 --- Diff: exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/TimeoutTrigger.java --- @@ -0,0 +1,105 @@ +/** + * 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.jdbc.impl; + +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import org.apache.calcite.avatica.AvaticaStatement; +import org.apache.drill.exec.rpc.NamedThreadFactory; +import org.apache.drill.jdbc.SqlTimeoutException; + +/** + * Timeout Trigger required for canceling of running queries + */ +class TimeoutTrigger implements Callable<Boolean> { + //Not using the DrillbitContext's ExecutorService as this is threadPool is light-weight (threads wake up to cancel tasks) but needs a low response time --- End diff -- this is still one extra thread per statement overhead. Threads are reused, but if lots of queries are run concurrently, that may be a lot. > Drill JDBC driver support Statement.setQueryTimeout(int) > -------------------------------------------------------- > > Key: DRILL-3640 > URL: https://issues.apache.org/jira/browse/DRILL-3640 > Project: Apache Drill > Issue Type: New Feature > Components: Client - JDBC > Affects Versions: 1.2.0 > Reporter: Chun Chang > Assignee: Kunal Khatua > Fix For: 1.11.0 > > > It would be nice if we have this implemented. Run away queries can be > automatically canceled by setting the timeout. > java.sql.SQLFeatureNotSupportedException: Setting network timeout is not > supported. > at > org.apache.drill.jdbc.impl.DrillStatementImpl.setQueryTimeout(DrillStatementImpl.java:152) -- This message was sent by Atlassian JIRA (v6.4.14#64029)