AnsweredAssumed Answered

Current Database Issues

Question asked by toadrw on Feb 27, 2013
Hello:

I'm using Hive .9.  I have a couple of questions relating to setting the current database. 

When connecting to Hadoop how would you set the default catalog in the connection string for this driver.  Catalog=databasename; doesn't seem to work and it seems I'm always get put in the default database.

I'm having issues with the USE command?  I'm creating the following table with an index in the default database.  I'm then creating a new database, using the USE command to set it as default and then trying to pull the indexes for the table I create in default.

I would expect to get an error stating that the table does not exist, but instead the indexes from the table in the default database are pulled?

Thank you for your help.

USE default;

CREATE TABLE IF NOT EXISTS customer_table
(Customer_Number  int,
Customer_Name string,
Phone_Number string)
ROW FORMAT DELIMITED
FIELDS TERMINATED BY ','
STORED AS TEXTFILE;

CREATE INDEX idx_customer_table ON TABLE customer_table(customer_number)
AS 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler'
WITH DEFERRED REBUILD;

CREATE DATABASE SQL_CLASS;

USE SQL_CLASS;

SHOW INDEXES ON Customer_Table;

When querying hive directly.  I get the results I am expecting...  Thanks again.

hive> use sql_class;
OK
Time taken: 3.634 seconds
hive> show indexes on customer_table;
Table customer_table does not exist
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask
hive>

Outcomes