From 667ca3aff539c20059935e10cd7b2cf54279e5cc Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Fri, 29 Nov 2019 15:31:08 +0100 Subject: [PATCH 09/13] engine: hide NULL values of json dimensions in inline join table (#38067) --- bijoe/engine.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bijoe/engine.py b/bijoe/engine.py index b44bd8c..3a4d862 100644 --- a/bijoe/engine.py +++ b/bijoe/engine.py @@ -259,8 +259,13 @@ class EngineCube(object): json_key = name[5:] return schemas.Join( name=name, - table='(SELECT DISTINCT %s.%s->>\'%s\' AS value FROM %s ORDER BY value)' % ( - self.fact_table, self.json_field, json_key, self.fact_table), + table=( + '(SELECT DISTINCT %s.%s->>\'%s\' AS value FROM %s ' + 'WHERE %s.%s->>\'%s\' IS NOT NULL ORDER BY value)' % ( + self.fact_table, self.json_field, json_key, self.fact_table, + self.fact_table, self.json_field, json_key + ) + ), master='%s->>\'%s\'' % (self.json_field, json_key), detail='value', ) -- 2.23.0