romseygeek commented on a change in pull request #1444:
URL: https://github.com/apache/lucene-solr/pull/1444#discussion_r413911753



##########
File path: 
lucene/expressions/src/java/org/apache/lucene/expressions/SimpleBindings.java
##########
@@ -96,24 +90,51 @@ public DoubleValuesSource getDoubleValuesSource(String 
name) {
       case SCORE:
         return DoubleValuesSource.SCORES;
       default:
-        throw new UnsupportedOperationException(); 
+        throw new UnsupportedOperationException();
     }
   }
   
-  /** 
-   * Traverses the graph of bindings, checking there are no cycles or missing 
references 
-   * @throws IllegalArgumentException if the bindings is inconsistent 
+  @Override
+  public DoubleValuesSource getDoubleValuesSource(String name) {
+    if (map.containsKey(name) == false) {
+      throw new IllegalArgumentException("Invalid reference '" + name + "'");
+    }
+    return map.get(name).apply(this);
+  }
+
+  /**
+   * Traverses the graph of bindings, checking there are no cycles or missing 
references
+   * @throws IllegalArgumentException if the bindings is inconsistent
    */
   public void validate() {

Review comment:
       Cacheing is a whole other conversation, which I think is related to the 
stuff that @mkhludnev is working on around grouping (in that we could plausibly 
have multiple references to the same iterator all moving in lockstep, where at 
the moment we pull separate iterators for each reference).  But I think that's 
for a follow-up really, this issue is just a bit of refactoring to improve type 
safety.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to