Pinot Version | 1.10.0 |
---|---|
Code | startreedata/pinot-recipes/null-values |
Prerequisites
To follow the code examples in this guide, you must install Docker locally and download recipes.Navigate to recipe
- If you haven’t already, download recipes.
- In terminal, go to the recipe by running the following command:
Launch Pinot Cluster
You can spin up a Pinot Cluster by running the following command:Dataset
We’re going to import the following JSON file:The Ugly Truth
and Dear John
are both missing a value for genre
, which we’ll explore in this guide.
Pinot Schema and Table
Now let’s create a couple of Pinot Schemas and Table. We’re going to create one table where nulls are allowed and one where they aren’t. We need to create one schema per table even though they will be identical except for the name.Ingestion Job
Now we’re going to import the JSON file into these tables. We’ll do this with the following ingestion spec:movies
schema.
You can run the following command to run the import on the movies_no_null
table:
movies_nuls
table:
Querying
Once that’s completed, navigate to localhost:9000/#/query and run the following query to return the rows that have a genre and year in themovies_no_nulls
table:
genre | id | title | year |
---|---|---|---|
Comedy | 361248901147483647 | Valentine’s Day | 2010 |
null | 332567813147483648 | The Ugly Truth | 2009 |
Romance | 346905752147483649 | P.S. I Love You | 2007 |
null | 300441473147483650 | Dear John | 2010 |
Fantasy | 394030854147483651 | The Curious Case of Benjamin Button | -2147483648 |
movies_no_nulls
table.
The genre
and year
columns in the movies_nulls
table, on the other hand, supports null values, which we can see by running the following query:
genre | id | title | year |
---|---|---|---|
Comedy | 361248901147483647 | Valentine’s Day | 2010 |
Romance | 346905752147483649 | P.S. I Love You | 2007 |
IS NOT NULL
clause.