From b197add3d739b888476b15bbe1375c24c706f071 Mon Sep 17 00:00:00 2001 From: arvid Date: Fri, 17 Jan 2014 15:23:08 +0100 Subject: [PATCH] Made ObjectCreation.FieldCopy lenient for MissingNodes to support outer joins better --- .../eu/stratosphere/sopremo/base/TwoSourceJoinTest.java | 9 +++------ .../stratosphere/sopremo/expressions/ObjectCreation.java | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sopremo/sopremo-base/src/test/java/eu/stratosphere/sopremo/base/TwoSourceJoinTest.java b/sopremo/sopremo-base/src/test/java/eu/stratosphere/sopremo/base/TwoSourceJoinTest.java index 9ea860d39..733c1fa13 100644 --- a/sopremo/sopremo-base/src/test/java/eu/stratosphere/sopremo/base/TwoSourceJoinTest.java +++ b/sopremo/sopremo-base/src/test/java/eu/stratosphere/sopremo/base/TwoSourceJoinTest.java @@ -191,7 +191,6 @@ public void shouldPerformFullOuterTwoSourceJoin() { } @Test - @Ignore public void shouldPerformFullOuterTwoSourceJoin2() { final SopremoTestPlan sopremoPlan = new SopremoTestPlan(2, 1); @@ -206,7 +205,6 @@ public void shouldPerformFullOuterTwoSourceJoin2() { new ObjectCreation.CopyFields(new InputSelection(1)), new ObjectCreation.FieldAssignment("worksFor", JsonUtil.createPath("0", "worksFor")))); join.setInputs(sopremoPlan.getInputOperators(0, 2)); - join.setResultProjection(ObjectCreation.CONCATENATION); sopremoPlan.getOutputOperator(0).setInputs(join); sopremoPlan.getInput(0). addObject("biographyId", "A000029", "worksFor", "CompanyXYZ"). @@ -219,10 +217,9 @@ public void shouldPerformFullOuterTwoSourceJoin2() { sopremoPlan.getExpectedOutput(0). addObject("biography", "A000029", "id", "usCongress1", "income", 1, "name", "Andrew Adams", "worksFor", "CompanyXYZ"). - addObject("biography", "A000039", "id", "usCongress2", "income", 1, "name", "John Adams", "worksFor", - "CompanyUVW"). - addObject("biography", "A000049", "worksFor", "CompanyABC"). - addObject("biography", "A000059", "id", "usCongress3", "income", 1, "name", "Andrew Adams"); + addObject("biography", "A000039", "id", "usCongress2", "income", 1, "name", "John Adams"). + addObject("worksFor", "CompanyABC"). + addObject("biography", "A000059", "id", "usCongress3", "income", 1, "name", "John Doe", "worksFor", "CompanyUVW"); sopremoPlan.trace(); sopremoPlan.run(); diff --git a/sopremo/sopremo-common/src/main/java/eu/stratosphere/sopremo/expressions/ObjectCreation.java b/sopremo/sopremo-common/src/main/java/eu/stratosphere/sopremo/expressions/ObjectCreation.java index aa746ed6d..a76c8b377 100644 --- a/sopremo/sopremo-common/src/main/java/eu/stratosphere/sopremo/expressions/ObjectCreation.java +++ b/sopremo/sopremo-common/src/main/java/eu/stratosphere/sopremo/expressions/ObjectCreation.java @@ -221,7 +221,8 @@ public PathSegmentExpression getTargetExpression() { @Override protected void evaluate(final IJsonNode node, final IObjectNode target) { final IJsonNode exprNode = this.getExpression().evaluate(node); - target.putAll((IObjectNode) exprNode); + if (!(exprNode instanceof MissingNode)) + target.putAll((IObjectNode) exprNode); } }