Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Table with nested failing to load #399

Closed
dermasmid opened this issue Jun 3, 2024 · 2 comments · Fixed by #404
Closed

[BUG] Table with nested failing to load #399

dermasmid opened this issue Jun 3, 2024 · 2 comments · Fixed by #404
Labels
bug Something isn't working

Comments

@dermasmid
Copy link

Describe the bug

im seeing DESCRIBE TABLE is never supposed to return Nested type. It should always yield its Array fields directly.

heres a example table:

chi-sonic-cluster-main-0-2-0.chi-sonic-cluster-main-0-2.clickhouse.svc.cluster.local :) create table default.nested_test (s String, n Nested(x Nullable(String), y String)) engine=MergeTree order by s
CREATE TABLE default.nested_test
(
    `s` String,
    `n` Nested(x Nullable(String), y String)
)
ENGINE = MergeTree
ORDER BY s
Query id: 4966dc7b-a268-44ad-9a03-2b820bc8c579
Ok.
0 rows in set. Elapsed: 0.009 sec. 
chi-sonic-cluster-main-0-2-0.chi-sonic-cluster-main-0-2.clickhouse.svc.cluster.local :) describe table default.nested_test
DESCRIBE TABLE default.nested_test
Query id: b7454634-ae12-4c29-bcb1-0938a49398db
   ┌─name─┬─type─────────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
1. │ s    │ String                               │              │                    │         │                  │                │
2. │ n    │ Nested(x Nullable(String), y String) │              │                    │         │                  │                │
   └──────┴──────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
2 rows in set. Elapsed: 0.001 sec. 
chi-sonic-cluster-main-0-2-0.chi-sonic-cluster-main-0-2.clickhouse.svc.cluster.local :) describe table default.nested_test SETTINGS describe_include_subcolumns=1
DESCRIBE TABLE default.nested_test
SETTINGS describe_include_subcolumns = 1
Query id: 0ad77427-0548-4212-92f1-4bffdd2b7890
   ┌─name─────┬─type─────────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┬─is_subcolumn─┐
1. │ s        │ String                               │              │                    │         │                  │                │            0 │
2. │ n        │ Nested(x Nullable(String), y String) │              │                    │         │                  │                │            0 │
3. │ n.size0  │ UInt64                               │              │                    │         │                  │                │            1 │
4. │ n.x      │ Array(Nullable(String))              │              │                    │         │                  │                │            1 │
5. │ n.x.null │ Array(UInt8)                         │              │                    │         │                  │                │            1 │
6. │ n.y      │ Array(String)                        │              │                    │         │                  │                │            1 │
   └──────────┴──────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┴──────────────┘
6 rows in set. Elapsed: 0.001 sec. 

as you can see, the nested fields are being returned as well

Steps to reproduce

Expected behaviour

Error log

Configuration

Environment

  • Kafka-Connect version:
  • Kafka Connect configuration:
  • Kafka version:
  • Kafka environment:
  • OS:

ClickHouse server

  • ClickHouse Server version: 24.5
  • ClickHouse Server non-default settings, if any:
  • CREATE TABLE statements for tables involved:
  • Sample data for all these tables, use clickhouse-obfuscator if necessary
@dermasmid dermasmid added the bug Something isn't working label Jun 3, 2024
@dermasmid
Copy link
Author

turns out its because we have flatten_nested=0
heres a comparison

chi-sonic-cluster-main-0-2-0.chi-sonic-cluster-main-0-2.clickhouse.svc.cluster.local :) describe table default.nested_test_1 SETTINGS describe_include_subcolumns=1
DESCRIBE TABLE default.nested_test_1
SETTINGS describe_include_subcolumns = 1
Query id: b42e99d7-20c6-4546-b13f-6607b044a3e5
   ┌─name──────┬─type────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┬─is_subcolumn─┐
1. │ s         │ String                  │              │                    │         │                  │                │            0 │
2. │ n.x       │ Array(Nullable(String)) │              │                    │         │                  │                │            0 │
3. │ n.y       │ Array(String)           │              │                    │         │                  │                │            0 │
4. │ n.x.size0 │ UInt64                  │              │                    │         │                  │                │            1 │
5. │ n.x.null  │ Array(UInt8)            │              │                    │         │                  │                │            1 │
6. │ n.y.size0 │ UInt64                  │              │                    │         │                  │                │            1 │
   └───────────┴─────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┴──────────────┘
6 rows in set. Elapsed: 0.001 sec. 
chi-sonic-cluster-main-0-2-0.chi-sonic-cluster-main-0-2.clickhouse.svc.cluster.local :) describe table default.nested_test SETTINGS describe_include_subcolumns=1
DESCRIBE TABLE default.nested_test
SETTINGS describe_include_subcolumns = 1
Query id: 91063e89-cb93-402d-bab5-2b77ecb06adc
   ┌─name─────┬─type─────────────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┬─is_subcolumn─┐
1. │ s        │ String                               │              │                    │         │                  │                │            0 │
2. │ n        │ Nested(x Nullable(String), y String) │              │                    │         │                  │                │            0 │
3. │ n.size0  │ UInt64                               │              │                    │         │                  │                │            1 │
4. │ n.x      │ Array(Nullable(String))              │              │                    │         │                  │                │            1 │
5. │ n.x.null │ Array(UInt8)                         │              │                    │         │                  │                │            1 │
6. │ n.y      │ Array(String)                        │              │                    │         │                  │                │            1 │
   └──────────┴──────────────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┴──────────────┘
6 rows in set. Elapsed: 0.001 sec. 

@Paultagoras
Copy link
Contributor

Hmm, that's fascinating - I'll try playing around with flatten_nested a bit but we may just need to "warn" instead of error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants