apache / iceberg

Apache Iceberg
https://iceberg.apache.org/
Apache License 2.0
6.49k stars 2.24k forks source link

Cannot resolve method 'predicate' with Expression.transform #11600

Closed EremenkoValentin closed 1 day ago

EremenkoValentin commented 1 day ago

Query engine

Iceberg API 1.6.1

Question

Hi everyone. I carefully studied answers to similar questions but couldn't find a solution. I'm trying to create an Expression to use in table.newScan.filter(expr).planFiles(), but the compiler throws an error "Cannot resolve method 'predicate(Operation, UnboundTerm<capture of ?>, List)'" for line 6. If I specify null (5) or don't specify values, everything works correctly. Please help me understand this issue. I tried using other Iterables instead of List - it didn't help. photo_2024-11-20_15-53-21

nastra commented 1 day ago

@EremenkoValentin what does the compiler say exactly? There are a bunch of examples in the codebase that use these methods, so you might want to take a look at how those are used. I believe the issue is that values is List<String> and not List<T>. So you can either cast it to Iterable<T> similar to how it's done in https://github.com/apache/iceberg/blob/caf03aed926665014c22cc4a68902bf684f258f9/core/src/main/java/org/apache/iceberg/expressions/ExpressionParser.java#L356 or create a List<T> like this: List<T> values = ImmutableList.of((T) "value");

EremenkoValentin commented 1 day ago

@nastra Hello. Thank you for your answer. The compiler said "Cannot resolve method 'predicate(Operation, UnboundTerm<capture of ?>, List)". I used this way for getting Iterator with DataFIles, which was created in last snapshot. Could you please provide better way for this?