[ 
https://issues.apache.org/jira/browse/HIVE-675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753396#action_12753396
 ] 

He Yongqiang commented on HIVE-675:
-----------------------------------

>>Assuming Hive is an inner field of SessionState, we don't need to protect the 
>>current database with another level of ThreadLocal.
yes. hive is a singleton object.
{noformat} 
public class Hive {

  static final private Log LOG = LogFactory.getLog("hive.ql.metadata.Hive");
  static Hive db = null;
.........
  public static Hive get(HiveConf c, boolean needsRefresh) throws HiveException 
{
    if(db == null || needsRefresh) {
      closeCurrent();
      c.set("fs.scheme.class","dfs");
      db = new Hive(c);
    }
    return db;
  }
{noformat} 

So even though Hive is an inner field of SessionState, but i think they all 
refer to the singleton instance at runtime. So we need to make the current 
database be a ThreadLocal variable.

> add database/scheme support Hive QL
> -----------------------------------
>
>                 Key: HIVE-675
>                 URL: https://issues.apache.org/jira/browse/HIVE-675
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Prasad Chakka
>            Assignee: He Yongqiang
>         Attachments: hive-675-2009-9-7.patch, hive-675-2009-9-8.patch
>
>
> Currently all Hive tables reside in single namespace (default). Hive should 
> support multiple namespaces (databases or schemas) such that users can create 
> tables in their specific namespaces. These name spaces can have different 
> warehouse directories (with a default naming scheme) and possibly different 
> properties.
> There is already some support for this in metastore but Hive query parser 
> should have this feature as well.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to