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

build() function to return the database build info #2909

Closed
killme2008 opened this issue Dec 12, 2023 · 2 comments
Closed

build() function to return the database build info #2909

killme2008 opened this issue Dec 12, 2023 · 2 comments
Assignees
Labels
C-feature Category Features C-user-experience Category User Experience good first issue Good for newcomers help wanted Extra attention is needed

Comments

@killme2008
Copy link
Contributor

What problem does the new feature solve?

It's better to have an SQL function build that returns the database build info, for example:

mysql> select build()\G;

branch: develop
commit: fe2fc723bc19f37060b15625d363473f1f5bca10
version: 0.4.4

The result may be the same as greptime --version outputs.

pub fn setup_git_versions() {

What does the feature do?

An SQL function to return the database build info.

Implementation challenges

Learn how to write a function:

https://github.com/GreptimeTeam/greptimedb/blob/develop/src/common/function/src/scalars/math/rate.rs

@killme2008 killme2008 added good first issue Good for newcomers help wanted Extra attention is needed C-feature Category Features C-user-experience Category User Experience labels Dec 12, 2023
@Dysprosium0626
Copy link
Contributor

The idea maybe implement Function for something like BuildFunction and get info from build_data and register it in the FunctionRegistry. Then add something in the planner. Maybe I can have a try?

@killme2008
Copy link
Contributor Author

The idea maybe implement Function for something like BuildFunction and get info from build_data and register it in the FunctionRegistry. Then add something in the planner. Maybe I can have a try?

Yes.

I think we can add a new mod system for these administrator functions.

Register functions refer to:

MathFunction::register(&function_registry);

Dysprosium0626 added a commit to Dysprosium0626/greptimedb that referenced this issue Dec 12, 2023
build() function to return the database build info GreptimeTeam#2909
github-merge-queue bot pushed a commit that referenced this issue Dec 13, 2023
* feat: add build function and register it

build() function to return the database build info #2909

* refactor: fix typos and change code structure

* test: add test for build()

* refactor: cargo fmt and eliminate warnings

* Apply suggestions from code review

Co-authored-by: Weny Xu <wenymedia@gmail.com>

* refactor: move system.sql to a new directory

---------

Co-authored-by: Weny Xu <wenymedia@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category Features C-user-experience Category User Experience good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants