Giter VIP home page Giter VIP logo

mabel-dev / opteryx Goto Github PK

View Code? Open in Web Editor NEW
45.0 5.0 10.0 319.73 MB

🦖 A SQL-on-everything Query Engine you can execute over multiple databases and file formats. Query your data, where it lives.

Home Page: https://opteryx.dev

License: Apache License 2.0

Python 96.58% Rust 0.34% Makefile 0.07% Cython 3.02%
python sql analytics big-data serverless sql-engine arrow cloud-run cloud-native query-engine

opteryx's Issues

[FEATURE] Support $PARTITION hints

SELECT * FROM $satellites WHERE $PARTITION.username('green')

This would instruct the engine to try (it can ignore if it wants to) to prune the by_username partitioning to the username=green partition.

WC 07-FEB

  • SQL HAVING
  • SQL ORDER BY
  • $DATE Filters - not ready to start

WC 28-FEB

  • Sample dataset with lists and structs

[FEATURE] (sources) Execution plan DAG

The current DAG allows for an arbitrary set of unordered in coming edges, which means the planner can't include planning order or left/right nodes. This should be rewritten to have an order to the incoming edges (but not all nodes need to care)

Where Query planners are currently passed to nodes, these should be relations to other nodes.

The Node execution start at the final node and pull chunks through the DAG.

[FEATURE] Planner should plan the reads rather than the Reader

The Planner should plan the reads, including which portions to read and which selections and projections to push down to the reader operator.

This should then be described in JSON (or similar), so it can be hashed and used to persist partial reads to enable caching of 'results'

[FEATURE] ephemeral tables (VALUES)

SELECT *
FROM (VALUES (1,2),(3,4),(340,455)) AS t(a,b)

Allow tables to be defined in the SQL which don't need to be backed by a on disk dataset.

The will be useful for small look ups, e.g. to order by an ordinal field like HIGH, MEDIUM, LOW, or to unify nomenclature like TRUE, YES, ON

[FEATURE] JOINS

  • CROSS JOIN
  • JOIN
  • INNER JOIN _ ON
  • INNER JOIN _ USING
  • LEFT JOIN _ ON _

[BUG] RANDOM should be between 0 and 1, not 0 and 1000

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots or Logs
If applicable, add screenshots or logs to help explain your problem.
!! Be aware not to publish any sensitive information in what you upload.

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

[FEATURE] Reader should support mabel by_ segments (basic support)

Thanks for stopping by to let us know something could be better!

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Conversion to list of Dicts is too slow for practical use

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots or Logs
If applicable, add screenshots or logs to help explain your problem.
!! Be aware not to publish any sensitive information in what you upload.

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

[FEATURE] Improve Performance of ORDER BY RANDOM()

This currently works by assigning a random number to each row and then sorting by the new column, what would probably be faster is creating a 0..n list, where n is the number of rows, shuffling this list and then using .take() to get the shuffled rows (in chunks)

✨ support UNION statements

UNION wil likely require changes to the parser as it may need to dynamically get the statement being worked on from a list, rather than hard-coded to 0

[FEATURE] standardize temporal queries

https://www.sqlshack.com/temporal-tables-in-sql-server/

The FOR SYSTEM_TIME clause has many variations and options. It is further classified into four temporal sub-clauses. This provides a way to query the data across current and history tables.

AS OF
FROM TO
BETWEEN AND
CONTAINED IN ( , )
ALL

The AS OF clause is used when there is a need to rebuild the original state of the data and need to know the state it was at any specific time in the past. This is possible by specifying the date time as its input.

[FEATURE] Subqueries

Support for table subqueries is a MUST

SELECT results.account
FROM (SELECT * FROM Players) AS results;

Support for SELECT is a could

SELECT account, (SELECT mascot FROM Guilds WHERE Players.guild = id) AS player_mascot
FROM Players;

support for IN is a should

SELECT account
FROM users
WHERE account IN (SELECT account FROM billing WHERE paid = true)

[FEATURE] table aliases

  • FROM table AS name

need to be able to SELECT, WHERE, ORDER and GROUP on the columns using either the aliases or the original names.

projection should result in unambiguous names, but not be just adding the prefixes to the column names

[FEATURE] (sources) scan planning

Move the scan planning to the init for the scanner.

This will allow us to access the expected rows and other statistics when optimizing.

We can then use the expected rows to determine which dataset to hold in memory when joining.

This should be the information returned by DESCRIBE dataset which means changes to the writer to record more information.

Per column

Name
Type
Nulls?
Unique
Min
Max
Description

The Planner should plan the reads, including which portions to read and which selections and projections to push down to the reader operator.

This should then be described in JSON (or similar), so it can be hashed and used to persist partial reads to enable caching of 'results'

[FEATURE] Documentation

Some documentation has typos, is incomplete or incorrect.

Documentation is in different formats and isn't in the desired structure

[BUG] GROUP BY should split by the column, if if it's not in the projection

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behaviour
A clear and concise description of what you expected to happen.

Screenshots or Logs
If applicable, add screenshots or logs to help explain your problem.
!! Be aware not to publish any sensitive information in what you upload.

Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

[FEATURE] Support ORDER BY RANDOM()

Thanks for stopping by to let us know something could be better!

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

[FEATURE] struct and list access

SELECT Birth_Place['state'] FROM $astronauts

"projection": [
            {
              "UnnamedExpr": {
                "MapAccess": {
                  "column": {
                    "Identifier": {
                      "value": "Birth_Place",
                      "quote_style": null
                    }
                  },
                  "keys": [
                    {
                      "Value": {
                        "SingleQuotedString": "state"
                      }
                    }
                  ]
                }
              }
            }
          ]

SELECT Misions[0] FROM $astronauts

"MapAccess": {
                  "column": {
                    "Identifier": {
                      "value": "Misions",
                      "quote_style": null
                    }
                  },
                  "keys": [
                    {
                      "Value": {
                        "Number": [
                          "0",
                          false
                        ]
                      }
                    }

[FEATURE] Temporal clauses should be localized

FOR clauses should be specific to the context, for example

SELECT event
FROM log
FOR TODAY
WHERE event NOT IN 
   (
    SELECT event
    FROM log
    FOR YESTERDAY
    )

This will need an alternate implementation to the RegEx based one.

[FEATURE] non SELECT queries

> show tables;
+---------------+--------------------+------------+------------+
| table_catalog | table_schema       | table_name | table_type |
+---------------+--------------------+------------+------------+
| datafusion    | public             | t          | BASE TABLE |
| datafusion    | information_schema | tables     | VIEW       |
+---------------+--------------------+------------+------------+
> show columns from t;
+---------------+--------------+------------+-------------+-----------+-------------+
| table_catalog | table_schema | table_name | column_name | data_type | is_nullable |
+---------------+--------------+------------+-------------+-----------+-------------+
| datafusion    | public       | t          | a           | Int32     | NO          |
| datafusion    | public       | t          | b           | Utf8      | NO          |
| datafusion    | public       | t          | c           | Float32   | NO          |
+---------------+--------------+------------+-------------+-----------+-------------+

✨ Support for CTEs (with statements)

WITH x AS (SELECT a, MAX(b) AS b FROM t GROUP BY a)
SELECT a, b FROM x;

Initial design

Execute first, then keep the result in memory. Include in the subsequent queries as a LITERAL_TABLE.

This would probably work with a new reader (literal_tabel_reader), which would also need to be added to the factory.

[FEATURE] Use inbuilt AST features

NOT DONE =>

    /// SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])
    Substring {
        expr: Box<Expr>,
        substring_from: Option<Box<Expr>>,
        substring_for: Option<Box<Expr>>,
    },
SELECT TRIM('#! ' FROM '    #SQL Tutorial!    ') AS TrimmedString;
    /// TRIM([BOTH | LEADING | TRAILING] <expr> [FROM <expr>])\
    /// Or\
    /// TRIM(<expr>)
    Trim {
        expr: Box<Expr>,
        // ([BOTH | LEADING | TRAILING], <expr>)
        trim_where: Option<(TrimWhereField, Box<Expr>)>,
    },

DONE =>

    /// EXTRACT(DateTimeField FROM <expr>)
    Extract {
        field: DateTimeField,
        expr: Box<Expr>,
    },
    /// TRY_CAST an expression to a different data type e.g. `TRY_CAST(foo AS VARCHAR(123))`
    //  this differs from CAST in the choice of how to implement invalid conversions
    TryCast {
        expr: Box<Expr>,
        data_type: DataType,
    },

✨ support CASE statements

In order to have actual utility, the SQL engine needs some code constructs, CASE statements should be convertible to a UDF function which we can run in the eval step.

[FEATURE] support `CROSS JOIN` and `UNNEST`

This allows columns that are arrays, like a list of references, to be filtered on like this:

SELECT * FROM findings CROSS JOIN UNNEST(cves) as cve WHERE cve = 'CVE-2017-0144

or implied CROSS JOIN like this:

SELECT * FROM findings, UNNEST(cves) as cve WHERE cve = 'CVE-2017-0144

see:
https://medium.com/firebase-developers/using-the-unnest-function-in-bigquery-to-analyze-event-parameters-in-analytics-fb828f890b42

SELECT * FROM UNNEST(['foo', 'bar', 'baz', 'qux', 'corge', 'garply', 'waldo', 'fred']) AS element

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.