Skip to content

Created struct types don't have columntype.type set #6320

Description

@snkas

Reproduction 1 (test)

cd python
uv run python -m pytest tests/platform/test_shared_pipeline.py::TestPipeline::test_pandas_struct

... will yield:

FAILED tests/platform/test_shared_pipeline.py::TestPipeline::test_pandas_struct - KeyError: 'type'

... for PR #6288

Reproduction 2 (SQL)

Create a pipeline example with SQL:

CREATE TYPE s_struct AS (
    f1 INT,
    f2 STRING
);
CREATE TABLE tbl_struct (c1 s_struct);
CREATE VIEW v_struct AS SELECT c1 FROM tbl_struct;

Visit: http://localhost:8080/v0/pipelines/example?selector=all, if you look in field program_info you'll see the following:

{
  "name": "tbl_struct",
  "case_sensitive": false,
  "fields": [
    {
      "name": "c1",
      "case_sensitive": false,
      "columntype": {
        "fields": [
          {
            "name": "f1",
            "nullable": true,
            "type": "INTEGER"
          },
          {
            "name": "f2",
            "nullable": true,
            "precision": -1,
            "type": "VARCHAR"
          }
        ],
        "nullable": true
      },
      "unused": false
    }
  ],
  "materialized": false,
  "foreign_keys": []
},

... where columntype of c1 does not contain type.

Issue

The issue is that columntype.type is not an optional field (Option<...>), but uses #[serde(default = "default_is_struct")].

Metadata

Metadata

Assignees

Labels

SQL compilerRelated to the SQL compiler

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions