Return-Path: X-Original-To: apmail-hive-dev-archive@www.apache.org Delivered-To: apmail-hive-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0A0E6558 for ; Thu, 30 Jun 2011 23:45:55 +0000 (UTC) Received: (qmail 23323 invoked by uid 500); 30 Jun 2011 23:45:55 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 23277 invoked by uid 500); 30 Jun 2011 23:45:55 -0000 Mailing-List: contact dev-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list dev@hive.apache.org Received: (qmail 23269 invoked by uid 500); 30 Jun 2011 23:45:55 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 23140 invoked by uid 99); 30 Jun 2011 23:45:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jun 2011 23:45:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Jun 2011 23:45:51 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id D06CA43DA1A for ; Thu, 30 Jun 2011 23:45:30 +0000 (UTC) Date: Thu, 30 Jun 2011 23:45:30 +0000 (UTC) From: "jiraposter@reviews.apache.org (JIRA)" To: hive-dev@hadoop.apache.org Message-ID: <1613372873.7342.1309477530850.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1134034041.9559.1308186588044.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HIVE-2226) Add API to retrieve table names by an arbitrary filter, e.g., by owner, retention, parameters, etc. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HIVE-2226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13058137#comment-13058137 ] jiraposter@reviews.apache.org commented on HIVE-2226: ----------------------------------------------------- bq. On 2011-06-30 22:48:12, Paul Yang wrote: bq. > trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java, lines 1533-1537 bq. > bq. > bq. > I don't think it's possible to create 2 tables with the same name. In which case, there shouldn't be a need for this check. Ah, the comment there is a little misleading. Some tables were getting returned multiple times if they matched multiple parts of an OR clause. For example, in the unit test with the filter string: owner = "testOwner1" && (lastAccessTime = 30 || test_param_1 = "hi"), a table which had owner="testOwner1", lastAccessTime = 30, and test_param_1 = "hi" was returned twice by the query. bq. On 2011-06-30 22:48:12, Paul Yang wrote: bq. > trunk/metastore/src/java/org/apache/hadoop/hive/metastore/parser/ExpressionTree.java, lines 187-188 bq. > bq. > bq. > We should catch the case where the keyName is invalid Will do - Sohan ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/910/#review928 ----------------------------------------------------------- On 2011-06-20 21:04:45, Sohan Jain wrote: bq. bq. ----------------------------------------------------------- bq. This is an automatically generated e-mail. To reply, visit: bq. https://reviews.apache.org/r/910/ bq. ----------------------------------------------------------- bq. bq. (Updated 2011-06-20 21:04:45) bq. bq. bq. Review request for hive and Paul Yang. bq. bq. bq. Summary bq. ------- bq. bq. Create a function listTableNamesByFilter that returns a list of names for tables in a database that match a certain filter. The syntax of the filter is similar to the one created by HIVE-1609. You can filter the table list based on owner, last access time, or table parameter key/values. The filtering takes place at the JDO level for efficiency/speed. To create a new kind of table filter, add a constant to thrift.if and a branch in the if statement in generateJDOFilterOverTables() in ExpressionTree. bq. bq. Example filter statements include: bq. //translation: owner.matches(".*test.*") and lastAccessTime == 0 bq. filter = Constants.HIVE_FILTER_FIELD_OWNER + bq. " like \".*test.*\" and " + bq. Constants.HIVE_FILTER_FIELD_LAST_ACCESS + " = 0"; bq. bq. //translation: owner = "test_user" and (parameters.get("retention") == "30" || parameters.get("retention") == 90) bq. filter = Constants.HIVE_FILTER_FIELD_OWNER + bq. " = \"test_user\" and (" + bq. Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"30\" or " + bq. Constants.HIVE_FILTER_FIELD_PARAMS + "retention = \"90\")" bq. bq. The filter can currently parse string or integer values, where values interpreted as strings must be in quotes. See the comments in IMetaStoreClient for more usage details/restrictions. bq. bq. bq. This addresses bug HIVE-2226. bq. https://issues.apache.org/jira/browse/HIVE-2226 bq. bq. bq. Diffs bq. ----- bq. bq. trunk/metastore/if/hive_metastore.thrift 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/RawStore.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/parser/ExpressionTree.java 1136751 bq. trunk/metastore/src/java/org/apache/hadoop/hive/metastore/parser/Filter.g 1136751 bq. trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java 1136751 bq. bq. Diff: https://reviews.apache.org/r/910/diff bq. bq. bq. Testing bq. ------- bq. bq. Added test cases to TestHiveMetaStore bq. bq. bq. Thanks, bq. bq. Sohan bq. bq. > Add API to retrieve table names by an arbitrary filter, e.g., by owner, retention, parameters, etc. > --------------------------------------------------------------------------------------------------- > > Key: HIVE-2226 > URL: https://issues.apache.org/jira/browse/HIVE-2226 > Project: Hive > Issue Type: Improvement > Components: Metastore > Reporter: Sohan Jain > Assignee: Sohan Jain > Attachments: HIVE-2226.1.patch > > > Create a function called get_table_names_by_filter that returns a list of table names in a database that match a certain filter. The filter should operate similar to the one HIVE-1609. Initially, you should be able to prune the table list based on owner, retention, or table parameter key/values. The filtering should take place at the JDO level for efficiency/speed. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira