NIFI-2897: Fixed SelectHiveQL for CSV output of complex types#1132
Closed
mattyb149 wants to merge 1 commit intoapache:masterfrom
Closed
NIFI-2897: Fixed SelectHiveQL for CSV output of complex types#1132mattyb149 wants to merge 1 commit intoapache:masterfrom
mattyb149 wants to merge 1 commit intoapache:masterfrom
Conversation
Contributor
|
LGTM. Merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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<STRUCT<name:STRING, age:INT>>)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 1Select the whole array (as one field):
SELECT * FROM arraytestSelect the structs as individual columns:
SELECT a[0], a[1] FROM arraytestSelect a struct and a field from the other struct:
SELECT a[0], a[1].name FROM arraytestThe first SELECT should generate a single field/column in CSV, the other two should have two columns, all properly escaped to give valid CSV.