stevedlawrence 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_r301560025
 
 

 ##########
 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:
   I'm a little confused here. We seem to be getting .head alot. Doesn't that 
mean we are essentially ignoring .tail? Are there no restrictions that whaver 
DownElement could do to .head it could also do .tail? Why doesn't DownElement 
and others need .tail information too?

----------------------------------------------------------------
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