rdblue commented on a change in pull request #89: Make read-path Evaluators 
honor case sensitivity flag. Expose flag in Spark Reader.
URL: https://github.com/apache/incubator-iceberg/pull/89#discussion_r266684701
 
 

 ##########
 File path: core/src/main/java/com/netflix/iceberg/BaseTableScan.java
 ##########
 @@ -241,4 +249,34 @@ public String toString() {
     // Capture manifests which can be closed after scan planning
     return CloseableIterable.combine(splitTasks, 
ImmutableList.of(fileScanTasks));
   }
+
+  /**
+   * To be able to make refinements {@link #select(Collection)} and {@link 
#caseSensitive(boolean)} in any order,
+   * we resolve the schema to be projected lazily here.
+   *
+   * @return the Schema to project
+   */
+  private Schema lazyColumnProjection() {
+    if (selectedColumns != null ) {
+      Set<Integer> requiredFieldIds = Sets.newHashSet();
+
+      // all of the filter columns are required
+      requiredFieldIds.addAll(
+          Binder.boundReferences(table.schema().asStruct(), 
Collections.singletonList(rowFilter), caseSensitive));
+
+      // all of the projection columns are required
+      Set<Integer> selectedIds;
+      if (caseSensitive) {
+        selectedIds = 
TypeUtil.getProjectedIds(table.schema().select(selectedColumns));
+      } else {
+        selectedIds = 
TypeUtil.getProjectedIds(table.schema().caseInsensitiveSelect(selectedColumns));
+      }
+      requiredFieldIds.addAll(selectedIds);
+
+      Schema projection = TypeUtil.select(table.schema(), requiredFieldIds);
+      return projection;
 
 Review comment:
   Nit: unnecessary variable, `projection`.

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