drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ve...@apache.org
Subject [2/4] drill git commit: DRILL-4925: Add tableType filter to GetTables metadata query
Date Thu, 13 Oct 2016 17:13:28 GMT
http://git-wip-us.apache.org/repos/asf/drill/blob/d0464ab9/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasReq.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasReq.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasReq.java
index 742b195..6e24310 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasReq.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetSchemasReq.java
@@ -48,7 +48,7 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
 
     
     private LikeFilter catalogNameFilter;
-    private LikeFilter schameNameFilter;
+    private LikeFilter schemaNameFilter;
 
     public GetSchemasReq()
     {
@@ -70,16 +70,16 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
         return this;
     }
 
-    // schameNameFilter
+    // schemaNameFilter
 
-    public LikeFilter getSchameNameFilter()
+    public LikeFilter getSchemaNameFilter()
     {
-        return schameNameFilter;
+        return schemaNameFilter;
     }
 
-    public GetSchemasReq setSchameNameFilter(LikeFilter schameNameFilter)
+    public GetSchemasReq setSchemaNameFilter(LikeFilter schemaNameFilter)
     {
-        this.schameNameFilter = schameNameFilter;
+        this.schemaNameFilter = schemaNameFilter;
         return this;
     }
 
@@ -142,7 +142,7 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
                     break;
 
                 case 2:
-                    message.schameNameFilter = input.mergeObject(message.schameNameFilter,
LikeFilter.getSchema());
+                    message.schemaNameFilter = input.mergeObject(message.schemaNameFilter,
LikeFilter.getSchema());
                     break;
 
                 default:
@@ -158,8 +158,8 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
              output.writeObject(1, message.catalogNameFilter, LikeFilter.getSchema(), false);
 
 
-        if(message.schameNameFilter != null)
-             output.writeObject(2, message.schameNameFilter, LikeFilter.getSchema(), false);
+        if(message.schemaNameFilter != null)
+             output.writeObject(2, message.schemaNameFilter, LikeFilter.getSchema(), false);
 
     }
 
@@ -168,7 +168,7 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
         switch(number)
         {
             case 1: return "catalogNameFilter";
-            case 2: return "schameNameFilter";
+            case 2: return "schemaNameFilter";
             default: return null;
         }
     }
@@ -183,7 +183,7 @@ public final class GetSchemasReq implements Externalizable, Message<GetSchemasRe
     static
     {
         __fieldMap.put("catalogNameFilter", 1);
-        __fieldMap.put("schameNameFilter", 2);
+        __fieldMap.put("schemaNameFilter", 2);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/d0464ab9/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesReq.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesReq.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesReq.java
index ce9da61..e9b768b 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesReq.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/GetTablesReq.java
@@ -24,6 +24,8 @@ 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;
@@ -48,8 +50,9 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
 
     
     private LikeFilter catalogNameFilter;
-    private LikeFilter schameNameFilter;
+    private LikeFilter schemaNameFilter;
     private LikeFilter tableNameFilter;
+    private List<String> tableTypeFilter;
 
     public GetTablesReq()
     {
@@ -71,16 +74,16 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
         return this;
     }
 
-    // schameNameFilter
+    // schemaNameFilter
 
-    public LikeFilter getSchameNameFilter()
+    public LikeFilter getSchemaNameFilter()
     {
-        return schameNameFilter;
+        return schemaNameFilter;
     }
 
-    public GetTablesReq setSchameNameFilter(LikeFilter schameNameFilter)
+    public GetTablesReq setSchemaNameFilter(LikeFilter schemaNameFilter)
     {
-        this.schameNameFilter = schameNameFilter;
+        this.schemaNameFilter = schemaNameFilter;
         return this;
     }
 
@@ -97,6 +100,19 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
         return this;
     }
 
+    // tableTypeFilter
+
+    public List<String> getTableTypeFilterList()
+    {
+        return tableTypeFilter;
+    }
+
+    public GetTablesReq setTableTypeFilterList(List<String> tableTypeFilter)
+    {
+        this.tableTypeFilter = tableTypeFilter;
+        return this;
+    }
+
     // java serialization
 
     public void readExternal(ObjectInput in) throws IOException
@@ -156,13 +172,18 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
                     break;
 
                 case 2:
-                    message.schameNameFilter = input.mergeObject(message.schameNameFilter,
LikeFilter.getSchema());
+                    message.schemaNameFilter = input.mergeObject(message.schemaNameFilter,
LikeFilter.getSchema());
                     break;
 
                 case 3:
                     message.tableNameFilter = input.mergeObject(message.tableNameFilter,
LikeFilter.getSchema());
                     break;
 
+                case 4:
+                    if(message.tableTypeFilter == null)
+                        message.tableTypeFilter = new ArrayList<String>();
+                    message.tableTypeFilter.add(input.readString());
+                    break;
                 default:
                     input.handleUnknownField(number, this);
             }   
@@ -176,13 +197,22 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
              output.writeObject(1, message.catalogNameFilter, LikeFilter.getSchema(), false);
 
 
-        if(message.schameNameFilter != null)
-             output.writeObject(2, message.schameNameFilter, LikeFilter.getSchema(), false);
+        if(message.schemaNameFilter != null)
+             output.writeObject(2, message.schemaNameFilter, LikeFilter.getSchema(), false);
 
 
         if(message.tableNameFilter != null)
              output.writeObject(3, message.tableNameFilter, LikeFilter.getSchema(), false);
 
+
+        if(message.tableTypeFilter != null)
+        {
+            for(String tableTypeFilter : message.tableTypeFilter)
+            {
+                if(tableTypeFilter != null)
+                    output.writeString(4, tableTypeFilter, true);
+            }
+        }
     }
 
     public String getFieldName(int number)
@@ -190,8 +220,9 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
         switch(number)
         {
             case 1: return "catalogNameFilter";
-            case 2: return "schameNameFilter";
+            case 2: return "schemaNameFilter";
             case 3: return "tableNameFilter";
+            case 4: return "tableTypeFilter";
             default: return null;
         }
     }
@@ -206,8 +237,9 @@ public final class GetTablesReq implements Externalizable, Message<GetTablesReq>
     static
     {
         __fieldMap.put("catalogNameFilter", 1);
-        __fieldMap.put("schameNameFilter", 2);
+        __fieldMap.put("schemaNameFilter", 2);
         __fieldMap.put("tableNameFilter", 3);
+        __fieldMap.put("tableTypeFilter", 4);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/drill/blob/d0464ab9/protocol/src/main/java/org/apache/drill/exec/proto/beans/LikeFilter.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/LikeFilter.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/LikeFilter.java
index 88d0716..f54611d 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/LikeFilter.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/LikeFilter.java
@@ -47,7 +47,7 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
     static final LikeFilter DEFAULT_INSTANCE = new LikeFilter();
 
     
-    private String regex;
+    private String pattern;
     private String escape;
 
     public LikeFilter()
@@ -57,16 +57,16 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
 
     // getters and setters
 
-    // regex
+    // pattern
 
-    public String getRegex()
+    public String getPattern()
     {
-        return regex;
+        return pattern;
     }
 
-    public LikeFilter setRegex(String regex)
+    public LikeFilter setPattern(String pattern)
     {
-        this.regex = regex;
+        this.pattern = pattern;
         return this;
     }
 
@@ -138,7 +138,7 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
                 case 0:
                     return;
                 case 1:
-                    message.regex = input.readString();
+                    message.pattern = input.readString();
                     break;
                 case 2:
                     message.escape = input.readString();
@@ -152,8 +152,8 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
 
     public void writeTo(Output output, LikeFilter message) throws IOException
     {
-        if(message.regex != null)
-            output.writeString(1, message.regex, false);
+        if(message.pattern != null)
+            output.writeString(1, message.pattern, false);
 
         if(message.escape != null)
             output.writeString(2, message.escape, false);
@@ -163,7 +163,7 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
     {
         switch(number)
         {
-            case 1: return "regex";
+            case 1: return "pattern";
             case 2: return "escape";
             default: return null;
         }
@@ -178,7 +178,7 @@ public final class LikeFilter implements Externalizable, Message<LikeFilter>,
Sc
     private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
     static
     {
-        __fieldMap.put("regex", 1);
+        __fieldMap.put("pattern", 1);
         __fieldMap.put("escape", 2);
     }
     

http://git-wip-us.apache.org/repos/asf/drill/blob/d0464ab9/protocol/src/main/protobuf/User.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/User.proto b/protocol/src/main/protobuf/User.proto
index 3bb1495..62c401a 100644
--- a/protocol/src/main/protobuf/User.proto
+++ b/protocol/src/main/protobuf/User.proto
@@ -120,7 +120,7 @@ enum RequestStatus {
  * Simple filter which encapsulates the SQL LIKE ... ESCAPE function
  */
 message LikeFilter {
-  optional string regex = 1; // pattern to match
+  optional string pattern = 1; // pattern to match
   optional string escape = 2; // escape character (if any) present in the pattern
 }
 
@@ -154,7 +154,7 @@ message GetCatalogsResp {
  */
 message GetSchemasReq {
   optional LikeFilter catalog_name_filter = 1;
-  optional LikeFilter schame_name_filter = 2;
+  optional LikeFilter schema_name_filter = 2;
 }
 
 /*
@@ -182,8 +182,9 @@ message GetSchemasResp {
  */
 message GetTablesReq {
   optional LikeFilter catalog_name_filter = 1;
-  optional LikeFilter schame_name_filter = 2;
+  optional LikeFilter schema_name_filter = 2;
   optional LikeFilter table_name_filter = 3;
+  repeated string table_type_filter = 4;
 }
 
 /*
@@ -210,7 +211,7 @@ message GetTablesResp {
  */
 message GetColumnsReq {
   optional LikeFilter catalog_name_filter = 1;
-  optional LikeFilter schame_name_filter = 2;
+  optional LikeFilter schema_name_filter = 2;
   optional LikeFilter table_name_filter = 3;
   optional LikeFilter column_name_filter = 4;
 }


Mime
View raw message