Allow inline strings, as well as files, in ReferenceInterpreter. Signed-off-by: Jacques Nadeau <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/8f260b08 Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/8f260b08 Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/8f260b08 Branch: refs/heads/execwork Commit: 8f260b085ede87fc1e8d064dc903e934300df161 Parents: 6095ca9 Author: Julian Hyde <[email protected]> Authored: Thu Mar 28 17:31:31 2013 -0700 Committer: Jacques Nadeau <[email protected]> Committed: Thu Jun 6 11:06:42 2013 -0700 ---------------------------------------------------------------------- .../drill/exec/ref/ReferenceInterpreter.java | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/8f260b08/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/ReferenceInterpreter.java ---------------------------------------------------------------------- diff --git a/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/ReferenceInterpreter.java b/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/ReferenceInterpreter.java index 5be733b..ac4c891 100644 --- a/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/ReferenceInterpreter.java +++ b/sandbox/prototype/exec/ref/src/main/java/org/apache/drill/exec/ref/ReferenceInterpreter.java @@ -75,7 +75,13 @@ public class ReferenceInterpreter { public static void main(String[] args) throws Exception{ DrillConfig config = DrillConfig.create(); final String jsonFile = args[0]; - LogicalPlan plan = LogicalPlan.parse(config, Files.toString(new File(jsonFile), Charsets.UTF_8)); + final String planString; + if (jsonFile.startsWith("inline:")) { + planString = jsonFile.substring("inline:".length()); + } else { + planString = Files.toString(new File(jsonFile), Charsets.UTF_8); + } + LogicalPlan plan = LogicalPlan.parse(config, planString); IteratorRegistry ir = new IteratorRegistry(); ReferenceInterpreter i = new ReferenceInterpreter(plan, ir, new BasicEvaluatorFactory(ir), new RSERegistry(config)); i.setup();
