influxdata / influxdata/influxdb

sub query is not working as expected when there where clause in sub query and outer query

Open
#24,089 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
List the minimal actions needed to reproduce the behavior.

1. I am using influx-db plugin in jenkins which pushes build related data to influx db
2. in jenkins_data table I want success builds count of particular job name test1 in last 15 builds
3. I have used below query but its giving weird results

```
select count(build_number) FROM (SELECT * FROM "jenkins_data" WHERE ("project_name" =~ /^(?i)(test1)$/ AND "project_path" =~ /.*(?i)Test.*$/) ORDER BY time DESC LIMIT 15) WHERE ("build_result" = 'SUCCESS') ORDER BY time DESC
```
__Expected behavior:__
It should get me count of successful builds in last 15 builds of test1

__Actual behavior:__
Getting some other value not sure about what logic is used

__Environment info:__

Influx db is running a k8s pod and version InfluxDB v1.8.6 (git: 1.8 v1.8.6)

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or entry points are mentioned. Start by reproducing the InfluxQL query against InfluxDB v1.8.6 with the Jenkins data, then trace the subquery, WHERE, ORDER BY, and LIMIT behavior; done means the result counts successful builds among the latest 15 matching records.

Written by the indexing model from the issue text.

Assessment

Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.