rdblue commented on a change in pull request #1353:
URL: https://github.com/apache/iceberg/pull/1353#discussion_r472550187



##########
File path: core/src/main/java/org/apache/iceberg/BaseTableScan.java
##########
@@ -159,6 +159,10 @@ public TableScan option(String property, String value) {
 
   @Override
   public TableScan project(Schema projectedSchema) {
+    if (context.selectedColumns() != null) {
+      throw new IllegalStateException("Cannot project schema when selected 
columns is specified.");
+    }

Review comment:
       We would normally use a `Precondition` check here:
   
   ```java
   Preconditions.checkState(context.selectedColumns() == null, "Cannot ...");
   ```
   
   I was also going to say that I think we should check the reverse as well, in 
case `project` is called before `select`, but it looks like the projection is 
tracked outside of the context for some reason. I don't think that's quite 
right. We probably want to move `project` to the context as well.
   
   @edgarRd, do you know why `project` doesn't use the scan context?




----------------------------------------------------------------
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]



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

Reply via email to