You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2023/05/06 14:09:49 UTC
[sis] branch geoapi-4.0 updated: Use the information about volatile function in order to determine whether to apply an optimization.
This is an automated email from the ASF dual-hosted git repository.
desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git
The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
new 6ad64f5ffa Use the information about volatile function in order to determine whether to apply an optimization.
6ad64f5ffa is described below
commit 6ad64f5ffac6175acebf4df111226c2303f7850c
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sat May 6 16:08:54 2023 +0200
Use the information about volatile function in order to determine whether to apply an optimization.
---
.../src/main/java/org/apache/sis/filter/Optimization.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/core/sis-feature/src/main/java/org/apache/sis/filter/Optimization.java b/core/sis-feature/src/main/java/org/apache/sis/filter/Optimization.java
index 48f684cfb9..f1d3651231 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/filter/Optimization.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/filter/Optimization.java
@@ -365,7 +365,8 @@ public class Optimization {
* Tries to optimize this expression. The default implementation performs the following steps:
*
* <ul>
- * <li>If all expressions are literals, evaluate this expression immediately.</li>
+ * <li>If all expressions are {@linkplain Literal literals} and this expression is not a
+ * {@linkplain FunctionProperty#VOLATILE volatile function}, evaluate this expression immediately.</li>
* <li>Otherwise if at least one parameter can be optimized,
* {@linkplain #recreate(Expression[]) recreate} the expression.</li>
* <li>Otherwise returns {@code this}.</li>
@@ -386,7 +387,7 @@ public class Optimization {
immediate &= (e instanceof Literal<?,?>);
effective[i] = e;
}
- if (immediate) {
+ if (immediate && !properties(this).contains(FunctionProperty.VOLATILE)) {
return literal(apply(null));
} else if (unchanged) {
return this;