Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sql): add auxiliary meta functions to support integration with third party library superset #3390

Merged
merged 13 commits into from
May 25, 2023

Conversation

marregui
Copy link
Contributor

@marregui marregui commented May 23, 2023

Two new functions keywords and functions to support statements such as:

SELECT name, count(name) as overrides, type FROM functions() GROUP BY name, type ORDER BY name;
SELECT * FROM keywords();

Function keywords()

Returns a list of all keywords supported by QuestDB:

keyword
======
add
all
alter
and
as
asc
asof
...

Function functions()

Returns a table with headers:

  • name: name of the function
  • signature: signature of the function, there will be one per function override
  • signature_translated: as above but human readable. It takes the signature as described by each implementation and translates the individual characters into human readable strings with prefix const if the parameter must be a constant expression.
  • runtime_constant: whether it has been declared as a runtime constant.
  • type: one of
    • PREDICATE: a boolean function as defined by FunctionFactory.
    • CURSOR: a cursor function.
    • GROUP_BY: a group by function.
    • WINDOW: a window function.
    • STANDARD: whenever it is non of the above

Example rows:

| name   | signature   | signature_translated                             | type             |
| length  | length(U)   | length(var binary)                                  | STANDARD |
...
| rnd_int | rnd_int()    | rnd_int()                                                 | STANDARD |
| rnd_int | rnd_int(iii) | rnd_int(const int, const int, const int) | STANDARD |
...

Implementation notes

I moved the construction of the FunctionFactoryCache into the CairoEngine, and simplified some signatures.

@marregui marregui self-assigned this May 23, 2023
@bziobrowski bziobrowski self-requested a review May 24, 2023 09:43
@marregui
Copy link
Contributor Author

@bziobrowski thank you for the review :) nice spot the use of a sink ;) (I suppose I did no recall that!! dirty garbage!, too long in Python hahaha)

@marregui marregui requested a review from bziobrowski May 24, 2023 17:53
@ideoma
Copy link
Collaborator

ideoma commented May 24, 2023

[PR Coverage check]

😍 pass : 201 / 220 (91.36%)

file detail

path covered line new line coverage
🔵 io/questdb/griffin/engine/functions/catalogue/KeywordsFunctionFactory.java 29 35 82.86%
🔵 io/questdb/griffin/SqlCompiler.java 8 9 88.89%
🔵 io/questdb/griffin/engine/functions/catalogue/FunctionListFunctionFactory.java 108 118 91.53%
🔵 io/questdb/griffin/FunctionFactoryDescriptor.java 47 49 95.92%
🔵 io/questdb/griffin/FunctionFactoryCache.java 4 4 100.00%
🔵 io/questdb/cairo/CairoEngine.java 3 3 100.00%
🔵 io/questdb/ServerMain.java 2 2 100.00%

Copy link
Contributor

@bziobrowski bziobrowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !

@bluestreak01 bluestreak01 merged commit 3887e66 into master May 25, 2023
20 checks passed
@bluestreak01 bluestreak01 deleted the ma/functions_function branch May 25, 2023 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants