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

Add function: chdb() to return version #25

Merged
merged 5 commits into from
Apr 28, 2023

Conversation

lmangani
Copy link
Contributor

@lmangani lmangani commented Apr 27, 2023

This PR adds a simple chdb() function with no parameters that returns the current version of chDB as a string.
The version number is defined using the CHDB_VERSION macro, which should be defined during the build process.

The function is conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro derived from CHDB_VERSION is defined, to avoid building and registering the function if the version number is not available.

Changelog category (leave one):

  • New Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

add function chdb() returning the current build version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.
@lmangani
Copy link
Contributor Author

lmangani commented Apr 27, 2023

Tested w/ ClickHouse

Build Flag:

-DCHDB_VERSION="0.6.2"

Validation:

# docker run -ti --rm clickhouse:chdb "SELECT version()"
23.4.1.1
# docker run -ti --rm clickhouse:chdb "SELECT chdb()"
0.6.2

@lmangani lmangani marked this pull request as ready for review April 27, 2023 09:40
@lmangani lmangani changed the title WIP: add function: chdb() to return version add function: chdb() to return version Apr 27, 2023
@auxten auxten changed the title add function: chdb() to return version Add function: chdb() to return version Apr 27, 2023
@lmangani lmangani added the enhancement New feature or request label Apr 27, 2023
@lmangani lmangani requested a review from auxten April 27, 2023 16:03
@auxten auxten merged commit d958feb into chdb-io:pybind Apr 28, 2023
7 checks passed
auxten pushed a commit that referenced this pull request Jun 27, 2023
* add function: chdb() to return version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.

* Update chdbVersion.cpp

* Update chdbVersion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt
auxten pushed a commit that referenced this pull request Jun 28, 2023
* add function: chdb() to return version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.

* Update chdbVersion.cpp

* Update chdbVersion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt
auxten pushed a commit that referenced this pull request Aug 15, 2023
* add function: chdb() to return version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.

* Update chdbVersion.cpp

* Update chdbVersion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt
auxten pushed a commit that referenced this pull request Nov 9, 2023
* add function: chdb() to return version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.

* Update chdbVersion.cpp

* Update chdbVersion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt
auxten pushed a commit that referenced this pull request Jun 7, 2024
* add function: chdb() to return version

This is an example of a C++ function that returns the current version of chDB as a string. The version number is defined using the CHDB_VERSION_STRING macro, which should be defined during the build process.

The FunctionChdbVersion class is a subclass of FunctionConstantBase, which is a base class for functions that return a constant value. The FunctionChdbVersion constructor takes the CHDB_VERSION_STRING macro as an argument, which is passed to the FunctionConstantBase constructor to set the constant value of the function.

The REGISTER_FUNCTION macro is used to register the FunctionChdbVersion function with the FunctionFactory. The REGISTER_FUNCTION macro should be conditionally compiled using an #if directive that checks whether the CHDB_VERSION_STRING macro is defined, to avoid registering the function if the version number is not available.

* Update chdbVersion.cpp

* Update chdbVersion.cpp

* Update CMakeLists.txt

* Update CMakeLists.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants