Skip to content

Commit

Permalink
Add alias getbit
Browse files Browse the repository at this point in the history
  • Loading branch information
acvictor committed Apr 29, 2024
1 parent 6c0bcb4 commit f1aa4db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions velox/docs/functions/spark/bitwise.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ Bitwise Functions
The value of 'pos' argument must be between 0 and number of bits in 'x' - 1.
Invalid 'pos' values result in an error.

.. spark:function:: getbit(x, pos) -> tinyint
This is an alias for ``bit_get(x, pos)``.

.. spark:function:: shiftleft(x, n) -> [same as x]
Returns x bitwise left shifted by n bits. Supported types for 'x' are INTEGER and BIGINT.
Expand Down
8 changes: 4 additions & 4 deletions velox/functions/sparksql/Bitwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ void registerBitwiseFunctions(const std::string& prefix) {
registerFunction<BitCountFunction, int32_t, int64_t>({prefix + "bit_count"});

registerFunction<BitGetFunction, int8_t, int8_t, int32_t>(
{prefix + "bit_get"});
{prefix + "bit_get", prefix + "getbit"});
registerFunction<BitGetFunction, int8_t, int16_t, int32_t>(
{prefix + "bit_get"});
{prefix + "bit_get", prefix + "getbit"});
registerFunction<BitGetFunction, int8_t, int32_t, int32_t>(
{prefix + "bit_get"});
{prefix + "bit_get", prefix + "getbit"});
registerFunction<BitGetFunction, int8_t, int64_t, int32_t>(
{prefix + "bit_get"});
{prefix + "bit_get", prefix + "getbit"});

registerFunction<ShiftLeftFunction, int32_t, int32_t, int32_t>(
{prefix + "shiftleft"});
Expand Down

0 comments on commit f1aa4db

Please sign in to comment.