Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
c427c2f
TODO. just starting this to mark where things should go
juliannguyen4 Mar 23, 2026
936d87e
Update C client to test Sam's changes.
juliannguyen4 Mar 24, 2026
41bb4ac
Merge remote-tracking branch 'origin/dev' into CLIENT-4436-path-expre…
juliannguyen4 Mar 24, 2026
521a2cc
Since as_cdt_ctx_add_map_keys_in takes in as_list*, make sure our arg…
juliannguyen4 Mar 24, 2026
11e80fa
Fix c client not compiling. TODO need to expose new expressions from …
juliannguyen4 Mar 25, 2026
b1491cc
Refactor get_cdt_ctx code by moving each cdt_ctx conversion in a sepa…
juliannguyen4 Mar 25, 2026
86f7f3f
Rename labels to be more helpful
juliannguyen4 Mar 25, 2026
85a897c
ditto
juliannguyen4 Mar 25, 2026
7dcdb43
Fix map_keys_in ctx
juliannguyen4 Mar 25, 2026
9cbdf84
Fix C client build error
juliannguyen4 Mar 25, 2026
c509709
Fix compile error
juliannguyen4 Mar 25, 2026
5db3513
Add InList expression
juliannguyen4 Mar 25, 2026
8b4c7a5
Fix redefinition error.
juliannguyen4 Mar 25, 2026
f9b7e3f
Add MapKeys and MapValues expressions.
juliannguyen4 Mar 25, 2026
fa589b9
Fix compile time error
juliannguyen4 Mar 25, 2026
5f018f3
Fix regression and segv
juliannguyen4 Mar 25, 2026
84b31a2
Add useful comment
juliannguyen4 Mar 25, 2026
be825c8
Remove unnecessary goto
juliannguyen4 Mar 25, 2026
340cce5
Cleanup
juliannguyen4 Mar 25, 2026
d3b77d2
Fix naming of and_filter(). Finish tests for all new cdt_ctx elements…
juliannguyen4 Mar 25, 2026
2d04973
Fix. Not sure how I missed this
juliannguyen4 Mar 25, 2026
32d3e5b
Rename to be consistent with C client and PRD
juliannguyen4 Mar 25, 2026
82eca3c
Add test cases for MapGetKey and MapGetValue expressions
juliannguyen4 Mar 25, 2026
3efc4b9
Fix test syntax.
juliannguyen4 Mar 25, 2026
436fd39
Add 2 way cross reference between cdt_ctx_map_keys_in and cdt_ctx_and…
juliannguyen4 Mar 25, 2026
50e2e30
Just rename these parameters to something less confusing. Also fix co…
juliannguyen4 Mar 25, 2026
22328b8
Clear up
juliannguyen4 Mar 25, 2026
f574233
Fix
juliannguyen4 Mar 25, 2026
459adbb
C client's stage now has the path expression enhancements
juliannguyen4 Mar 26, 2026
eea1388
Do first pass of code review. Add more negative test cases.
juliannguyen4 Mar 26, 2026
4067e50
Second round of code polish / test fixes
juliannguyen4 Mar 26, 2026
b52f4fb
Fix segv
juliannguyen4 Mar 26, 2026
07f9848
Fix tuple syntax
juliannguyen4 Mar 26, 2026
31892c2
Add fixture to check server version and expect an exception or not ba…
juliannguyen4 Mar 26, 2026
c9fbe81
Test cases for path expressions need to inherit from requires_server_…
juliannguyen4 Mar 26, 2026
e3eab58
Fix fixture syntax.
juliannguyen4 Mar 26, 2026
0a1405e
Negative test cases don't pass parameters down to the requires_server…
juliannguyen4 Mar 26, 2026
d823968
Fix test regression. Probably better to make this a module constant s…
juliannguyen4 Mar 27, 2026
339cc61
Fix test regression because we removed this section of code
juliannguyen4 Mar 27, 2026
65469c9
Make tests more resilient to map keys being out of order. By default …
juliannguyen4 Mar 27, 2026
9fefe69
Fix syntax in test
juliannguyen4 Mar 27, 2026
b6a9ee9
Just noticed aerospike_helpers list expressions cannot take in a pyth…
juliannguyen4 Mar 27, 2026
de51cc8
Fix bad syntax where using sorted(dict) converts the results to a lis…
juliannguyen4 Mar 27, 2026
163e903
Remove unused imports (flake8 needs to automate this). Fix two remain…
juliannguyen4 Mar 27, 2026
ca4f4a1
Fix test case
juliannguyen4 Mar 27, 2026
6bff3bd
In Python you can't sort a list with different types (this is differe…
juliannguyen4 Mar 27, 2026
b66e32a
This can go wrong further down the line. Getting an invalid map_order…
juliannguyen4 Mar 30, 2026
03f61cc
Clear up why we have hasattr check
juliannguyen4 Mar 31, 2026
d119ce5
Clear up
juliannguyen4 Mar 31, 2026
0354312
Review and revise test_path_expressions.py
juliannguyen4 Mar 31, 2026
a259122
Add cross references from select/modify by path operations/expression…
juliannguyen4 Mar 31, 2026
d8f6814
Fix rst syntax for headers..
juliannguyen4 Mar 31, 2026
173d572
Fix doc
juliannguyen4 Apr 1, 2026
6440734
artifact.aerospike.io may not need credentials
juliannguyen4 Apr 1, 2026
836cf81
Add input for all test workflows on whether to log in with credential…
juliannguyen4 Apr 1, 2026
fb08a97
Fix ci/cd not deploying the server from the correct registry / image …
juliannguyen4 Apr 1, 2026
9f151ac
Try pulling artifact.aerospike.io docker images with oidc credentials…
juliannguyen4 Apr 1, 2026
2782d3c
Fix composite action since its not able to access vars. TODO should d…
juliannguyen4 Apr 1, 2026
ee041e4
Only single quoted strings allowed in github actions expressions
juliannguyen4 Apr 1, 2026
72b3560
Fix workflow syntax
juliannguyen4 Apr 1, 2026
7cebf60
Fix insufficient permissions
juliannguyen4 Apr 1, 2026
9db8d8b
Move permissions to top level so both cibuildwheel and self hosted jo…
juliannguyen4 Apr 1, 2026
b2a0065
Merge remote-tracking branch 'origin/dev' into CLIENT-4436-path-expre…
juliannguyen4 Apr 2, 2026
654b95a
Get smoke tests to run with server 8.1.2 RC. Right now we cannot pull…
juliannguyen4 Apr 2, 2026
ee464d9
Add image-name input. The JFrog Docker-type repo doesn't use aerospik…
juliannguyen4 Apr 2, 2026
26a56a7
Fix permissions
juliannguyen4 Apr 2, 2026
76be55b
Merge remote-tracking branch 'origin/dev' into CLIENT-4436-path-expre…
juliannguyen4 Apr 2, 2026
1e45024
I think this was why...
juliannguyen4 Apr 2, 2026
30aea22
We only need to pull the custom manylinux image..
juliannguyen4 Apr 2, 2026
2a8b254
Fix one test due to dict not being sortable with int.
juliannguyen4 Apr 2, 2026
0cc8487
When building locally on macOS with -Werror, there is a compiler erro…
juliannguyen4 Apr 2, 2026
a37d625
Change api spec - and_filter() cannot be chained or follow all_childr…
juliannguyen4 Apr 3, 2026
bac576e
Make sure this branch has all the ci/cd changes from CLIENT-4000
juliannguyen4 Apr 3, 2026
f12118c
Fix smoke tests failing because we don't log in to get latest server …
juliannguyen4 Apr 3, 2026
c757668
Fix smoke tests failing on pull request trigger
juliannguyen4 Apr 3, 2026
201004a
Remove last references of docker hub credentials.
juliannguyen4 Apr 3, 2026
869cdf3
Just make QE_DOCKER_REGISTRY_URL required to ensure it doesn't fail o…
juliannguyen4 Apr 3, 2026
f4cd7b3
Rename fixture to be more specific. New server features can pass on o…
juliannguyen4 Apr 3, 2026
d560b00
Treat test_cdt_ctx_all_children_with_filter_then_and_filter passing o…
juliannguyen4 Apr 3, 2026
b5e7155
Update lowest supported server version to 7.1 (per aerospike website)…
juliannguyen4 Apr 4, 2026
c24e5b3
Just revert since server 7.1 causes a bunch of ServerErrors with mess…
juliannguyen4 Apr 6, 2026
af31e62
Just disable lowest_supported_server_version test for now. I plan to …
juliannguyen4 Apr 6, 2026
c1bc828
Remove unhelpful sentence since cdt_ctx_map_keys_in isn't meant to re…
juliannguyen4 Apr 6, 2026
d0cd37e
Address 2 out of 5 test failures
juliannguyen4 Apr 6, 2026
699284f
Fix incorrect test case.
juliannguyen4 Apr 6, 2026
3a26bfc
Fix another test failure. TODO 1 left
juliannguyen4 Apr 6, 2026
38e1773
Just skip for now. Need to run dev tests
juliannguyen4 Apr 6, 2026
c2d59f4
Provide id-token access for all workflows that call run-ee-server act…
juliannguyen4 Apr 6, 2026
a0a54f6
Try updating jfrog cli to fix self hosted windows failing to create o…
juliannguyen4 Apr 6, 2026
4050f85
Fix invalid version..
juliannguyen4 Apr 6, 2026
9cae50d
Fix calling workflows limiting the permissions of called workflows
juliannguyen4 Apr 6, 2026
097a231
Allow manylinux wheels to be built
juliannguyen4 Apr 6, 2026
1466995
build-artifacts.yml isn't resetting the default permissions, so not s…
juliannguyen4 Apr 6, 2026
53482e9
Check if as_exp_compile() fails. There are some codepaths where it ca…
juliannguyen4 Apr 6, 2026
afeb831
Undo xfail marker. Noticed this can suppress any exception
juliannguyen4 Apr 6, 2026
ce150e9
pull c client to address InList expression bug where it does not acce…
juliannguyen4 Apr 7, 2026
249413d
Fix syntax, since as_exp_in_list doesn't convert _list to as_exp_val …
juliannguyen4 Apr 7, 2026
4940833
Point C client back to stage now that it has the in_list segv fix
juliannguyen4 Apr 8, 2026
81b278e
Fix flawed logic - if artifact.aerospike.io is passed as registry nam…
juliannguyen4 Apr 8, 2026
fc0925d
Sam already fixed this
juliannguyen4 Apr 8, 2026
4a823f5
Document more restrictions for cdt_ctx_and_filter as discussed in Sla…
juliannguyen4 Apr 8, 2026
d65f933
Fix bad syntax...
juliannguyen4 Apr 8, 2026
affddd3
Not sure why this got removed :p
juliannguyen4 Apr 8, 2026
807fb09
May be a test problem
juliannguyen4 Apr 8, 2026
34de8c8
Print logs after test fails
juliannguyen4 Apr 8, 2026
2172e61
fix test case..
juliannguyen4 Apr 8, 2026
35e6136
Also skip test case for server < 8.1.2 since it doesn't fail. TODO - …
juliannguyen4 Apr 8, 2026
6292a36
Fix bad syntax
juliannguyen4 Apr 8, 2026
d115360
Mark failing test with xfail for now
juliannguyen4 Apr 10, 2026
246a5c2
Revert ci/cd pipeline back to known working state that can use qe builds
juliannguyen4 Apr 10, 2026
30856ef
Merge remote-tracking branch 'origin/dev' into CLIENT-4436-path-expre…
juliannguyen4 Apr 10, 2026
d6143d5
Update c client to match dev
juliannguyen4 Apr 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions aerospike_helpers/cdt_ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,18 @@
# Cleanup
client.remove(key)
client.close()

.. _path_expressions_contexts:

Path Expressions Contexts
-------------------------

These :py:class:`_cdt_ctx` methods are meant to be used with path expressions:

- :py:meth:`cdt_ctx_all_children`
- :py:meth:`cdt_ctx_all_children_with_filter`
- :py:meth:`cdt_ctx_map_keys_in`
- :py:meth:`cdt_ctx_and_filter`
"""
import aerospike

Expand Down Expand Up @@ -301,6 +313,8 @@ def cdt_ctx_map_key_create(key: any, order: int = 0) -> _cdt_ctx:
"""
return _cdt_ctx(id=aerospike.CDT_CTX_MAP_KEY_CREATE, value=key, extra_args={CDT_CTX_ORDER_KEY: order})

# Path expressions

def cdt_ctx_all_children() -> _cdt_ctx:
"""
At the current context, causes a query to return a list of all the children
Expand All @@ -326,3 +340,48 @@ def cdt_ctx_all_children_with_filter(expression: "TypeExpression") -> _cdt_ctx:
:class:`~aerospike_helpers.cdt_ctx._cdt_ctx`
"""
return _cdt_ctx(id=aerospike._AS_CDT_CTX_EXP, extra_args={aerospike._CDT_CTX_FILTER_EXPR_KEY: expression})

def cdt_ctx_and_filter(expression: "TypeExpression") -> _cdt_ctx:
"""
Add a boolean expression filter AND-combined with a previous :meth:`cdt_ctx_map_keys_in`.

This applies the expression at the same level as the previous path context.

Restrictions:

Only one :meth:`cdt_ctx_and_filter` is allowed per context level. Multiple :meth:`cdt_ctx_and_filter`
calls cannot be chained. To combine multiple conditions, use :class:`~aerospike_helpers.expressions.base.And` within
a single :meth:`cdt_ctx_and_filter`.

The preceding context entry must not be an expression type (i.e. :meth:`cdt_ctx_and_filter`
cannot follow :meth:`cdt_ctx_all_children_with_filter` or :meth:`cdt_ctx_all_children`).

:meth:`cdt_ctx_and_filter` cannot be the first entry in the context chain.

Args:
expression: Compiled expression. This expression must return a boolean.

Returns:
:class:`~aerospike_helpers.cdt_ctx._cdt_ctx`
"""
return _cdt_ctx(id=aerospike._AS_CDT_CTX_AND | aerospike._AS_CDT_CTX_EXP, extra_args={aerospike._CDT_CTX_FILTER_EXPR_KEY: expression})

def cdt_ctx_map_keys_in(keys: list):
"""
Restrict map context to the given list of keys, provided they exist.

For example, if a map ``{"A": 1, "B": 2, "C": 3}`` exists, and you pass
keys ``["A", "C", "D"]`` in as the list of keys, the result will only
include ``{"A": 1, "C": 3}``, since element "D" does not exist in the map.

This can be followed by :meth:`cdt_ctx_and_filter` to filter out the remaining map entries.

This can only be used by path expressions.

Args:
keys (list): The keys to look for in the map.

Returns:
:class:`~aerospike_helpers.cdt_ctx._cdt_ctx`
"""
return _cdt_ctx(id=aerospike._AS_CDT_CTX_MAP_KEYS_IN, value=keys)
6 changes: 4 additions & 2 deletions aerospike_helpers/expressions/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,8 @@ class SelectByPath(_BaseExpr):
def __init__(self, ctx: list[_cdt_ctx], value_type: ResultType, flags: int, bin: _BaseExpr):
"""
Args:
ctx: list of CDT contexts. This cannot be None or an empty list.
ctx: list of CDT contexts. This cannot be None or an empty list. See :ref:`path_expressions_contexts`
for possible contexts.
value_type: Return type specifier.
flags: See :ref:`exp_path_select_flags` for possible values.
bin: Bin expression to which this expression applies.
Expand All @@ -1188,7 +1189,8 @@ class ModifyByPath(_BaseExpr):
def __init__(self, ctx: list[_cdt_ctx], value_type: ResultType, mod_exp, flags: int, bin: _BaseExpr):
"""
Args:
ctx: list of CDT contexts. This cannot be None or an empty list.
ctx: list of CDT contexts. This cannot be None or an empty list. See :ref:`path_expressions_contexts`
for possible contexts.
value_type: Value type specifier.
mod_exp: Compiled expression to apply.
flags: See :ref:`exp_path_modify_flags` for possible values.
Expand Down
21 changes: 21 additions & 0 deletions aerospike_helpers/expressions/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,27 @@ def __init__(
self._fixed[_Keys.CTX_KEY] = ctx


class InList(_BaseExpr):
"""
Return :py:obj:`True` if value is contained in list. Otherwise return :py:obj:`False`.
"""

_op = aerospike._AS_EXP_CODE_IN_LIST

def __init__(
self,
value: "TypeValue",
bin: "TypeBinName",
):
"""Args:
value (TypeValue): Value or value expression to look for.
bin (TypeBinName): list bin name or expression evaluating to a list.

:return: Expression.
"""
self._children = (value, bin if isinstance(bin, _BaseExpr) else ListBin(bin))


class ListGetByValueRelRankRange(_BaseExpr):
"""Create an expression that selects list items nearest to value and greater by relative rank with a
count limit and returns selected data specified by return_type.
Expand Down
42 changes: 42 additions & 0 deletions aerospike_helpers/expressions/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -1488,3 +1488,45 @@ def __init__(

if ctx is not None:
self._fixed[_Keys.CTX_KEY] = ctx


class MapGetKeys(_BaseExpr):
"""
Return a list of keys from a map.
"""

_op = aerospike._AS_EXP_CODE_MAP_KEYS

def __init__(
self,
map_value
):
"""Args:
map_value (TypeBinName): expression that returns a map, or bin name containing a map.

:return: Expression.
"""
if not isinstance(map_value, _BaseExpr):
map_value = MapBin(map_value)
self._children = (map_value,)


class MapGetValues(_BaseExpr):
"""
Return a list of values from a map.
"""

_op = aerospike._AS_EXP_CODE_MAP_VALUES

def __init__(
self,
map_value
):
"""Args:
map_value (TypeBinName): expression that returns a map, or bin name containing a map.

:return: Expression.
"""
if not isinstance(map_value, _BaseExpr):
map_value = MapBin(map_value)
self._children = (map_value,)
2 changes: 2 additions & 0 deletions aerospike_helpers/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def select_by_path(bin_name: str, ctx: list[_cdt_ctx], flags: int):
Args:
bin_name: Name of bin where this select operation is performed against.
ctx: List of contexts to select nodes. It is an error for ctx to be :py:obj:`None` or an empty list.
See :ref:`path_expressions_contexts` for possible contexts.
flags: See :ref:`exp_path_select_flags` for the set of valid flags for this function.

Returns:
Expand All @@ -161,6 +162,7 @@ def modify_by_path(bin_name: str, ctx: list[_cdt_ctx], expr, flags: int):
Args:
bin_name: Name of bin that this modify operation is performed against
ctx: List of contexts to select nodes. It is an error for ctx to be :py:obj:`None` or an empty list.
See :ref:`path_expressions_contexts` for possible contexts.
expr: compiled modifying expression.
flags: See :ref:`exp_path_modify_flags` for the set of valid flags for this function.

Expand Down
6 changes: 6 additions & 0 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@ static struct module_constant_name_to_value module_constants[] = {
{"CDT_CTX_MAP_INDEX", .value.integer = AS_CDT_CTX_MAP_INDEX},
{"CDT_CTX_MAP_RANK", .value.integer = AS_CDT_CTX_MAP_RANK},
{"CDT_CTX_MAP_KEY", .value.integer = AS_CDT_CTX_MAP_KEY},
EXPOSE_AS_MACRO_AS_PRIVATE_FIELD(AS_CDT_CTX_MAP_KEYS_IN),
{"CDT_CTX_MAP_VALUE", .value.integer = AS_CDT_CTX_MAP_VALUE},
{"CDT_CTX_MAP_KEY_CREATE", .value.integer = CDT_CTX_MAP_KEY_CREATE},
EXPOSE_AS_MACRO_AS_PRIVATE_FIELD(AS_CDT_CTX_EXP),
EXPOSE_AS_MACRO_AS_PRIVATE_FIELD(AS_CDT_CTX_AND),

/* HLL constants 3.11.0 */
{"OP_HLL_ADD", .value.integer = OP_HLL_ADD},
Expand Down Expand Up @@ -585,7 +587,11 @@ static struct module_constant_name_to_value module_constants[] = {
// so we define unique ones in the Python client code
EXPOSE_MACRO(_AS_EXP_CODE_CALL_SELECT),
EXPOSE_MACRO(_AS_EXP_CODE_CALL_APPLY),

EXPOSE_MACRO(_AS_EXP_CODE_REMOVE_RESULT),
EXPOSE_MACRO(_AS_EXP_CODE_IN_LIST),
EXPOSE_MACRO(_AS_EXP_CODE_MAP_KEYS),
EXPOSE_MACRO(_AS_EXP_CODE_MAP_VALUES),

EXPOSE_STRING_MACRO_FOR_AEROSPIKE_HELPERS(_CDT_FLAGS_KEY),
EXPOSE_STRING_MACRO_FOR_AEROSPIKE_HELPERS(_CDT_APPLY_MOD_EXP_KEY),
Expand Down
Loading
Loading