mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
fix: count(1) instead of count(ts) when >1 inputs (#6952)
Signed-off-by: discord9 <discord9@163.com>
This commit is contained in:
@@ -88,6 +88,10 @@ impl CountWildcardToTimeIndexRule {
|
||||
// check if the time index is a valid column as for current plan
|
||||
if let Some(col) = &col {
|
||||
let mut is_valid = false;
|
||||
// if more than one input, we give up and just use `count(1)`
|
||||
if plan.inputs().len() > 1 {
|
||||
return None;
|
||||
}
|
||||
for input in plan.inputs() {
|
||||
if input.schema().has_column(col) {
|
||||
is_valid = true;
|
||||
@@ -168,6 +172,11 @@ impl TreeNodeVisitor<'_> for TimeIndexFinder {
|
||||
return Ok(TreeNodeRecursion::Stop);
|
||||
}
|
||||
|
||||
if node.inputs().len() > 1 {
|
||||
// if more than one input, we give up and just use `count(1)`
|
||||
return Ok(TreeNodeRecursion::Stop);
|
||||
}
|
||||
|
||||
Ok(TreeNodeRecursion::Continue)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user