Skip to content

Single column returned on "SELECT *" when named type is present #7468

Closed

Description

@philrz

Two things stand out about this result:

  1. Only a appears in the output
  2. Since it's a pure SQL query, I'm guessing there should be null instead of error
$ super -version &&
  super -f bsup -o t2.bsup -c "type foo={a:int64} values cast({a:1},foo), {b:2}" &&
  super -c "SELECT * FROM 't2.bsup'"

Version: v0.3.0-508-g4e032a368

{a:1}
{a:error("no such field a")}

Details

Repro is with super commit 4e032a3.

Without the named type, the output shows both columns.

$ super -f bsup -o t2.bsup -c "values {a:1}, {b:2}" &&
  super -c "SELECT * FROM 't2.bsup'"

{a:1,b:error("no such field b")}
{a:error("no such field a"),b:2}

With equivalent data/query, on legacy SQL systems null values are present where super put the error values above, so that seems like that may be the thing to do for SQL compatibility reasons.

$ printf '{"a":1}\n{"b":2}\n' > top.json &&
  duckdb --version && duckdb -c "SELECT * FROM 'top.json'"

v1.5.6 (Variegata) 069cc9f9b5

┌───────┬───────┐
│   a   │   b   │
│ int64 │ int64 │
├───────┼───────┤
│     1 │  NULL │
│  NULL │     2 │
└───────┴───────┘
$ clickhouse --version &&
  clickhouse local --output-format PrettyCompact -q "SELECT * FROM file('top.json')"

ClickHouse local version 26.9.15.5 (official build).

   ┌────a─┬────b─┐
1. │    1 │ ᴺᵁᴸᴸ │
2. │ ᴺᵁᴸᴸ │    2 │
   └──────┴──────┘

Activity

  1. philrz commented on Oct 13, 2026

    @philrz
    ContributorAuthor

    Here's an additional finding RE: error vs. null that may be related or may need its own issue: The same records give the expected-with-SQL-query null if the BSUP file is written from JSON instead of with values as it was done above. Starting with the t2.bsup produced in the repro above:

    $ super -version &&
      super -j t2.bsup  | super -f bsup -o t2-from-json.bsup - &&
      super -c "SELECT * FROM 't2-from-json.bsup'"
    
    Version: v0.3.0-508-g4e032a368
    
    {a:1,b:null}
    {a:null,b:2}
    
  2. added a commit that references this issue on Oct 27, 2026
    7c0f33a
  3. added a commit that references this issue on Oct 27, 2026
    2541a5e
  4. philrz commented on Oct 28, 2026

    @philrz
    ContributorAuthor

    As of commit 2541a5e, the second of the two symptoms shown above has been addressed by linked PR #7548: null values now appear in the output of the pure SQL query instead of error values.

    $ super -version &&
      super -f bsup -o t2.bsup -c "values {a:1}, {b:2}" &&
      super -c "SELECT * FROM 't2.bsup'"
    
    Version: v0.3.0-571-g2541a5e90
    
    {a:1,b:null}
    {a:null,b:2}
    

    However, for the first symptom above RE: when the named type is present, the SQL query still only returns the a values.

    $ super -f bsup -o t2.bsup -c "type foo={a:int64} values cast({a:1},foo), {b:2}" &&
      super -c "SELECT * FROM 't2.bsup'"
    {a:1}
    {a:null}
    

    So while #7548 notes that "the named type didn't turn out to be the problem", something still seems amiss, so I'll check with @mccanne.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions