Github user paul-rogers commented on a diff in the pull request:
https://github.com/apache/drill/pull/752#discussion_r103057873
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/store/mock/MockGroupScanPOP.java
---
@@ -75,20 +76,50 @@
*/
private boolean extended;
+ private ScanStats scanStats = ScanStats.TRIVIAL_TABLE;
@JsonCreator
public MockGroupScanPOP(@JsonProperty("url") String url,
- @JsonProperty("extended") Boolean extended,
@JsonProperty("entries") List<MockScanEntry> readEntries) {
super((String) null);
this.readEntries = readEntries;
this.url = url;
- this.extended = extended == null ? false : extended;
+
+ // Compute decent row-count stats for this mock data source so that
+ // the planner is "fooled" into thinking that this operator wil do
+ // disk I/O.
+
+ int rowCount = 0;
+ int rowWidth = 0;
+ for (MockScanEntry entry : readEntries) {
+ rowCount += entry.getRecords();
+ int width = 0;
+ if (entry.getTypes() == null) {
+ width = 50;
+ } else {
+ for (MockColumn col : entry.getTypes()) {
+ int colWidth = 0;
+ if (col.getWidthValue() == 0) {
+ colWidth = TypeHelper.getSize(col.getMajorType());
+ } else {
+ colWidth = col.getWidthValue();
+ }
+ colWidth *= col.getRepeatCount();
+ width += colWidth;
+ }
+ }
+ rowWidth = Math.max(rowWidth, width);
--- End diff --
Revised names and added comments to make clear what's going on.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---