This tutorial will show you how to use map. If you have no installed Hive yet please follow this tutorial.
Create Table with Map:
- CREATE TABLE test_map (
- columnA STRING,
- columnB VARCHAR(15),
- columnC INT,
- columnD TIMESTAMP,
- columnE DATE,
- columnF MAP<STRING, INT>
- )
- STORED AS ORC;
Insert Data:
- INSERT INTO test_map
- SELECT '1', '2', 1, '2019-02-07 20:58:27', '2019-02-07', MAP('Val', 1);
Select Data:
This will give back the value of “Val” in columnF.
- SELECT columnF['Val']
- FROM test_map;