risinglight
risinglight copied to clipboard
executor: support `select count(1) from table`
related discussion: https://github.com/risinglightdb/risinglight/discussions/503
> select count(1) from t1;
thread 'tokio-runtime-worker' panicked at 'no column to iterate', src/storage/secondary/rowset/rowset_iterator.rs:40:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
We definitely need to consider row_handler as a normal column in optimizer, so as to support this case...
What is the expected result for count(1)? and the difference compared with count(*)?
Should be the same as count(*)
in the current framework. Only in edge cases will it be different from count(*)
(after we have sub-query)
Seems that it is supported while select count(*) from table
is not supported, or are there any misoperations?
> select count(1) from pg_catalog.contributors;
+-------+
| count |
+-------+
| 30 |
+-------+
in 0.005s
> select count(*) from pg_catalog.contributors;
thread 'tokio-runtime-worker' panicked at 'index out of bounds: the len is 0 but the index is 0', src/optimizer/plan_nodes/internal.rs:67:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'failed to join query thread: JoinError::Panic(Id(30), ...)', src/main.rs:126:23
`
That's probably a bug. Count star is hard 😇
This issue will be fixed by #728 in the new planner.