engine: hide NULL values of json dimensions in inline join table (#38067)

This commit is contained in:
Benjamin Dauvergne 2019-11-29 15:31:08 +01:00
parent 4701568437
commit d603f14860
1 changed files with 7 additions and 2 deletions

View File

@ -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',
)