Skip to content

fix: if field contains space in constraint expression, checks will fail #3374

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

Merged

Conversation

Nordalf
Copy link
Contributor

@Nordalf Nordalf commented Apr 9, 2025

Description

When adding a constraint to a table, the expression is formatted as: <FIELD> <CONDITION> <VALUE>. If - god forbid - a space occurs in a field name, the condition will not evaluate due to the field name not being escaped. During the enforce_check we are unable to get the field name, and to avoid breaking backward, I am suggesting adding some logic to add backticks to conditions.

  1. Get the table schema
  2. Loop through schema and check if field exists
  3. If field exists, escape with backticks

I am not fan of this solution myself, but I do not have a better solution at the moment.

@github-actions github-actions bot added the binding/rust Issues for the Rust crate label Apr 9, 2025
Copy link

codecov bot commented Apr 9, 2025

Codecov Report

Attention: Patch coverage is 89.83051% with 6 lines in your changes missing coverage. Please review.

Project coverage is 72.02%. Comparing base (e47bba5) to head (4aa77c0).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/delta_datafusion/mod.rs 89.83% 0 Missing and 6 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3374   +/-   ##
=======================================
  Coverage   72.01%   72.02%           
=======================================
  Files         148      148           
  Lines       46081    46137   +56     
  Branches    46081    46137   +56     
=======================================
+ Hits        33184    33228   +44     
+ Misses      10790    10789    -1     
- Partials     2107     2120   +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@ion-elgreco ion-elgreco left a comment

Choose a reason for hiding this comment

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

Can you add a small test please ^^

@ion-elgreco
Copy link
Collaborator

I am not fan of this solution myself, but I do not have a better solution at the moment.

Maybe we can make it work with just a configuration in datafusion

@rtyler rtyler self-assigned this May 3, 2025
@rtyler rtyler force-pushed the fix/enforce_check_failing_when_field_has_space branch from e01fa78 to 4aa77c0 Compare May 3, 2025 20:37
@rtyler rtyler enabled auto-merge May 3, 2025 20:37
@rtyler rtyler added this pull request to the merge queue May 3, 2025
Merged via the queue into delta-io:main with commit 89ddf07 May 3, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/rust Issues for the Rust crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants