Skip to content

Implement get() to get a value#16

Merged
kou merged 1 commit into
groonga:mainfrom
abetomo:get
Jul 15, 2026
Merged

Implement get() to get a value#16
kou merged 1 commit into
groonga:mainfrom
abetomo:get

Conversation

@abetomo

@abetomo abetomo commented Jul 13, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings July 13, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a public get(id) API for tables and columns, backed by a new internal Groonga value-fetch implementation and Python type conversion, and extends tests to validate the behavior.

Changes:

  • Add get() to Table and Column to retrieve previously set() values.
  • Implement _get_value() and bulk-to-Python conversion in Object using grn_obj_get_value().
  • Add tests covering get() for table values, scalar columns, and “no data” defaults.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testing/test_table.py Adds an assertion that Table.set() values can be retrieved via Table.get().
testing/test_column.py Adds Column.get() assertions for multiple scalar types and default/no-data cases.
grnpy/table.pyx Exposes Table.get(id) that delegates to _get_value.
grnpy/column.pyx Exposes Column.get(id) that delegates to _get_value.
grnpy/object.pyx Implements _get_value() via grn_obj_get_value() and converts Groonga bulk values to Python types.
grnpy/object.pxd Exposes _get_value() and _bulk_to_python() to Cython.
grnpy/grnpy_obj.h Adds C helper declarations for initializing/inspecting bulk objects.
grnpy/grnpy_obj.c Implements C helpers for bulk init/domain/head/size.
grnpy/grn_type.pxd Adds Groonga domain/type constants used for bulk conversion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread grnpy/object.pyx
Comment thread grnpy/object.pyx Outdated
Comment thread grnpy/grnpy_obj.c Outdated
Comment thread grnpy/grnpy_obj.c Outdated
Comment thread grnpy/grnpy_obj.c Outdated
Comment thread grnpy/object.pyx Outdated
Comment thread grnpy/object.pyx Outdated
Comment thread grnpy/object.pyx Outdated
@abetomo
abetomo marked this pull request as draft July 14, 2026 11:50
@abetomo
abetomo force-pushed the get branch 2 times, most recently from efc90b5 to b35b815 Compare July 15, 2026 02:37
@abetomo
abetomo marked this pull request as ready for review July 15, 2026 02:38
Comment thread grnpy/object.pyx Outdated
import grnpy.initializer

cdef extern from "stdbool.h":
ctypedef bint c_bool "bool"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you explain this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we simply use bool, it will be treated as Python's bool and cause an error.
We're using it by giving C's bool an alias.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need to use ctypedef not cimport here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Since there is no .pxd file like there is for stdint, using ctypedef instead.

$ ls /opt/venv/lib/python3.10/site-packages/Cython/Includes/libc/stdint.pxd
/opt/venv/lib/python3.10/site-packages/Cython/Includes/libc/stdint.pxd
$ ls /opt/venv/lib/python3.10/site-packages/Cython/Includes/libc/stdbool.pxd
ls: cannot access '/opt/venv/lib/python3.10/site-packages/Cython/Includes/libc/stdbool.pxd': No such file or directory

@kou
kou merged commit 07a2671 into groonga:main Jul 15, 2026
5 checks passed
@abetomo
abetomo deleted the get branch July 15, 2026 05:57
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.

3 participants