fbocse commented on a change in pull request #203: Support multiple partitions 
derived from the same field
URL: https://github.com/apache/incubator-iceberg/pull/203#discussion_r292431307
 
 

 ##########
 File path: api/src/main/java/org/apache/iceberg/expressions/Projections.java
 ##########
 @@ -230,14 +243,23 @@ private StrictProjection(PartitionSpec spec, boolean 
caseSensitive) {
     @Override
     @SuppressWarnings("unchecked")
     public <T> Expression predicate(BoundPredicate<T> pred) {
-      PartitionField part = spec().getFieldBySourceId(pred.ref().fieldId());
-      if (part == null) {
+      Collection<PartitionField> parts = 
spec().getFieldsBySourceId(pred.ref().fieldId());
+      if (parts == null) {
         // the predicate has no partition column
         return alwaysFalse();
       }
 
-      UnboundPredicate<?> result = ((Transform<T, ?>) part.transform())
-          .projectStrict(part.name(), pred);
+      Expression result = Expressions.alwaysFalse();
+      for (PartitionField part : parts) {
+        // consider (ts > 2019-01-01T01:00:00) with date(ts) and hour(ts)
+        // projections: d >= 2019-01-02 and h >= 2019-01-01-02 (note the 
inclusive bounds).
+        // any timestamp where either projection predicate is true must match 
the original
+        // predicate. For example, ts = 2019-01-01T03:00:00 matches the hour 
projection but not
+        // the day, but does match the original predicate.
 
 Review comment:
   Would it be difficult to translate the comment section into a unit test?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to