Ricerca…
Struttura
CREATE INDEX index_name
ON TABLE base_table_name (col_name, ...)
AS 'index.handler.class.name'
[WITH DEFERRED REBUILD]
[IDXPROPERTIES (property_name=property_value, ...)]
[IN TABLE index_table_name]
[PARTITIONED BY (col_name, ...)]
[
[ ROW FORMAT ...] STORED AS ...
| STORED BY ...
]
[LOCATION hdfs_path]
[TBLPROPERTIES (...)]
Esempio:
CREATE INDEX inedx_salary ON TABLE employee(salary) AS 'org.apache.hadoop.hive.ql.index.compact.CompactIndexHandler' WITH DEFERRED REBUILD;
Alter Index
ALTER INDEX nome_indice ON nome_tabella [PARTITION (...)] REBUILD
Drop Index
DROP INDEX <index_name> ON <table_name>
Se WITH REBUILD DEFERRED è specificato in CREATE INDEX, l'indice appena creato è inizialmente vuoto (indipendentemente dal fatto che la tabella contenga dati).
Il comando ALTER INDEX REBUILD può essere utilizzato per creare la struttura dell'indice per tutte le partizioni o una singola partizione.
Modified text is an extract of the original Stack Overflow Documentation
Autorizzato sotto CC BY-SA 3.0
Non affiliato con Stack Overflow