Skip to content
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

A casting error occurs when Sanitizing the expression value in a specific case. #11932

Open
2 of 3 tasks
dmgkeke opened this issue Jan 9, 2025 · 2 comments
Open
2 of 3 tasks
Labels
bug Something isn't working

Comments

@dmgkeke
Copy link

dmgkeke commented Jan 9, 2025

Apache Iceberg version

1.7.1 (latest release)

Query engine

Flink

Please describe the bug 🐞

I found a code suspected of being a bug while running rewrite data file flink action.
Casting error occurs When binding the table structure and applying expression filter.
From what I saw and understood the code, it seems to be an issue that occurred in the process of sanitize to string value.

From the logic below, all value parameters delivered to the Object are delivered to the literal instance except for value method of the String Sanitizer.

https://github.com/apache/iceberg/blob/apache-iceberg-1.7.1/api/src/main/java/org/apache/iceberg/expressions/ExpressionUtil.java#L514

Therefore, I think it would be right to modify it as follows.

// ExpressionUtils.StringSanitizer
private String value(BoundLiteralPredicate<?> pred) {
      return sanitize(pred.term().type(), pred.literal(), nowMicros, today);
    }

// ExpressionUtils
private static String sanitize(Type type, Literal value, long now, int today) {
  // same code
}

or

Change the pass parameters to literal.value() from where they are called.

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time
@dmgkeke dmgkeke added the bug Something isn't working label Jan 9, 2025
@richochetclementine1315
Copy link

need to update the code with above mentioned line of code?

@richochetclementine1315
Copy link

.take issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants