mbeckerle commented on a change in pull request #259: Incremental progress on 
schema compilation space/speed issue.
URL: https://github.com/apache/incubator-daffodil/pull/259#discussion_r303100987
 
 

 ##########
 File path: 
daffodil-core/src/main/scala/org/apache/daffodil/dpath/Expression.scala
 ##########
 @@ -1103,64 +1103,106 @@ case class NamedStep(s: String, predArg: 
Option[PredicateExpression])
     res
   }
 
-  lazy val dpathElementCompileInfo = stepElement
+  lazy val dpathElementCompileInfos = stepElements
 
   lazy val downwardStep = {
-    if (stepElement.isArray && pred.isDefined) {
-      Assert.invariant(pred.get.targetType == NodeInfo.ArrayIndex)
-      val indexRecipe = pred.get.compiledDPath
-      new DownArrayOccurrence(dpathElementCompileInfo, indexRecipe)
-    } else if (stepElement.isArray && targetType == NodeInfo.Exists) {
-      new DownArrayExists(dpathElementCompileInfo)
-    } else if (stepElement.isArray) {
-      schemaDefinitionUnless(targetType == NodeInfo.Array, "Query-style paths 
not supported. Must have '[...]' after array-element's name. Offending path 
step: '%s'.", step)
-      new DownArray(dpathElementCompileInfo)
+    if (isArray) {
+      if (pred.isDefined) {
+        Assert.invariant(pred.get.targetType == NodeInfo.ArrayIndex)
+        val indexRecipe = pred.get.compiledDPath
+        new DownArrayOccurrence(dpathElementCompileInfos.head, indexRecipe)
+      } else if (targetType == NodeInfo.Exists) {
+        new DownArrayExists(dpathElementCompileInfos.head)
+      } else {
+        schemaDefinitionUnless(targetType == NodeInfo.Array, "Query-style 
paths not supported. Must have '[...]' after array-element's name. Offending 
path step: '%s'.", step)
+        new DownArray(dpathElementCompileInfos.head)
+      }
     } else {
       //
       // Note: DFDL spec allows a[exp] if a is not an array, but it's a 
processing
       // error if exp doesn't evaluate to 1.
       // TODO: Implement this.
       if (pred.isDefined) subsetError("Indexing is only allowed on arrays. 
Offending path step: '%s%s'.", step, pred.get.text)
-      new DownElement(dpathElementCompileInfo)
+      new DownElement(dpathElementCompileInfos.head)
 
 Review comment:
   This turns out to be a tricky issue. Since expressions are polymorphic, it's 
unclear exactly which downward step is failing here if this fails at runtime. 
When we were copying the expressions, the diagnostic info (schema file 
location) for a corresponding downward step was easily identifiable. I will 
have to investigate. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to