xabriel 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_r263639236
##########
File path: core/src/main/java/com/netflix/iceberg/BaseTableScan.java
##########
@@ -129,28 +137,53 @@ public TableScan select(Collection<String> columns) {
// all of the filter columns are required
requiredFieldIds.addAll(
- Binder.boundReferences(table.schema().asStruct(),
Collections.singletonList(rowFilter), true));
+ Binder.boundReferences(table.schema().asStruct(),
Collections.singletonList(rowFilter), caseSensitive));
// all of the projection columns are required
requiredFieldIds.addAll(TypeUtil.getProjectedIds(table.schema().select(columns)));
Schema projection = TypeUtil.select(table.schema(), requiredFieldIds);
- return new BaseTableScan(ops, table, snapshotId, projection, rowFilter);
+ return new BaseTableScan(ops, table, snapshotId, projection, rowFilter,
caseSensitive);
}
@Override
public TableScan filter(Expression expr) {
- return new BaseTableScan(ops, table, snapshotId, schema,
Expressions.and(rowFilter, expr));
+ return new BaseTableScan(ops, table, snapshotId, schema,
Expressions.and(rowFilter, expr), caseSensitive);
+ }
+
+ private final class InclusiveManifestEvaluatorCacheKey {
+ Integer specId;
+ Boolean caseSensitive;
+
+ InclusiveManifestEvaluatorCacheKey(Integer specId, Boolean caseSensitive) {
+ this.specId = specId;
+ this.caseSensitive = caseSensitive;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ InclusiveManifestEvaluatorCacheKey that =
(InclusiveManifestEvaluatorCacheKey) o;
+ return specId.equals(that.specId) &&
+ caseSensitive.equals(that.caseSensitive);
+ }
+
+ @Override
+ public int hashCode() {
+ return java.util.Objects.hash(specId, caseSensitive);
+ }
+
}
- private final LoadingCache<Integer, InclusiveManifestEvaluator> EVAL_CACHE =
CacheBuilder
+ private final LoadingCache<InclusiveManifestEvaluatorCacheKey,
InclusiveManifestEvaluator> EVAL_CACHE = CacheBuilder
Review comment:
I definitely missed that `private final`. Will fix.
----------------------------------------------------------------
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]