user2785230
user2785230

Reputation: 11

datastax cqlsh alter table add column ,but can not see the column in hive , how?

cqlsh:test> alter table example  add  t int;
then , 
bash$dse hive 
hive> use test; desc example;
OK
k       int     from deserializer
v       string  from deserializer

The new column t is cannot be seen in hive. dse version is 3.1.3.

What do need I do?

Upvotes: 1

Views: 408

Answers (2)

beobal
beobal

Reputation: 274

You don't need to drop any keyspaces or restart DSE or Hive, just drop the Hive table and let DSE recreate it by issuing a use command.

hive> desc ex;
OK
k   int from deserializer
v   string  from deserializer
Time taken: 0.054 seconds
hive> drop table ex;
OK
Time taken: 0.051 seconds
hive> desc ex;      
OK
Table ex does not exist      
Time taken: 0.051 seconds
hive> use foo;
OK
Time taken: 0.035 seconds
hive> desc ex;
OK
k   int from deserializer
t   int from deserializer
v   string  from deserializer
Time taken: 0.042 seconds

Edit: the same can be achieved by DROP TABLE followed by SHOW TABLES (i.e. SHOW TABLES instead of USE). As per the DataStax docs: http://www.datastax.com/docs/datastax_enterprise3.1/solutions/about_hive#handling-schema-changes

Upvotes: 7

abhi
abhi

Reputation: 4792

Drop HiveMetaStore keyspace and MetaStore column family. Then restart DSE, restart HIVE, you should have a fresh start

Upvotes: 1

Related Questions