metabase-clickhouse-driver icon indicating copy to clipboard operation
metabase-clickhouse-driver copied to clipboard

JSON unfolding / nested objects

Open atillier opened this issue 10 months ago • 7 comments

Describe the bug

Nested JSON object are not rendered / queryable

Steps to reproduce

  1. Load a Clickhouse table containing nested objects
  2. See the table / try to query it

Expected behaviour

Data able to be displayed

Error log

Configuration

Environment

  • metabase-clickhouse-driver version: 1.2.2
  • Metabase version: 47.3
  • OS: MacOS

ClickHouse server

  • ClickHouse Server version: 23.9.1.1653
  • CREATE TABLE statements for tables involved:
CREATE or REPLACE TABLE default."arm-dev.bet-updates.json"
(
    id Int32,
    minStakeLimit Decimal(11, 2),
    maxStakeLimit Decimal(11, 2),
    numberCombinations Int32,
    legs Nested
    (
        id Int32,
        legNumber Int32,
        legType String,
        parts Nested
        (
            id Int32,
        ),
        errors Array(String)
    ),
    errors Array(String),
    creationTime Float64,
    customer Tuple
    (
        id Int32,
        tenantId Int32,
        sportsbookRef String,
        stakeFactor Decimal(11, 2),
        testing Nullable(UInt8)
    )
)
  • Sample data for all these tables, use [clickhouse-obfuscator]
select id, minStakeLimit, maxStakeLimit, numberCombinations, legs, errors, creationTime, customer from "arm-dev.bet-updates.json" order by id, creationTime;

SELECT
    id,
    minStakeLimit,
    maxStakeLimit,
    numberCombinations,
    legs,
    errors,
    creationTime,
    customer
FROM `arm-dev.bet-updates.json`
ORDER BY
    id ASC,
    creationTime ASC

Query id: 70a0bb6a-f5f7-4922-9376-2420898ebcaf

┌──id─┬─minStakeLimit─┬─maxStakeLimit─┬─numberCombinations─┬─legs──────────────────────────────────────────────────────────────────────┬─errors─┬───────creationTime─┬─customer────────────┐
│ 252 │           0.1 │          1000 │                  1 │ [(252,1,'WIN',[(430,1,'WIN','SP',1436808,241272,18935,143,5,1,true)],[])] │ []     │ 1695802093.3665981 │ (1,1,'one_gbp',1,0) │
│ 253 │           0.1 │          1000 │                  1 │ [(253,1,'WIN',[(431,1,'WIN','SP',1435945,241116,18922,268,5,1,true)],[])] │ []     │ 1695806272.1980581 │ (1,1,'one_gbp',1,0) │
│ 254 │           0.1 │          1000 │                  1 │ [(254,1,'WIN',[(432,1,'WIN','SP',1435947,241116,18922,268,5,1,true)],[])] │ []     │ 1695806570.9034572 │ (1,1,'one_gbp',1,0) │
│ 255 │           0.1 │          1000 │                  1 │ [(255,1,'WIN',[(433,1,'WIN','SP',1436808,241272,18935,143,5,1,true)],[])] │ []     │  1695806939.310054 │ (1,1,'one_gbp',1,0) │
│ 256 │           0.1 │          1000 │                  1 │ [(256,1,'WIN',[(434,1,'WIN','SP',1435945,241116,18922,268,5,1,true)],[])] │ []     │ 1695808316.8749661 │ (1,1,'one_gbp',1,0) │
│ 257 │           0.1 │          1000 │                  1 │ [(257,1,'WIN',[(435,1,'WIN','SP',1435945,241116,18922,268,5,1,true)],[])] │ []     │   1695813181.35838 │ (1,1,'one_gbp',1,0) │

See how it renders: Screenshot 2023-10-09 at 17 06 06

And how I can't query it:

Screenshot 2023-10-09 at 17 06 37

atillier avatar Oct 09 '23 16:10 atillier