risinglight icon indicating copy to clipboard operation
risinglight copied to clipboard

executor: panic on always false filter

Open skyzh opened this issue 3 years ago • 5 comments

> select * from t where 1 = 0;
thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', src/array/data_chunk.rs:53:10
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

skyzh avatar Jan 06 '22 10:01 skyzh

The panic's place changed.

> select * from t where false
thread 'tokio-runtime-worker' panicked at 'index out of bounds: the len is 0 but the index is 0', 
src/optimizer/plan_nodes/logical_projection.rs:66:25

Another issue 👇 this one is fixed in https://github.com/risinglightdb/risinglight/pull/561

>  select count(*) from t where false 
# What's this???
+-------+
| count |
+-------+
| 1     |
+-------+

xxchan avatar Feb 19 '22 13:02 xxchan

I suspect it's caused by the optimizer:

PhysicalProjection:
    InputRef #0
  PhysicalSimpleAgg:
      count(InputRef #0) -> INT
    Dummy:

The dummy executor should not return anything. However,

impl DummyScanExecutor {
    #[try_stream(boxed, ok = DataChunk, error = ExecutorError)]
    pub async fn execute(self) {
        yield DataChunk::single(0);
    }
}

skyzh avatar Feb 19 '22 13:02 skyzh

I think the dummy executor should return nothing, but it should have schema... we need give Dummy Plan Node a schema when constructing it and implement fn schema(&self) -> Vec<ColumnDesc> for it

st1page avatar Feb 19 '22 13:02 st1page

Another problem is that,

> explain select 1
PhysicalProjection:
    1
  Dummy:

Projection is relying on Dummy executor to return a value... Maybe we should use ValuesExecutor for queries like select 1?

skyzh avatar Feb 19 '22 13:02 skyzh

We can create a new issue for dummy executor

xxchan avatar Feb 19 '22 13:02 xxchan

Resolved as we already have a schema for all plan nodes.

wangrunji0408 avatar Jan 05 '23 06:01 wangrunji0408