Commit Graph

93 Commits (f234442534aa8354885347caea046a2b4b2d60dd)

Author SHA1 Message Date
Stuart Carnie f234442534
chore: some initial tests for validating column schema inference 2023-05-11 09:46:38 +10:00
Stuart Carnie 26c96b356f
chore: rename test function to avoid collisions with future tests 2023-05-11 09:46:15 +10:00
Stuart Carnie 1d837b175e
feat: add schema support to DataSource::Subquery; fix incompatibilities 2023-05-10 14:33:34 +10:00
Stuart Carnie 3c25272eeb
chore: More cleanup 2023-05-09 13:00:12 +10:00
Stuart Carnie 707a700481
chore: Remove unnecessary Result type 2023-05-09 12:59:56 +10:00
Stuart Carnie 54c063cc67
fix: field_and_dimensions doesn't error 2023-05-09 12:48:22 +10:00
Stuart Carnie 01744865b2
fix: Don't skip explicit reference to Tag fields 2023-05-09 12:47:24 +10:00
Stuart Carnie bd760330f2
feat: Initial experimental subquery support 2023-05-09 09:42:49 +10:00
Stuart Carnie 4fc5a90d60
chore: Update docs 2023-05-09 09:24:19 +10:00
Stuart Carnie 74b5c32440
refactor: Cleanup rewriter 2023-05-09 09:24:19 +10:00
Stuart Carnie e4b6a8f77a
chore: Resolve aliases for all `SELECT` queries, not just the outer 2023-05-09 09:24:18 +10:00
Stuart Carnie 9227bc032f
chore: Remove fragile `is_tag_field` API 2023-05-05 17:15:59 +10:00
Stuart Carnie 3099733de6
chore: Introduce root `SelectQuery`
This is used to gather shared state for the query vs `Select`, which
represents state for each `SELECT` statement.

First example is tracking whether a statement projects multiple
unique measurements. This changed improved one of the plans, as it
no longer needs to sort the `iox::measurement` column.
2023-05-05 16:48:27 +10:00
Stuart Carnie f026d546b0
chore: Refactor `select_statement_to_plan`
This is an improvement over the previous version, and prepares the
planner for implementing subqueries and passing schema to the
`project_select` function.
2023-05-05 13:35:32 +10:00
Stuart Carnie e7d6819602
chore: Correct docs 2023-05-05 12:25:58 +10:00
Stuart Carnie a218d97dcf
chore: Use `Select` rather than `SelectStatement` in planner 2023-05-05 12:17:15 +10:00
Stuart Carnie 03b4195976
chore: Rename TableReference to DataSource to avoid conflicts with DF 2023-05-05 11:03:56 +10:00
Stuart Carnie 8deb1832e7
chore: Expose TypeEvaluator for more efficient type evaluation 2023-05-05 10:54:45 +10:00
Stuart Carnie 7b19bf014b
chore: Reorganise `rewrite_statement` unit tests 2023-05-05 10:12:17 +10:00
Stuart Carnie 8b60a95a77
chore: Unnecessary use of `borrow` 2023-05-05 10:12:02 +10:00
Stuart Carnie f8b1d37d5a
fix: Consistent alias names with InfluxQL OG
Fixes #7750
2023-05-05 10:11:37 +10:00
Stuart Carnie 7e47d48d01
chore: SLIMIT and SOFFSET are not implemented 2023-05-05 07:48:20 +10:00
Stuart Carnie 85f461fbda
Merge branch 'main' into sgc/issue/7739_select_ir_01 2023-05-05 06:29:21 +10:00
Marco Neumann 2cfb30d5df
refactor: remove non-struct selector functions (#7743)
Clean up for #7533.
2023-05-04 10:25:52 +00:00
Stuart Carnie b47e0efc85
feat: Step 1 on N for an intermediate representation of `SELECT`
The end goal is that each `Select` node will contain a schema to be
referenced directly by the InfluxQL planner. Additionally, further
refinement of the field data types used by the `Select` node
are expected, to remove ambiguity from the planner.
2023-05-04 18:27:32 +10:00
Stuart Carnie 43baecbb1a
chore: handle aliased time column in sort expression 2023-05-03 12:04:24 +10:00
Stuart Carnie 19ea80390a
chore: ignore time column when processing SELECT 2023-05-03 11:04:54 +10:00
Stuart Carnie 91f5464375
chore: add additional tests 2023-05-03 09:23:15 +10:00
Stuart Carnie 24378bd460
chore: `time` is always present and at first position of projection 2023-05-03 07:47:14 +10:00
Stuart Carnie 89143a72fa
chore: Remove schema::Schema dependency
Subquery support cannot rely on IOx schema, as this metadata does not
propagate through DataFusion `LogicalPlan` nodes.
2023-04-28 10:08:30 +10:00
Stuart Carnie 482221a7d4
chore: Redundant attribute 2023-04-28 09:56:07 +10:00
Stuart Carnie b9024582b0
fix: Ensure InfluxQL internal errors have a distinct message
Closes #7606
2023-04-28 09:55:32 +10:00
Stuart Carnie b33b56d76a
Merge branch 'main' into sgc/issue/subquery_6891_02 2023-04-28 06:14:42 +10:00
Marco Neumann 949d131e77
refactor: only use struct-style `select` in InfluxQL planner (#7636)
* refactor: only use struct-style `select` in InfluxQL planner

For #7533 we need to track more columns apart from `time` and `value`
and having a simple variant and multiple complex ones gets overly
complicated soon. The aggregator is internally identical anyways, so
let's only use one and then pull out the struct fields that we need.

I'll also change the InfluxRPC planner to use the struct variant next,
so we have a single `select` system both in the planners and in `query_functions`.

* docs: improve

* docs: explain test

Co-authored-by: Andrew Lamb <alamb@influxdata.com>

---------

Co-authored-by: Andrew Lamb <alamb@influxdata.com>
2023-04-27 13:29:11 +00:00
Stuart Carnie 14c809f943
chore: No longer necessary, as the rewriter handles this behaviour 2023-04-27 08:09:52 +10:00
Stuart Carnie 789aab2f5d
feat: Rewriter is now smarter for subqueries
Rewriter drops `MeasurementSelection` entries from the `FROM` clause
that do not project any fields directly from a measurement. Subqueries
are an exception, such that an outer query may project only tags
from the inner subquery.
2023-04-27 08:07:40 +10:00
Stuart Carnie 44ac3ca960
chore: Better not to clone 2023-04-27 08:06:06 +10:00
Stuart Carnie a133c56a9c
feat: Evaluate data types of binary expressions (#7670)
* feat: Evaluate data types of binary expressions

This is necessary to ensure column data types of projections of a
subquery are accurately determined.

* chore: rustfmt 🧹
2023-04-26 21:05:25 +00:00
Christopher M. Wolff 2d592a0295
feat: teach parser to allow arithmetic functions (#7620)
* feat: teach parser to allow arithmetic functions

* refactor: remove unnecessary lowercasing of fn names

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-24 17:09:22 +00:00
Marco Neumann 9730c52c8a
fix: InfluxQL output sorting (#7633)
* test: remove #7513 workarounds from `issue_6112.influxql`

* fix: `SHOW TAG VALUES` output sorting

* fix: `SHOW MEASUREMENTS` output sorting

* fix: `SHOW TAG KEYS` output sorting
2023-04-24 13:37:25 +00:00
Stuart Carnie 0cc6147d6f
fix: Need to handle Regex operators
Ignoring LIKE for now as they aren't used by the InfluxQL planner
2023-04-21 13:39:34 +10:00
Stuart Carnie 7a49c3484e
feat: Documentation to describe time range behaviour 2023-04-21 09:31:54 +10:00
Stuart Carnie 79fcb9bfb9
chore: Use idiomatic initialisation
Co-authored-by: Christopher M. Wolff <chris.wolff@influxdata.com>
2023-04-21 09:25:14 +10:00
Stuart Carnie 9416fcfb88
Merge branch 'main' into sgc/issue/time_range_7610 2023-04-21 07:53:34 +10:00
Stuart Carnie b2279abb59
feat: Rewrite time range expressions to apply to entire result set 2023-04-21 07:53:19 +10:00
Marco Neumann 370413b2d2
feat: `SHOW TAG KEYS ... WHERE <condition>` (#7601)
Ref https://github.com/influxdata/idpe/issues/17474 .
2023-04-20 09:16:35 +00:00
Marco Neumann 9eac89ebfb
fix: also include metadata in empty InfluxQL select results (#7604)
At least the schema metdata and the measurements column should be there.
2023-04-20 08:12:07 +00:00
Christopher M. Wolff 7a6862ee3a
refactor: let date_bin_gapfill allow omitted origin (#7595)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-19 14:56:52 +00:00
Marco Neumann ce273b6006
feat: `SHOW MEASUREMENTS ... WHERE <condition>` (#7590)
Ref https://github.com/influxdata/idpe/issues/17474 .

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-19 08:59:54 +00:00
Marco Neumann 53abef0447
feat: `SHOW TAG VALUES ... WHERE <condition>` (#7589)
Ref https://github.com/influxdata/idpe/issues/17474 .

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-19 08:10:56 +00:00