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_r301855073
 
 

 ##########
 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:
   All the compile infos for a final downward step "foo" in ../../foo must all 
be to an element named "foo", so since navigation down to a named child element 
is always the same regardless of its type, any of them will do.
   
   However, I need to verify that this is only taking the element name + 
namespace information, not using anything else about the element. Perhaps these 
should be changed to take only that information, and not the whole 
dpathElementCompileInfo, since this downward step is actually representing a 
polymorphic downward step to any of the possible named children (having the 
same name and namespace) that this path could be stepping downward into.

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