apla / node-clickhouse

Yandex ClickHouse driver for nodejs
MIT License
217 stars 50 forks source link

result is empty when using union all sql #52

Closed peaksnail closed 4 years ago

peaksnail commented 4 years ago

hi

I execute this sql

select a from table1
union all 
select a from table2

the result will be empty and has no meta field in result

but I execute sql

select * from (
  select a from table1
  union all 
  select a from table2
)

it works

bug or something wrong I handle?

thanks

nezed commented 4 years ago

Looks like its a http interface behavior, but ill do some checks on it later

nezed commented 4 years ago

Tried again on docker image yandex/clickhouse-client@20.3.5.21

    ch.querying(`
        SELECT number FROM system.numbers LIMIT 1
        UNION ALL
        SELECT number FROM system.numbers LIMIT 1, 3
    `).then(console.log, console.error)

and got

{ meta: [ { name: 'number', type: 'UInt64' } ],
  data: [ [ '0' ], [ '1' ], [ '2' ], [ '3' ] ],
  rows: 4,
  rows_before_limit_at_least: 5,
  statistics: { elapsed: 0.000090206, rows_read: 5, bytes_read: 40 },
  transferred: 254 }

Looks like it was bug in clickhouse itself. Closing for now, but feel free to reopen if you still experiencing this issue