Пример #1
0
  /**
   * Tests whether we can support the usage of dynamic parameters in a given SargExpr.
   *
   * @param sargExpr expression to test
   * @return true if supported
   */
  private boolean testDynamicParamSupport(SargExpr sargExpr) {
    // NOTE jvs 18-Mar-2006: we don't currently support boolean operators
    // over predicates on dynamic parameters.  The reason is that we
    // evaluate sarg expressions at prepare time rather than at execution
    // time.  To support them, we would need a way to defer evaluation
    // until execution time (Broadbase used to do that).

    Set<RexDynamicParam> dynamicParams = new HashSet<RexDynamicParam>();
    sargExpr.collectDynamicParams(dynamicParams);
    if (dynamicParams.isEmpty()) {
      // no dynamic params, no problem
      return true;
    }
    if (sargExpr instanceof SargIntervalExpr) {
      // We can support a single point or ray, which is the
      // most that would have been generated by the time this is
      // called.  Should probably assert that.
      return true;
    }

    // Anything else is unsupported.
    return false;
  }
Пример #2
0
 // implement SargExpr
 public void collectDynamicParams(Set<RexDynamicParam> dynamicParams) {
   for (SargExpr child : children) {
     child.collectDynamicParams(dynamicParams);
   }
 }