diff options
Diffstat (limited to 'docs/dev/MockRecordReader.md')
-rw-r--r-- | docs/dev/MockRecordReader.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/docs/dev/MockRecordReader.md b/docs/dev/MockRecordReader.md new file mode 100644 index 000000000..424c13777 --- /dev/null +++ b/docs/dev/MockRecordReader.md @@ -0,0 +1,40 @@ +# MockRecordReader + +Drill provides a mock record reader to generate test data in the package: `org.apache.drill.exec.store.mock`. + +Mock data is available for physical plans. Here is a typical example: + +``` + { + @id:1, + pop:"mock-scan", + url: "http://apache.org", + entries:[ + {records: 1000000, types: [ + {name: "blue", type: "INT", mode: "REQUIRED"}, + {name: "green", type: "INT", mode: "REQUIRED"} + ]} + ] + }, +``` + +The JSON fields are: + +* `@id`: Standard required Physical OPerator (pop) ID. +* `pop`: Must be `"mock-scan"` +* `url`: Unused +* `entries`: A list of schemas of the files to generate. + +The scanner supports parallelization based on the number of entries. + +The fields for the schema are: + +* `records`: The number of records to generate. +* `types`: A list of columns (the "types" name is a misnomer.) + +Field schema fields include: + +* `name`: Field name +* `type`: The Drill minor type as defined in `MinorType`. +* `mode`: The cardinality (mode) as defined in `DataMode`: `OPTIONAL`, `REQUIRED` or `REPEATED`. +* `width`: Optional field width (need only for variable-size types such as `VARCHAR`.) |