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

sql: Missing get_bit and set_bit functions #45851

Closed
andy-kimball opened this issue Mar 8, 2020 · 6 comments · Fixed by #46380
Closed

sql: Missing get_bit and set_bit functions #45851

andy-kimball opened this issue Mar 8, 2020 · 6 comments · Fixed by #46380
Assignees
Labels
A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) good first issue

Comments

@andy-kimball
Copy link
Contributor

Repro:

root@:26257/defaultdb> SELECT get_bit(B'0101011000100', 10);
ERROR: unknown function: get_bit()
root@:26257/defaultdb> SELECT set_bit(B'0101011000100100', 15, 1);
ERROR: unknown function: set_bit()
@jordanlewis jordanlewis added A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) labels Mar 8, 2020
@sandyleo26
Copy link

happy to take a shot at it. Could i have some pointers on where to start? thanks.

@abhishek20123g
Copy link
Contributor

Hi @sandyleo26
If haven't started working on this issue you can leave upto me as I had completed get_bit and started working on set_bit

For creating bultiin function you have to write definition in pkg/sql/sem/builtin/builtins.go here you can look into all other builtin function which were previously created.
Sorry @sandyleo26 if I caused any inconveniences.

@sandyleo26
Copy link

Sorry @sandyleo26 if I caused any inconveniences.

no i haven't. i guess i'll wait for another chance. thanks for your pointer anyway.

@abhishek20123g
Copy link
Contributor

Hii @sandyleo26 ,
You can take look in issue #45848 and #45849 they are also alike like them

@sandyleo26
Copy link

Hii @sandyleo26 ,
You can take look in issue #45848 and #45849 they are also alike like them

thanks a lot. just submit my claim on them. it's pretty late here so will do them tmr.

abhishek20123g added a commit to abhishek20123g/cockroach that referenced this issue Mar 10, 2020
Resolve cockroachdb#45851

This commit adds builtin functions get_bit() and set_bit(),
along with thier respective testcases.

Characteristics of the above functions are:
    * get_bit() allows us to extract a particular bit from
      a given array of bits.
    * set_bit() will enable us to modify a specific bit in
      a given array of bits.

Release note: This PR is introduced to add get_bits() and
set_bit() builtin functions.
@abhishek20123g
Copy link
Contributor

Facing problem as mentioned in #45976

abhishek20123g added a commit to abhishek20123g/cockroach that referenced this issue Mar 12, 2020
Resolve cockroachdb#45851

This commit adds builtin function get_bit() and set_bit(),
along with thier respective testcases.

Characteristics of the above builtin functions are:
    * get_bit() allows us to extracts a bit at given index in
      the bit array.
    * set_bit() enable us updates a bit at given index in the
      bit array.

Release justification: first good issue, adding builtin functions.

Release note (sql change): This PR is introduced to add get_bits()
and set_bit() builtin functions.
abhishek20123g added a commit to abhishek20123g/cockroach that referenced this issue Mar 18, 2020
refs cockroachdb#45851

This commit adds builtin function get_bit() and set_bit() for varbits,
along with thier respective testcases.

Characteristics of the above builtin functions are:
    * get_bit() allows us to extracts a bit at given index in
      the bit array.
    * set_bit() enable us updates a bit at given index in the
      bit array.

Release justification: low-risk addition of builtin functions.

Release note (sql change): This PR is introduced to add get_bits()
and set_bit() builtin functions for bits.
craig bot pushed a commit that referenced this issue Mar 18, 2020
45957: sql: add get_bit() and set_bit() builtin functions for bits r=otan a=abhishek20123g

refs #45851

This commit adds builtin function get_bit() and set_bit() for varbits,
along with thier respective testcases.

Characteristics of the above builtin functions are:
    * get_bit() allows us to extracts a bit at given index in
      the bit array.
    * set_bit() enable us updates a bit at given index in the
      bit array.

Release justification: Release justification: low-risk addition of builtin functions.

Release note (sql change): This PR is introduced to add get_bits()
and set_bit() builtin functions for bits.

46193: importccl: Do not crash when missing table definition. r=miretskiy a=miretskiy

Fixes #41731

Do not crash when running "IMPORT TABLE _ CREATE USING (_)...." when
the external file, which supposed to contain table definition, does
not contain table definition.

Release notes (bug fix): Fix crash when importing table without
table definition.

Release justification: A low/no-impact bug fix.

46228: logictest: move notice tests from .tcl to `noticetrace` logictest r=rohany a=otan

Adding a notice to test_notice.tcl will not scale as we add more
notices. Taking inspiration from `kvtrace`, we add a new `noticetrace`
mode to the logic test that only compares the notices that appear in the
given statement/query. This allows easier testing in the future.

Release justification: non-production code changes

Release note: None

Co-authored-by: abhishek20123g <[email protected]>
Co-authored-by: Yevgeniy Miretskiy <[email protected]>
Co-authored-by: Oliver Tan <[email protected]>
abhishek20123g added a commit to abhishek20123g/cockroach that referenced this issue Mar 20, 2020
…array.

Fixes cockroachdb#45851

This commit modified get_bit and set_bit to allow them to support
byte array along with their respective testcases.

Release justification: low-risk change to existing functionality.

Release note (sql change): This PR is modified get_bits()
and set_bit() functions to allow them support byte array.
craig bot pushed a commit that referenced this issue Mar 20, 2020
46380: sql: allow get_bit() and set_bit() builtin functions to support byte array r=otan a=abhishek20123g


Fixes #45851

This commit modified get_bit and set_bit to allow them to support
byte array along with their respective testcases.

Release justification: low-risk change to existing functionality.

Release note (sql change): This PR is modified get_bits()
and set_bit() functions to allow them support byte array.

Co-authored-by: abhishek20123g <[email protected]>
@craig craig bot closed this as completed in 7f44702 Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-builtins SQL built-in functions and semantics thereof. C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) good first issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants