Jelajahi Sumber

Merge remote-tracking branch 'origin/candidate-4.0.0' into closedown-4.0.x

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 tahun lalu
induk
melakukan
adb60e2cc6
2 mengubah file dengan 35 tambahan dan 0 penghapusan
  1. 4 0
      ecl/hql/hqlutil.cpp
  2. 31 0
      ecl/regress/issue9641.ecl

+ 4 - 0
ecl/hql/hqlutil.cpp

@@ -5290,6 +5290,8 @@ void TempTableTransformer::createTempTableAssign(HqlExprArray & assigns, IHqlExp
                         {
                             src.set(expr->queryChild(0));
                             if (!src || src->isAttribute())
+                                src.set(queryPropertyChild(expr, defaultAtom, 0));
+                            if (!src)
                             {
                                 ERRORAT1(curRow->queryProperty(_location_Atom), HQLERR_NoDefaultProvided, expr->queryName()->str());
                                 return;
@@ -5388,6 +5390,8 @@ void TempTableTransformer::createTempTableAssign(HqlExprArray & assigns, IHqlExp
                     if (!src)
                     {
                         IHqlExpression * defaultValue = expr->queryChild(0);
+                        if (!defaultValue || defaultValue->isAttribute())
+                            defaultValue = queryPropertyChild(expr, defaultAtom, 0);
                         src.setown(replaceSelfRefSelector(defaultValue, self));
                         if (src)
                             src.setown(mapper.transformRoot(src));

+ 31 - 0
ecl/regress/issue9641.ecl

@@ -0,0 +1,31 @@
+/*##############################################################################
+
+    HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+############################################################################## */
+
+r1 := RECORD
+  STRING f1;
+  STRING f2 { DEFAULT('') };
+END;
+
+r2 := RECORD
+  STRING f1;
+  STRING f2 := '';
+END;
+
+ds1 := DATASET([{'a','b'},{'c'}], r1);
+ds2 := DATASET([{'a','b'},{'c'}], r2);
+
+output(ds1 + ds2);