drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ve...@apache.org
Subject [1/4] drill git commit: DRILL-4729: Add support for prepared statement implementation on server side
Date Mon, 08 Aug 2016 20:49:49 GMT
Repository: drill
Updated Branches:
  refs/heads/master ef6e522c9 -> 14f6ec7dd


http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnSearchability.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnSearchability.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnSearchability.java
new file mode 100644
index 0000000..826a896
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnSearchability.java
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+public enum ColumnSearchability implements com.dyuproject.protostuff.EnumLite<ColumnSearchability>
+{
+    UNKNOWN_SEARCHABILITY(0),
+    NONE(1),
+    CHAR(2),
+    NUMBER(3),
+    ALL(4);
+    
+    public final int number;
+    
+    private ColumnSearchability (int number)
+    {
+        this.number = number;
+    }
+    
+    public int getNumber()
+    {
+        return number;
+    }
+    
+    public static ColumnSearchability valueOf(int number)
+    {
+        switch(number) 
+        {
+            case 0: return UNKNOWN_SEARCHABILITY;
+            case 1: return NONE;
+            case 2: return CHAR;
+            case 3: return NUMBER;
+            case 4: return ALL;
+            default: return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnUpdatability.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnUpdatability.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnUpdatability.java
new file mode 100644
index 0000000..09adb4f
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ColumnUpdatability.java
@@ -0,0 +1,51 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+public enum ColumnUpdatability implements com.dyuproject.protostuff.EnumLite<ColumnUpdatability>
+{
+    UNKNOWN_UPDATABILITY(0),
+    READ_ONLY(1),
+    WRITABLE(2);
+    
+    public final int number;
+    
+    private ColumnUpdatability (int number)
+    {
+        this.number = number;
+    }
+    
+    public int getNumber()
+    {
+        return number;
+    }
+    
+    public static ColumnUpdatability valueOf(int number)
+    {
+        switch(number) 
+        {
+            case 0: return UNKNOWN_UPDATABILITY;
+            case 1: return READ_ONLY;
+            case 2: return WRITABLE;
+            default: return null;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementReq.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementReq.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementReq.java
new file mode 100644
index 0000000..dc86da5
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementReq.java
@@ -0,0 +1,163 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class CreatePreparedStatementReq implements Externalizable, Message<CreatePreparedStatementReq>, Schema<CreatePreparedStatementReq>
+{
+
+    public static Schema<CreatePreparedStatementReq> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static CreatePreparedStatementReq getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final CreatePreparedStatementReq DEFAULT_INSTANCE = new CreatePreparedStatementReq();
+
+    
+    private String sqlQuery;
+
+    public CreatePreparedStatementReq()
+    {
+        
+    }
+
+    // getters and setters
+
+    // sqlQuery
+
+    public String getSqlQuery()
+    {
+        return sqlQuery;
+    }
+
+    public CreatePreparedStatementReq setSqlQuery(String sqlQuery)
+    {
+        this.sqlQuery = sqlQuery;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<CreatePreparedStatementReq> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public CreatePreparedStatementReq newMessage()
+    {
+        return new CreatePreparedStatementReq();
+    }
+
+    public Class<CreatePreparedStatementReq> typeClass()
+    {
+        return CreatePreparedStatementReq.class;
+    }
+
+    public String messageName()
+    {
+        return CreatePreparedStatementReq.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return CreatePreparedStatementReq.class.getName();
+    }
+
+    public boolean isInitialized(CreatePreparedStatementReq message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, CreatePreparedStatementReq message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.sqlQuery = input.readString();
+                    break;
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, CreatePreparedStatementReq message) throws IOException
+    {
+        if(message.sqlQuery != null)
+            output.writeString(1, message.sqlQuery, false);
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "sqlQuery";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("sqlQuery", 1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementResp.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementResp.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementResp.java
new file mode 100644
index 0000000..afa3ea8
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/CreatePreparedStatementResp.java
@@ -0,0 +1,211 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class CreatePreparedStatementResp implements Externalizable, Message<CreatePreparedStatementResp>, Schema<CreatePreparedStatementResp>
+{
+
+    public static Schema<CreatePreparedStatementResp> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static CreatePreparedStatementResp getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final CreatePreparedStatementResp DEFAULT_INSTANCE = new CreatePreparedStatementResp();
+
+    
+    private RequestStatus status;
+    private PreparedStatement preparedStatement;
+    private DrillPBError error;
+
+    public CreatePreparedStatementResp()
+    {
+        
+    }
+
+    // getters and setters
+
+    // status
+
+    public RequestStatus getStatus()
+    {
+        return status == null ? RequestStatus.UNKNOWN_STATUS : status;
+    }
+
+    public CreatePreparedStatementResp setStatus(RequestStatus status)
+    {
+        this.status = status;
+        return this;
+    }
+
+    // preparedStatement
+
+    public PreparedStatement getPreparedStatement()
+    {
+        return preparedStatement;
+    }
+
+    public CreatePreparedStatementResp setPreparedStatement(PreparedStatement preparedStatement)
+    {
+        this.preparedStatement = preparedStatement;
+        return this;
+    }
+
+    // error
+
+    public DrillPBError getError()
+    {
+        return error;
+    }
+
+    public CreatePreparedStatementResp setError(DrillPBError error)
+    {
+        this.error = error;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<CreatePreparedStatementResp> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public CreatePreparedStatementResp newMessage()
+    {
+        return new CreatePreparedStatementResp();
+    }
+
+    public Class<CreatePreparedStatementResp> typeClass()
+    {
+        return CreatePreparedStatementResp.class;
+    }
+
+    public String messageName()
+    {
+        return CreatePreparedStatementResp.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return CreatePreparedStatementResp.class.getName();
+    }
+
+    public boolean isInitialized(CreatePreparedStatementResp message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, CreatePreparedStatementResp message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.status = RequestStatus.valueOf(input.readEnum());
+                    break;
+                case 2:
+                    message.preparedStatement = input.mergeObject(message.preparedStatement, PreparedStatement.getSchema());
+                    break;
+
+                case 3:
+                    message.error = input.mergeObject(message.error, DrillPBError.getSchema());
+                    break;
+
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, CreatePreparedStatementResp message) throws IOException
+    {
+        if(message.status != null)
+             output.writeEnum(1, message.status.number, false);
+
+        if(message.preparedStatement != null)
+             output.writeObject(2, message.preparedStatement, PreparedStatement.getSchema(), false);
+
+
+        if(message.error != null)
+             output.writeObject(3, message.error, DrillPBError.getSchema(), false);
+
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "status";
+            case 2: return "preparedStatement";
+            case 3: return "error";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("status", 1);
+        __fieldMap.put("preparedStatement", 2);
+        __fieldMap.put("error", 3);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetCatalogsResp.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetCatalogsResp.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetCatalogsResp.java
index d71062d..d6b9475 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetCatalogsResp.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetCatalogsResp.java
@@ -64,7 +64,7 @@ public final class GetCatalogsResp implements Externalizable, Message<GetCatalog
 
     public RequestStatus getStatus()
     {
-        return status == null ? RequestStatus.UNKNOWN : status;
+        return status == null ? RequestStatus.UNKNOWN_STATUS : status;
     }
 
     public GetCatalogsResp setStatus(RequestStatus status)

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetColumnsResp.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetColumnsResp.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetColumnsResp.java
index dc22c85..f527719 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetColumnsResp.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetColumnsResp.java
@@ -64,7 +64,7 @@ public final class GetColumnsResp implements Externalizable, Message<GetColumnsR
 
     public RequestStatus getStatus()
     {
-        return status == null ? RequestStatus.UNKNOWN : status;
+        return status == null ? RequestStatus.UNKNOWN_STATUS : status;
     }
 
     public GetColumnsResp setStatus(RequestStatus status)

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasResp.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasResp.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasResp.java
index 3dc5e84..f604abc 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasResp.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasResp.java
@@ -64,7 +64,7 @@ public final class GetSchemasResp implements Externalizable, Message<GetSchemasR
 
     public RequestStatus getStatus()
     {
-        return status == null ? RequestStatus.UNKNOWN : status;
+        return status == null ? RequestStatus.UNKNOWN_STATUS : status;
     }
 
     public GetSchemasResp setStatus(RequestStatus status)

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesResp.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesResp.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesResp.java
index c62ed3c..b06cf0c 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesResp.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesResp.java
@@ -64,7 +64,7 @@ public final class GetTablesResp implements Externalizable, Message<GetTablesRes
 
     public RequestStatus getStatus()
     {
-        return status == null ? RequestStatus.UNKNOWN : status;
+        return status == null ? RequestStatus.UNKNOWN_STATUS : status;
     }
 
     public GetTablesResp setStatus(RequestStatus status)

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatement.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatement.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatement.java
new file mode 100644
index 0000000..9ec4e8f
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatement.java
@@ -0,0 +1,199 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class PreparedStatement implements Externalizable, Message<PreparedStatement>, Schema<PreparedStatement>
+{
+
+    public static Schema<PreparedStatement> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static PreparedStatement getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final PreparedStatement DEFAULT_INSTANCE = new PreparedStatement();
+
+    
+    private List<ResultColumnMetadata> columns;
+    private PreparedStatementHandle serverHandle;
+
+    public PreparedStatement()
+    {
+        
+    }
+
+    // getters and setters
+
+    // columns
+
+    public List<ResultColumnMetadata> getColumnsList()
+    {
+        return columns;
+    }
+
+    public PreparedStatement setColumnsList(List<ResultColumnMetadata> columns)
+    {
+        this.columns = columns;
+        return this;
+    }
+
+    // serverHandle
+
+    public PreparedStatementHandle getServerHandle()
+    {
+        return serverHandle;
+    }
+
+    public PreparedStatement setServerHandle(PreparedStatementHandle serverHandle)
+    {
+        this.serverHandle = serverHandle;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<PreparedStatement> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public PreparedStatement newMessage()
+    {
+        return new PreparedStatement();
+    }
+
+    public Class<PreparedStatement> typeClass()
+    {
+        return PreparedStatement.class;
+    }
+
+    public String messageName()
+    {
+        return PreparedStatement.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return PreparedStatement.class.getName();
+    }
+
+    public boolean isInitialized(PreparedStatement message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, PreparedStatement message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    if(message.columns == null)
+                        message.columns = new ArrayList<ResultColumnMetadata>();
+                    message.columns.add(input.mergeObject(null, ResultColumnMetadata.getSchema()));
+                    break;
+
+                case 2:
+                    message.serverHandle = input.mergeObject(message.serverHandle, PreparedStatementHandle.getSchema());
+                    break;
+
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, PreparedStatement message) throws IOException
+    {
+        if(message.columns != null)
+        {
+            for(ResultColumnMetadata columns : message.columns)
+            {
+                if(columns != null)
+                    output.writeObject(1, columns, ResultColumnMetadata.getSchema(), true);
+            }
+        }
+
+
+        if(message.serverHandle != null)
+             output.writeObject(2, message.serverHandle, PreparedStatementHandle.getSchema(), false);
+
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "columns";
+            case 2: return "serverHandle";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("columns", 1);
+        __fieldMap.put("serverHandle", 2);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatementHandle.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatementHandle.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatementHandle.java
new file mode 100644
index 0000000..c35c7ce
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/PreparedStatementHandle.java
@@ -0,0 +1,164 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.ByteString;
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class PreparedStatementHandle implements Externalizable, Message<PreparedStatementHandle>, Schema<PreparedStatementHandle>
+{
+
+    public static Schema<PreparedStatementHandle> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static PreparedStatementHandle getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final PreparedStatementHandle DEFAULT_INSTANCE = new PreparedStatementHandle();
+
+    
+    private ByteString serverInfo;
+
+    public PreparedStatementHandle()
+    {
+        
+    }
+
+    // getters and setters
+
+    // serverInfo
+
+    public ByteString getServerInfo()
+    {
+        return serverInfo;
+    }
+
+    public PreparedStatementHandle setServerInfo(ByteString serverInfo)
+    {
+        this.serverInfo = serverInfo;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<PreparedStatementHandle> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public PreparedStatementHandle newMessage()
+    {
+        return new PreparedStatementHandle();
+    }
+
+    public Class<PreparedStatementHandle> typeClass()
+    {
+        return PreparedStatementHandle.class;
+    }
+
+    public String messageName()
+    {
+        return PreparedStatementHandle.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return PreparedStatementHandle.class.getName();
+    }
+
+    public boolean isInitialized(PreparedStatementHandle message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, PreparedStatementHandle message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.serverInfo = input.readBytes();
+                    break;
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, PreparedStatementHandle message) throws IOException
+    {
+        if(message.serverInfo != null)
+            output.writeBytes(1, message.serverInfo, false);
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "serverInfo";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("serverInfo", 1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java
index 71f98f3..7a4320d 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/QueryType.java
@@ -25,7 +25,8 @@ public enum QueryType implements com.dyuproject.protostuff.EnumLite<QueryType>
     SQL(1),
     LOGICAL(2),
     PHYSICAL(3),
-    EXECUTION(4);
+    EXECUTION(4),
+    PREPARED_STATEMENT(5);
     
     public final int number;
     
@@ -47,6 +48,7 @@ public enum QueryType implements com.dyuproject.protostuff.EnumLite<QueryType>
             case 2: return LOGICAL;
             case 3: return PHYSICAL;
             case 4: return EXECUTION;
+            case 5: return PREPARED_STATEMENT;
             default: return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/RequestStatus.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RequestStatus.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RequestStatus.java
index f526ab5..2e08a4a 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RequestStatus.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RequestStatus.java
@@ -22,9 +22,10 @@ package org.apache.drill.exec.proto.beans;
 
 public enum RequestStatus implements com.dyuproject.protostuff.EnumLite<RequestStatus>
 {
-    UNKNOWN(0),
+    UNKNOWN_STATUS(0),
     OK(1),
-    FAILED(2);
+    FAILED(2),
+    TIMEOUT(3);
     
     public final int number;
     
@@ -42,9 +43,10 @@ public enum RequestStatus implements com.dyuproject.protostuff.EnumLite<RequestS
     {
         switch(number) 
         {
-            case 0: return UNKNOWN;
+            case 0: return UNKNOWN_STATUS;
             case 1: return OK;
             case 2: return FAILED;
+            case 3: return TIMEOUT;
             default: return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/ResultColumnMetadata.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/ResultColumnMetadata.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ResultColumnMetadata.java
new file mode 100644
index 0000000..7af4ed5
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ResultColumnMetadata.java
@@ -0,0 +1,559 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class ResultColumnMetadata implements Externalizable, Message<ResultColumnMetadata>, Schema<ResultColumnMetadata>
+{
+
+    public static Schema<ResultColumnMetadata> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static ResultColumnMetadata getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final ResultColumnMetadata DEFAULT_INSTANCE = new ResultColumnMetadata();
+
+    
+    private String catalogName;
+    private String schemaName;
+    private String tableName;
+    private String columnName;
+    private String label;
+    private String dataType;
+    private Boolean isNullable;
+    private int precision;
+    private int scale;
+    private Boolean signed;
+    private int displaySize;
+    private Boolean isAliased;
+    private ColumnSearchability searchability;
+    private ColumnUpdatability updatability;
+    private Boolean autoIncrement;
+    private Boolean caseSensitivity;
+    private Boolean sortable;
+    private String className;
+    private Boolean isCurrency;
+
+    public ResultColumnMetadata()
+    {
+        
+    }
+
+    // getters and setters
+
+    // catalogName
+
+    public String getCatalogName()
+    {
+        return catalogName;
+    }
+
+    public ResultColumnMetadata setCatalogName(String catalogName)
+    {
+        this.catalogName = catalogName;
+        return this;
+    }
+
+    // schemaName
+
+    public String getSchemaName()
+    {
+        return schemaName;
+    }
+
+    public ResultColumnMetadata setSchemaName(String schemaName)
+    {
+        this.schemaName = schemaName;
+        return this;
+    }
+
+    // tableName
+
+    public String getTableName()
+    {
+        return tableName;
+    }
+
+    public ResultColumnMetadata setTableName(String tableName)
+    {
+        this.tableName = tableName;
+        return this;
+    }
+
+    // columnName
+
+    public String getColumnName()
+    {
+        return columnName;
+    }
+
+    public ResultColumnMetadata setColumnName(String columnName)
+    {
+        this.columnName = columnName;
+        return this;
+    }
+
+    // label
+
+    public String getLabel()
+    {
+        return label;
+    }
+
+    public ResultColumnMetadata setLabel(String label)
+    {
+        this.label = label;
+        return this;
+    }
+
+    // dataType
+
+    public String getDataType()
+    {
+        return dataType;
+    }
+
+    public ResultColumnMetadata setDataType(String dataType)
+    {
+        this.dataType = dataType;
+        return this;
+    }
+
+    // isNullable
+
+    public Boolean getIsNullable()
+    {
+        return isNullable;
+    }
+
+    public ResultColumnMetadata setIsNullable(Boolean isNullable)
+    {
+        this.isNullable = isNullable;
+        return this;
+    }
+
+    // precision
+
+    public int getPrecision()
+    {
+        return precision;
+    }
+
+    public ResultColumnMetadata setPrecision(int precision)
+    {
+        this.precision = precision;
+        return this;
+    }
+
+    // scale
+
+    public int getScale()
+    {
+        return scale;
+    }
+
+    public ResultColumnMetadata setScale(int scale)
+    {
+        this.scale = scale;
+        return this;
+    }
+
+    // signed
+
+    public Boolean getSigned()
+    {
+        return signed;
+    }
+
+    public ResultColumnMetadata setSigned(Boolean signed)
+    {
+        this.signed = signed;
+        return this;
+    }
+
+    // displaySize
+
+    public int getDisplaySize()
+    {
+        return displaySize;
+    }
+
+    public ResultColumnMetadata setDisplaySize(int displaySize)
+    {
+        this.displaySize = displaySize;
+        return this;
+    }
+
+    // isAliased
+
+    public Boolean getIsAliased()
+    {
+        return isAliased;
+    }
+
+    public ResultColumnMetadata setIsAliased(Boolean isAliased)
+    {
+        this.isAliased = isAliased;
+        return this;
+    }
+
+    // searchability
+
+    public ColumnSearchability getSearchability()
+    {
+        return searchability == null ? ColumnSearchability.UNKNOWN_SEARCHABILITY : searchability;
+    }
+
+    public ResultColumnMetadata setSearchability(ColumnSearchability searchability)
+    {
+        this.searchability = searchability;
+        return this;
+    }
+
+    // updatability
+
+    public ColumnUpdatability getUpdatability()
+    {
+        return updatability == null ? ColumnUpdatability.UNKNOWN_UPDATABILITY : updatability;
+    }
+
+    public ResultColumnMetadata setUpdatability(ColumnUpdatability updatability)
+    {
+        this.updatability = updatability;
+        return this;
+    }
+
+    // autoIncrement
+
+    public Boolean getAutoIncrement()
+    {
+        return autoIncrement;
+    }
+
+    public ResultColumnMetadata setAutoIncrement(Boolean autoIncrement)
+    {
+        this.autoIncrement = autoIncrement;
+        return this;
+    }
+
+    // caseSensitivity
+
+    public Boolean getCaseSensitivity()
+    {
+        return caseSensitivity;
+    }
+
+    public ResultColumnMetadata setCaseSensitivity(Boolean caseSensitivity)
+    {
+        this.caseSensitivity = caseSensitivity;
+        return this;
+    }
+
+    // sortable
+
+    public Boolean getSortable()
+    {
+        return sortable;
+    }
+
+    public ResultColumnMetadata setSortable(Boolean sortable)
+    {
+        this.sortable = sortable;
+        return this;
+    }
+
+    // className
+
+    public String getClassName()
+    {
+        return className;
+    }
+
+    public ResultColumnMetadata setClassName(String className)
+    {
+        this.className = className;
+        return this;
+    }
+
+    // isCurrency
+
+    public Boolean getIsCurrency()
+    {
+        return isCurrency;
+    }
+
+    public ResultColumnMetadata setIsCurrency(Boolean isCurrency)
+    {
+        this.isCurrency = isCurrency;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<ResultColumnMetadata> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public ResultColumnMetadata newMessage()
+    {
+        return new ResultColumnMetadata();
+    }
+
+    public Class<ResultColumnMetadata> typeClass()
+    {
+        return ResultColumnMetadata.class;
+    }
+
+    public String messageName()
+    {
+        return ResultColumnMetadata.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return ResultColumnMetadata.class.getName();
+    }
+
+    public boolean isInitialized(ResultColumnMetadata message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, ResultColumnMetadata message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.catalogName = input.readString();
+                    break;
+                case 2:
+                    message.schemaName = input.readString();
+                    break;
+                case 3:
+                    message.tableName = input.readString();
+                    break;
+                case 4:
+                    message.columnName = input.readString();
+                    break;
+                case 5:
+                    message.label = input.readString();
+                    break;
+                case 6:
+                    message.dataType = input.readString();
+                    break;
+                case 7:
+                    message.isNullable = input.readBool();
+                    break;
+                case 8:
+                    message.precision = input.readInt32();
+                    break;
+                case 9:
+                    message.scale = input.readInt32();
+                    break;
+                case 10:
+                    message.signed = input.readBool();
+                    break;
+                case 11:
+                    message.displaySize = input.readInt32();
+                    break;
+                case 12:
+                    message.isAliased = input.readBool();
+                    break;
+                case 13:
+                    message.searchability = ColumnSearchability.valueOf(input.readEnum());
+                    break;
+                case 14:
+                    message.updatability = ColumnUpdatability.valueOf(input.readEnum());
+                    break;
+                case 15:
+                    message.autoIncrement = input.readBool();
+                    break;
+                case 16:
+                    message.caseSensitivity = input.readBool();
+                    break;
+                case 17:
+                    message.sortable = input.readBool();
+                    break;
+                case 18:
+                    message.className = input.readString();
+                    break;
+                case 20:
+                    message.isCurrency = input.readBool();
+                    break;
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, ResultColumnMetadata message) throws IOException
+    {
+        if(message.catalogName != null)
+            output.writeString(1, message.catalogName, false);
+
+        if(message.schemaName != null)
+            output.writeString(2, message.schemaName, false);
+
+        if(message.tableName != null)
+            output.writeString(3, message.tableName, false);
+
+        if(message.columnName != null)
+            output.writeString(4, message.columnName, false);
+
+        if(message.label != null)
+            output.writeString(5, message.label, false);
+
+        if(message.dataType != null)
+            output.writeString(6, message.dataType, false);
+
+        if(message.isNullable != null)
+            output.writeBool(7, message.isNullable, false);
+
+        if(message.precision != 0)
+            output.writeInt32(8, message.precision, false);
+
+        if(message.scale != 0)
+            output.writeInt32(9, message.scale, false);
+
+        if(message.signed != null)
+            output.writeBool(10, message.signed, false);
+
+        if(message.displaySize != 0)
+            output.writeInt32(11, message.displaySize, false);
+
+        if(message.isAliased != null)
+            output.writeBool(12, message.isAliased, false);
+
+        if(message.searchability != null)
+             output.writeEnum(13, message.searchability.number, false);
+
+        if(message.updatability != null)
+             output.writeEnum(14, message.updatability.number, false);
+
+        if(message.autoIncrement != null)
+            output.writeBool(15, message.autoIncrement, false);
+
+        if(message.caseSensitivity != null)
+            output.writeBool(16, message.caseSensitivity, false);
+
+        if(message.sortable != null)
+            output.writeBool(17, message.sortable, false);
+
+        if(message.className != null)
+            output.writeString(18, message.className, false);
+
+        if(message.isCurrency != null)
+            output.writeBool(20, message.isCurrency, false);
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "catalogName";
+            case 2: return "schemaName";
+            case 3: return "tableName";
+            case 4: return "columnName";
+            case 5: return "label";
+            case 6: return "dataType";
+            case 7: return "isNullable";
+            case 8: return "precision";
+            case 9: return "scale";
+            case 10: return "signed";
+            case 11: return "displaySize";
+            case 12: return "isAliased";
+            case 13: return "searchability";
+            case 14: return "updatability";
+            case 15: return "autoIncrement";
+            case 16: return "caseSensitivity";
+            case 17: return "sortable";
+            case 18: return "className";
+            case 20: return "isCurrency";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("catalogName", 1);
+        __fieldMap.put("schemaName", 2);
+        __fieldMap.put("tableName", 3);
+        __fieldMap.put("columnName", 4);
+        __fieldMap.put("label", 5);
+        __fieldMap.put("dataType", 6);
+        __fieldMap.put("isNullable", 7);
+        __fieldMap.put("precision", 8);
+        __fieldMap.put("scale", 9);
+        __fieldMap.put("signed", 10);
+        __fieldMap.put("displaySize", 11);
+        __fieldMap.put("isAliased", 12);
+        __fieldMap.put("searchability", 13);
+        __fieldMap.put("updatability", 14);
+        __fieldMap.put("autoIncrement", 15);
+        __fieldMap.put("caseSensitivity", 16);
+        __fieldMap.put("sortable", 17);
+        __fieldMap.put("className", 18);
+        __fieldMap.put("isCurrency", 20);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
index ff4f4bc..923a76a 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RpcType.java
@@ -34,6 +34,7 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType>
     GET_SCHEMAS(15),
     GET_TABLES(16),
     GET_COLUMNS(17),
+    CREATE_PREPARED_STATEMENT(22),
     QUERY_DATA(6),
     QUERY_HANDLE(7),
     QUERY_PLAN_FRAGMENTS(13),
@@ -41,6 +42,7 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType>
     SCHEMAS(19),
     TABLES(20),
     COLUMNS(21),
+    PREPARED_STATEMENT(23),
     REQ_META_FUNCTIONS(8),
     RESP_FUNCTION_LIST(9),
     QUERY_RESULT(10);
@@ -83,6 +85,8 @@ public enum RpcType implements com.dyuproject.protostuff.EnumLite<RpcType>
             case 19: return SCHEMAS;
             case 20: return TABLES;
             case 21: return COLUMNS;
+            case 22: return CREATE_PREPARED_STATEMENT;
+            case 23: return PREPARED_STATEMENT;
             default: return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java
index e6035d1..d338b4d 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/RunQuery.java
@@ -53,6 +53,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
     private QueryType type;
     private String plan;
     private List<PlanFragment> fragments;
+    private PreparedStatementHandle preparedStatementHandle;
 
     public RunQuery()
     {
@@ -113,6 +114,19 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
         return this;
     }
 
+    // preparedStatementHandle
+
+    public PreparedStatementHandle getPreparedStatementHandle()
+    {
+        return preparedStatementHandle;
+    }
+
+    public RunQuery setPreparedStatementHandle(PreparedStatementHandle preparedStatementHandle)
+    {
+        this.preparedStatementHandle = preparedStatementHandle;
+        return this;
+    }
+
     // java serialization
 
     public void readExternal(ObjectInput in) throws IOException
@@ -182,6 +196,10 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
                     message.fragments.add(input.mergeObject(null, PlanFragment.getSchema()));
                     break;
 
+                case 5:
+                    message.preparedStatementHandle = input.mergeObject(message.preparedStatementHandle, PreparedStatementHandle.getSchema());
+                    break;
+
                 default:
                     input.handleUnknownField(number, this);
             }   
@@ -209,6 +227,10 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
             }
         }
 
+
+        if(message.preparedStatementHandle != null)
+             output.writeObject(5, message.preparedStatementHandle, PreparedStatementHandle.getSchema(), false);
+
     }
 
     public String getFieldName(int number)
@@ -219,6 +241,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
             case 2: return "type";
             case 3: return "plan";
             case 4: return "fragments";
+            case 5: return "preparedStatementHandle";
             default: return null;
         }
     }
@@ -236,6 +259,7 @@ public final class RunQuery implements Externalizable, Message<RunQuery>, Schema
         __fieldMap.put("type", 2);
         __fieldMap.put("plan", 3);
         __fieldMap.put("fragments", 4);
+        __fieldMap.put("preparedStatementHandle", 5);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/java/org/apache/drill/exec/proto/beans/ServerPreparedStatementState.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/ServerPreparedStatementState.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ServerPreparedStatementState.java
new file mode 100644
index 0000000..ad2118c
--- /dev/null
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/ServerPreparedStatementState.java
@@ -0,0 +1,163 @@
+/**
+ * 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.
+ */
+// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
+// Generated from protobuf
+
+package org.apache.drill.exec.proto.beans;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
+import com.dyuproject.protostuff.GraphIOUtil;
+import com.dyuproject.protostuff.Input;
+import com.dyuproject.protostuff.Message;
+import com.dyuproject.protostuff.Output;
+import com.dyuproject.protostuff.Schema;
+
+public final class ServerPreparedStatementState implements Externalizable, Message<ServerPreparedStatementState>, Schema<ServerPreparedStatementState>
+{
+
+    public static Schema<ServerPreparedStatementState> getSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    public static ServerPreparedStatementState getDefaultInstance()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    static final ServerPreparedStatementState DEFAULT_INSTANCE = new ServerPreparedStatementState();
+
+    
+    private String sqlQuery;
+
+    public ServerPreparedStatementState()
+    {
+        
+    }
+
+    // getters and setters
+
+    // sqlQuery
+
+    public String getSqlQuery()
+    {
+        return sqlQuery;
+    }
+
+    public ServerPreparedStatementState setSqlQuery(String sqlQuery)
+    {
+        this.sqlQuery = sqlQuery;
+        return this;
+    }
+
+    // java serialization
+
+    public void readExternal(ObjectInput in) throws IOException
+    {
+        GraphIOUtil.mergeDelimitedFrom(in, this, this);
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException
+    {
+        GraphIOUtil.writeDelimitedTo(out, this, this);
+    }
+
+    // message method
+
+    public Schema<ServerPreparedStatementState> cachedSchema()
+    {
+        return DEFAULT_INSTANCE;
+    }
+
+    // schema methods
+
+    public ServerPreparedStatementState newMessage()
+    {
+        return new ServerPreparedStatementState();
+    }
+
+    public Class<ServerPreparedStatementState> typeClass()
+    {
+        return ServerPreparedStatementState.class;
+    }
+
+    public String messageName()
+    {
+        return ServerPreparedStatementState.class.getSimpleName();
+    }
+
+    public String messageFullName()
+    {
+        return ServerPreparedStatementState.class.getName();
+    }
+
+    public boolean isInitialized(ServerPreparedStatementState message)
+    {
+        return true;
+    }
+
+    public void mergeFrom(Input input, ServerPreparedStatementState message) throws IOException
+    {
+        for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
+        {
+            switch(number)
+            {
+                case 0:
+                    return;
+                case 1:
+                    message.sqlQuery = input.readString();
+                    break;
+                default:
+                    input.handleUnknownField(number, this);
+            }   
+        }
+    }
+
+
+    public void writeTo(Output output, ServerPreparedStatementState message) throws IOException
+    {
+        if(message.sqlQuery != null)
+            output.writeString(1, message.sqlQuery, false);
+    }
+
+    public String getFieldName(int number)
+    {
+        switch(number)
+        {
+            case 1: return "sqlQuery";
+            default: return null;
+        }
+    }
+
+    public int getFieldNumber(String name)
+    {
+        final Integer number = __fieldMap.get(name);
+        return number == null ? 0 : number.intValue();
+    }
+
+    private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
+    static
+    {
+        __fieldMap.put("sqlQuery", 1);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/protobuf/ExecutionProtos.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/ExecutionProtos.proto b/protocol/src/main/protobuf/ExecutionProtos.proto
index 36cd12b..58ca5ad 100644
--- a/protocol/src/main/protobuf/ExecutionProtos.proto
+++ b/protocol/src/main/protobuf/ExecutionProtos.proto
@@ -14,3 +14,12 @@ message FragmentHandle {
 	optional exec.shared.QueryId parent_query_id = 4;
 }
 
+/*
+ * Prepared statement state on server side. Clients do not
+ * need to know the contents. They just need to submit it back to
+ * server when executing the prepared statement.
+ */
+message ServerPreparedStatementState {
+  optional string sql_query = 1;
+}
+

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/protobuf/User.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/User.proto b/protocol/src/main/protobuf/User.proto
index 6af6fcf..3bb1495 100644
--- a/protocol/src/main/protobuf/User.proto
+++ b/protocol/src/main/protobuf/User.proto
@@ -27,6 +27,7 @@ enum RpcType {
   GET_SCHEMAS = 15; // user is requesting metadata of schema(s)
   GET_TABLES = 16; // user is requesting metadata of table(s)
   GET_COLUMNS = 17; // user is requesting metadata of column(s)
+  CREATE_PREPARED_STATEMENT = 22; // user is sending a request to create prepared statement
 
   // bit to user
   QUERY_DATA = 6; // drillbit is sending a query result data batch to the user
@@ -36,6 +37,7 @@ enum RpcType {
   SCHEMAS = 19; // return schema metadata in response to GET_SCHEMAS
   TABLES = 20; // return table metadata in response to GET_TABLES
   COLUMNS = 21; // return column metadata in response to GET_COLUMNS
+  PREPARED_STATEMENT = 23; // return preparated statement in response to CREATE_PREPARED_STATEMENT
 
   REQ_META_FUNCTIONS = 8;
   RESP_FUNCTION_LIST = 9;
@@ -67,13 +69,6 @@ message RequestResults {
   optional int32 maximum_responses = 2;
 }
 
-message RunQuery {
-  optional QueryResultsMode results_mode = 1;
-  optional exec.shared.QueryType type = 2;
-  optional string plan = 3;
-  repeated exec.bit.control.PlanFragment fragments = 4;
-}
-
 message GetQueryPlanFragments {
   required string query = 1;
   optional exec.shared.QueryType type = 2;
@@ -111,9 +106,14 @@ message BitToUserHandshake {
  * Enum indicating the request status.
  */
 enum RequestStatus {
-  UNKNOWN = 0;
+  UNKNOWN_STATUS = 0;
   OK = 1;
   FAILED = 2;
+
+  /**
+   * Request timed out. Futher attempts can change any API specific parameters and retry or just retry the request.
+   */
+  TIMEOUT = 3;
 }
 
 /*
@@ -244,4 +244,194 @@ message GetColumnsResp {
   optional RequestStatus status = 1;
   repeated ColumnMetadata columns = 2;
   optional exec.shared.DrillPBError error = 3;
-}
\ No newline at end of file
+}
+
+/*
+ * Request message to create a prepared statement. Currently prepared
+ * statement only accepts a SQL query. Query parameter support is not
+ * included in current implementation.
+ */
+message CreatePreparedStatementReq {
+  optional string sql_query = 1;
+}
+
+/*
+ * How a column can be used in WHERE clause
+ */
+enum ColumnSearchability {
+  UNKNOWN_SEARCHABILITY = 0;
+  NONE = 1; // can't be used in WHERE clause
+  CHAR = 2; // can be used in WHERE clause but only with LIKE predicate
+  NUMBER = 3; // can be used in a WHERE clause with all the comparison operators except LIKE
+  ALL = 4; // can be used in a WHERE clause with all the comparison operators
+}
+
+/*
+ * Whether a column can be updatable.
+ */
+enum ColumnUpdatability {
+  UNKNOWN_UPDATABILITY = 0;
+  READ_ONLY = 1;
+  WRITABLE = 2;
+}
+
+/*
+ * Metadata of a column in query result set
+ */
+message ResultColumnMetadata {
+  /*
+   * Designated column's catalog name. Empty string if not applicable.
+   * Defaults to "DRILL" as drill has only one catalog.
+   */
+  optional string catalog_name = 1;
+
+  /*
+   * Designated column's schema name. Not set if not applicable. Initial implementation
+   * defaults to no value as we use LIMIT 0 queries to get the schema and schema info
+   * is lost. If we derive the schema from plan, we may get the right value.
+   */
+  optional string schema_name = 2;
+
+  /*
+   * Designated column's table name. Not set if not applicable. Initial implementation
+   * defaults to no value as we use LIMIT 0 queries to get the schema and table info
+   * is lost. If we derive the schema from query plan, we may get the right value.
+   */
+  optional string table_name = 3;
+  optional string column_name = 4; // column name
+
+  /*
+   * Column label name for display or print purposes.
+   * Ex. a column named "empName" might be labeled as "Employee Name".
+   */
+  optional string label = 5;
+
+  /*
+   * Data type in string format. Value is SQL standard type.
+   */
+  optional string data_type = 6;
+
+  optional bool is_nullable = 7;
+
+  /*
+   * For numeric data, this is the maximum precision.
+   * For character data, this is the length in characters.
+   * For datetime datatypes, this is the length in characters of the String representation
+   *    (assuming the maximum allowed precision of the fractional seconds component).
+   * For binary data, this is the length in bytes.
+   * For all other types 0 is returned where the column size is not applicable.
+   */
+  optional int32 precision = 8;
+
+  /*
+   * Column's number of digits to right of the decimal point.
+   * 0 is returned for types where the scale is not applicable
+   */
+  optional int32 scale = 9;
+
+  /*
+   * Indicates whether values in the designated column are signed numbers.
+   */
+  optional bool signed = 10;
+
+  /*
+   * Maximum number of characters required to display data from the column.
+   */
+  optional int32 display_size = 11;
+
+  /*
+   * Is the column an aliased column. Initial implementation defaults to
+   * true as we derive schema from LIMIT 0 query and not the query plan.
+   */
+  optional bool is_aliased = 12;
+
+  optional ColumnSearchability searchability = 13;
+
+  /*
+   * Defaults to READ_ONLU
+   */
+  optional ColumnUpdatability updatability = 14;
+
+  /*
+   * whether the designated column is automatically incremented.
+   */
+  optional bool auto_increment = 15;
+
+  /*
+   * Whether column's case matters for collations and comparisons. Defaults to true.
+   */
+  optional bool case_sensitivity = 16;
+
+  /*
+   * whether the column can be used in ORDER BY clause
+   */
+  optional bool sortable = 17;
+
+  /*
+   * A fully-qualified name of the Java class whose instances are created
+   * if the method ResultSet.getObject is called to retrieve
+   * a value from the column. Applicable only to JDBC clients.
+   */
+  optional string class_name = 18;
+
+  /*
+   * Is the data type a currency type? For JDBC only.
+   */
+  optional bool is_currency = 20;
+}
+
+/*
+ * Server state of prepared statement. Contents are opaque to
+ * client. Client just need to submit this object in RunQuery to
+ * the prepared statement.
+ */
+message PreparedStatementHandle {
+  optional bytes server_info = 1;
+}
+
+/*
+ * Prepared statement. It contains the query metadata and handle to prepared
+ * statement state on server.
+ */
+message PreparedStatement {
+  repeated ResultColumnMetadata columns = 1;
+
+  /*
+   * In order to execute the prepared statement,
+   * clients need to submit this object in RunQuery message.
+   */
+  optional PreparedStatementHandle server_handle = 2;
+}
+
+/*
+ * Response message for CreatePreparedStatementReq.
+ */
+message CreatePreparedStatementResp {
+  optional RequestStatus status = 1;
+  optional PreparedStatement prepared_statement = 2;
+  optional exec.shared.DrillPBError error = 3;
+}
+
+/*
+ * Request message for running a query.
+ */
+message RunQuery {
+  optional QueryResultsMode results_mode = 1;
+  optional exec.shared.QueryType type = 2;
+
+  /*
+   * Input for query type LOGICAL, PHYSICAL or SQL.
+   */
+  optional string plan = 3;
+
+  /*
+   * Input for query type EXECUTION. Input is a set of executable fragments.
+   */
+  repeated exec.bit.control.PlanFragment fragments = 4;
+
+  /*
+   * Input for query type PREPARED_STATEMENT. Input is a prepared statement handle
+   * to state on server side which is returned in response to CreatePreparedStatementReq.
+   */
+  optional PreparedStatementHandle prepared_statement_handle = 5;
+}

http://git-wip-us.apache.org/repos/asf/drill/blob/14f6ec7d/protocol/src/main/protobuf/UserBitShared.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/UserBitShared.proto b/protocol/src/main/protobuf/UserBitShared.proto
index 2293dc0..cfbdbe6 100644
--- a/protocol/src/main/protobuf/UserBitShared.proto
+++ b/protocol/src/main/protobuf/UserBitShared.proto
@@ -19,6 +19,9 @@ enum QueryType {
   LOGICAL = 2;
   PHYSICAL = 3;
   EXECUTION = 4;
+
+  /* Input is a prepared statement */
+  PREPARED_STATEMENT = 5;
 }
 
 message UserCredentials {


Mime
View raw message