drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkorukanti <...@git.apache.org>
Subject [GitHub] drill pull request #530: DRILL-4729: Add support for prepared statement impl...
Date Mon, 08 Aug 2016 05:03:47 GMT
Github user vkorukanti commented on a diff in the pull request:

    https://github.com/apache/drill/pull/530#discussion_r73822639
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/prepare/PreparedStatementProvider.java
---
    @@ -0,0 +1,419 @@
    +/**
    + * 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
    + * <p/>
    + * http://www.apache.org/licenses/LICENSE-2.0
    + * <p/>
    + * 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.work.prepare;
    +
    +import org.apache.drill.common.exceptions.ErrorHelper;
    +import org.apache.drill.common.types.TypeProtos.DataMode;
    +import org.apache.drill.common.types.TypeProtos.MajorType;
    +import org.apache.drill.common.types.TypeProtos.MinorType;
    +import org.apache.drill.common.types.Types;
    +import org.apache.drill.exec.physical.impl.materialize.QueryWritableBatch;
    +import org.apache.drill.exec.proto.ExecProtos.ServerPreparedStatementState;
    +import org.apache.drill.exec.proto.GeneralRPCProtos.Ack;
    +import org.apache.drill.exec.proto.UserBitShared.DrillPBError;
    +import org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType;
    +import org.apache.drill.exec.proto.UserBitShared.QueryId;
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult;
    +import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
    +import org.apache.drill.exec.proto.UserBitShared.QueryType;
    +import org.apache.drill.exec.proto.UserBitShared.SerializedField;
    +import org.apache.drill.exec.proto.UserProtos.ColumnSearchability;
    +import org.apache.drill.exec.proto.UserProtos.ColumnUpdatability;
    +import org.apache.drill.exec.proto.UserProtos.CreatePreparedStatementReq;
    +import org.apache.drill.exec.proto.UserProtos.CreatePreparedStatementResp;
    +import org.apache.drill.exec.proto.UserProtos.PreparedStatement;
    +import org.apache.drill.exec.proto.UserProtos.PreparedStatementHandle;
    +import org.apache.drill.exec.proto.UserProtos.RequestStatus;
    +import org.apache.drill.exec.proto.UserProtos.ResultColumnMetadata;
    +import org.apache.drill.exec.proto.UserProtos.RpcType;
    +import org.apache.drill.exec.proto.UserProtos.RunQuery;
    +import org.apache.drill.exec.rpc.Acks;
    +import org.apache.drill.exec.rpc.Response;
    +import org.apache.drill.exec.rpc.ResponseSender;
    +import org.apache.drill.exec.rpc.RpcOutcomeListener;
    +import org.apache.drill.exec.rpc.user.UserServer.UserClientConnection;
    +import org.apache.drill.exec.rpc.user.UserSession;
    +import org.apache.drill.exec.store.ischema.InfoSchemaConstants;
    +import org.apache.drill.exec.work.user.UserWorker;
    +import org.joda.time.Period;
    +
    +import com.google.common.collect.ImmutableMap;
    +
    +import io.netty.buffer.ByteBuf;
    +import io.netty.channel.ChannelFuture;
    +import java.math.BigDecimal;
    +import java.net.SocketAddress;
    +import java.sql.Date;
    +import java.sql.ResultSetMetaData;
    +import java.sql.Time;
    +import java.sql.Timestamp;
    +import java.util.List;
    +import java.util.Map;
    +import java.util.UUID;
    +import java.util.concurrent.CountDownLatch;
    +import java.util.concurrent.TimeUnit;
    +
    +/**
    + * Contains worker {@link Runnable} for creating a prepared statement and helper methods.
    + */
    +public class PreparedStatementProvider {
    +  private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PreparedStatementProvider.class);
    +
    +  private static final int LIMIT_0_QUERY_TIMEOUT_MINS = 10;
    --- End diff --
    
    10mins is already a large number for `LIMIT 0` query timeout. I don't mind adding another
option, but we already have too many options. It is possible the query could timeout for scheduling
reasons, in which case we can send the status request as `TIMEOUT` (currently we have `SUCCESS`,
`FAILURE`). Also we may not even need a limit 0 query in future if we optimize this path,
so sending the `LIMIT 0` query id to client is a maintenance overhead later on.
    
    Looking at the JDBC and ODBC documentation, it doesn't look like there is a timeout for
create prepare statement (correct me if I am wrong here). There is only timeout for execute
prepare statement.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message