Professional Documents
Culture Documents
This guide lets you try out the HP Vertica Flex Tables feature. Refer to the HP Vertica 7.1.x Flex Tables Guide for a complete description
of understanding and using this powerful feature.
1. Create a file, mountains.json, or see /opt/vertica/packages/flextable/examples/mountains.json:
{ "name": "Everest", "type":"mountain", "height": 29029, "hike_safety": 34.1
{ "name": "Mt St Helens", "type": "volcano", "hike_safety": 15.4 }
Copyright 2006 - 2016 Hewlett Packard, and its licensors. All rights reserved.
5. Create a hybrid flex table with important columns that merit full
HP Vertica performance:
CREATE FLEX TABLE mountains_hybrid(
name varchar(41) default name::varchar(41),
hike_safety float default hike_safety::float);
COPY mountains_hybrid FROM '/path/to/file'
PARSER fjsonparser();
Compute the keys table and build a view with one helper function:
SELECT compute_flextable_keys_and_build_view(
'mountains_hybrid');
SELECT * from mountains_hybrid_keys;
key_name
| frequency | data_type_guess
-------------+-----------+----------------hike_safety |
2 | float
name
|
2 | varchar(41)
type
|
2 | varchar(20)
height
|
1 | varchar(20)
(4 rows)
Notice that 2 of the 3 columns are already real columns (Step 5):
SELECT * FROM
materialize_flextable_columns_results;
Query the results to see the newly-promoted height column. Read the Flex
Tables Guide to understand cases that especially benefit when you promote
virtual columns to real columns.
This ends the FlexTables Quick Start. See the HP Vertica 7.1.x
Flex Tables Guide for complete information.