GitHub user mattyb149 opened a pull request:
https://github.com/apache/nifi/pull/1132
NIFI-2897: Fixed SelectHiveQL for CSV output of complex types
The lack of unit tests is due to the fact that we use Derby. When we get
integration tests in place using MiniHS2, we can automate this kind of testing.
In the meantime, here are some helpful HiveDDL statements you can use to
populate a table with the different types, along with some queries that will
illustrate the problem and solution:
Create a table with a field that is an array of structs:
`create table arraytest (a ARRAY>)`
Insert two elements (this assumes you have a table named "dummy" with at
least one row):
`insert into arraytest select
array(named_struct("name","Joe","age",42),named_struct("name","Mary","age",24))
from dummy limit 1`
Select the whole array (as one field):
`SELECT * FROM arraytest`
Select the structs as individual columns:
`SELECT a[0], a[1] FROM arraytest`
Select a struct and a field from the other struct:
`SELECT a[0], a[1].name FROM arraytest`
The first SELECT should generate a single field/column in CSV, the other
two should have two columns, all properly escaped to give valid CSV.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mattyb149/nifi NIFI-2897
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/1132.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1132
commit 58c97651e18f2880b5aa291a1e41b2ab7e14b0f1
Author: Matt Burgess
Date: 2016-10-13T17:27:49Z
NIFI-2897: Fixed SelectHiveQL for CSV output of complex types
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---