Skip to content

Conversation

fornwall
Copy link
Contributor

@fornwall fornwall commented Aug 24, 2025

Fixes part of #581 ("Compilation failures: The user's example still produces empty files in Fusion").

Methods in modules.re (such as search and match) can take both a string for the initial pattern argument as well an already compiled expression.

Before this change only the string variant was correctly supported:

{%- set pattern = '.*' -%}
{%- set result = re.search(pattern, 'xyz') -%}

This change makes compiled patterns work as well, restoring compatibility with pythons re / dbt-core / jinja2:

{%- set pattern = re.compile('.*') -%}
{%- set result = re.search(pattern, 'xyz') -%}

The rust edition in the minijinja-contrib crate was bumped to 2024 to allow the let chain used here. Bumping the edition means that cargo fmt formats differently - the (otherwise unrelated) formatting changes are done in the second commit in this PR, while the first commit contains the actual change.

@fornwall fornwall requested a review from a team as a code owner August 24, 2025 21:47
@cla-bot cla-bot bot added the cla:yes label Aug 24, 2025
@gshank
Copy link
Contributor

gshank commented Sep 4, 2025

pull request has been merged.

@gshank gshank closed this Sep 4, 2025
fa-assistant added a commit that referenced this pull request Sep 5, 2025
* Make `modules.re` methods accept an already compiled pattern

COPYBARA PUBLIC PR: #601

Fixes part of #581 ("Compilation failures: The user's example still produces empty files in Fusion").

Methods in `modules.re` (such as `search` and `match`) can take both a string for the initial pattern argument as well an already compiled expression.

Before this change only the string variant was correctly supported:
```jinja2
{%- set pattern = '.*' -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

This change makes compiled patterns work as well, restoring compatibility with [pythons re](https://docs.python.org/3/library/re.html)  / dbt-core / jinja2:
```jinja2
{%- set pattern = re.compile('.*') -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

The rust edition in the `minijinja-contrib` crate was bumped to `2024` to allow the [let chain](rust-lang/rust#132833) used here. Bumping the edition means that `cargo fmt` formats differently - the (otherwise unrelated) formatting changes are done in the second commit in this PR, while the first commit contains the actual change.

GitOrigin-RevId: 99d438c

* Make `modules.re` methods accept an already compiled pattern

COPYBARA PUBLIC PR: #601

Fixes part of #581 ("Compilation failures: The user's example still produces empty files in Fusion").

Methods in `modules.re` (such as `search` and `match`) can take both a string for the initial pattern argument as well an already compiled expression.

Before this change only the string variant was correctly supported:
```jinja2
{%- set pattern = '.*' -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

This change makes compiled patterns work as well, restoring compatibility with [pythons re](https://docs.python.org/3/library/re.html)  / dbt-core / jinja2:
```jinja2
{%- set pattern = re.compile('.*') -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

The rust edition in the `minijinja-contrib` crate was bumped to `2024` to allow the [let chain](rust-lang/rust#132833) used here. Bumping the edition means that `cargo fmt` formats differently - the (otherwise unrelated) formatting changes are done in the second commit in this PR, while the first commit contains the actual change.

GitOrigin-RevId: 9dd9420

* Cargo fmt

* remove old changelog

* Change code to avoid clippy complaint about unstable let

* rename conflicting test name

* update test output

* Improve sdf-make-sql-functions build command

Let cargo consider only the actually necessary dependencies. When `-p`
is not present, cargo will do dependency feature unification across all
crates first.

* Remove table qualifiers in UNION plan

After UNION (or other set operation), the names are no longer qualified.
Keeping them qualified is incorrect (allows referencing which would be
rejected by CDW) and causes planning failures in DataFusion 48.

* Make `modules.re` methods accept an already compiled pattern

COPYBARA PUBLIC PR: #601

Fixes part of #581 ("Compilation failures: The user's example still produces empty files in Fusion").

Methods in `modules.re` (such as `search` and `match`) can take both a string for the initial pattern argument as well an already compiled expression.

Before this change only the string variant was correctly supported:
```jinja2
{%- set pattern = '.*' -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

This change makes compiled patterns work as well, restoring compatibility with [pythons re](https://docs.python.org/3/library/re.html)  / dbt-core / jinja2:
```jinja2
{%- set pattern = re.compile('.*') -%}
{%- set result = re.search(pattern, 'xyz') -%}
```

The rust edition in the `minijinja-contrib` crate was bumped to `2024` to allow the [let chain](rust-lang/rust#132833) used here. Bumping the edition means that `cargo fmt` formats differently - the (otherwise unrelated) formatting changes are done in the second commit in this PR, while the first commit contains the actual change.

GitOrigin-RevId: 99d438c

* Cargo fmt

* fix bad merge

* Update output for flaky test test_regression_tests_internal_analytics_build_selector_cloud_users_1

* Remove old changelog

---------

Co-authored-by: Fredrik Fornwall <[email protected]>
Co-authored-by: Gerda Shank <[email protected]>
Co-authored-by: Gerda Shank <[email protected]>
Co-authored-by: Piotr Findeisen <[email protected]>
GitOrigin-RevId: dafcf71594623b1ce94e126eb1dd6f9a6896656a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants