Skip to content

filter extension broken when installed via conda #135

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

Closed
hrodmn opened this issue May 15, 2025 · 2 comments · Fixed by #138
Closed

filter extension broken when installed via conda #135

hrodmn opened this issue May 15, 2025 · 2 comments · Fixed by #138
Assignees

Comments

@hrodmn
Copy link
Contributor

hrodmn commented May 15, 2025

I don't have a full reprex at the moment, but I am hoping this error looks familiar.

I installed rustac via conda-forge and I am seeing a strange error when I try to use the filter parameter:

items_parquet = "/tmp/noaa-hrrr.parquet"

await rustac.write(
    items_parquet,
    recent_items.to_dict(),
)

# perform a search to get the full 48 hour forecast (plus the zero-hour forecast) for a point in time
now = datetime(year=2025, month=5, day=9, hour=12)

search = await rustac.search(
    items_parquet,
    sortby="-forecast:reference_time",
    filter={
        "op": "and",
        "args": [
            {
                "op": "eq",
                "args": [{"property": "forecast:horizon"}, "PT48H"]
            },
            {
                "op": "gte",
                "args": [{"property": "forecast:reference_time"}, now.strftime("%Y-%m-%dT%H:%M:%SZ")],
            },
        ],
    },
    max_items=1,
)
thread 'tokio-runtime-worker' panicked at /home/conda/feedstock_root/build_artifacts/bld/rattler-build_rustac_1747211245/build_env/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cql2-0.3.7-beta.0/src/duckdb.rs:198:29:
internal error: entered unreachable code
---------------------------------------------------------------------------
RustPanic                                 Traceback (most recent call last)
Cell In[18], line 4
      1 # perform a search to get the full 48 hour forecast (plus the zero-hour forecast) for a point in time
      2 now = datetime(year=2025, month=5, day=9, hour=12)
----> 4 search = await rustac.search(
      5     items_fn,
      6     sortby="-forecast:reference_time",
      7     filter={
      8         "op": "and",
      9         "args": [
     10             {
     11                 "op": "eq",
     12                 "args": [{"property": "forecast:horizon"}, "PT48H"]
     13             },
     14             {
     15                 "op": "gte",
     16                 "args": [{"property": "forecast:reference_time"}, now.strftime("%Y-%m-%dT%H:%M:%SZ")],
     17             },
     18         ],
     19     },
     20     max_items=1,
     21 )
     23 search[0]

RustPanic: rust future panicked: unknown error

I will make a reprex with a conda environment.yml and a complete code snippet tomorrow.

If you think it is something specific to my environment I can try to debug some more but I thought I would post it here to see if anyone had seen it!

@gadomski gadomski self-assigned this May 15, 2025
@gadomski
Copy link
Member

Thanks for the report! Looks like the issue goes down to cql2-rs's conversion to DuckDB: developmentseed/cql2-rs@adfdcae. I'll fix down there, then propagate the fix back up to here. Appreciate it!

---- duckdb::tests::unreachable_code stdout ----

thread 'duckdb::tests::unreachable_code' panicked at src/duckdb.rs:198:29:
internal error: entered unreachable code

@gadomski
Copy link
Member

@hrodmn if you need a quick fix, use = instead of eq for equality: https://github.com/developmentseed/cql2-rs/blob/86b13f0804b84f47f50dfc80c545528c04c0662b/src/expr.rs#L20

gadomski added a commit that referenced this issue May 19, 2025
Fixes a panic in the **cql2** dependency.
developmentseed/cql2-rs#83

Closes #135

cc @hrodmn 

```text
    async def test_cql(data: Path) -> None:
>       await rustac.search(
            str(data / "100-sentinel-2-items.parquet"),
            filter={
                "op": "and",
                "args": [
                    # eq is cql, not cql2
                    {"op": "eq", "args": [{"property": "platform"}, "made-up-platform"]},
                ],
            },
            max_items=1,
        )
E       rustac.RustacError: eq is not a valid operator.

tests/test_search.py:98: RustacError
```
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 a pull request may close this issue.

2 participants