Skip to content

Commit

Permalink
Support for arrays and objects removed from comparisons. #208 (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr authored Mar 28, 2023
1 parent f8f6731 commit 883bd80
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 114 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `inspect`: The parameter `message` has been moved to be the second argument. [#369](https://github.com/Open-EO/openeo-processes/issues/369)
- `mask` and `merge_cubes`: The spatial dimensions `x` and `y` can now be resampled implicitly instead of throwing an error. [#402](https://github.com/Open-EO/openeo-processes/issues/402)
- `save_result`: Added a more concrete `DataCubeEmpty` exception.
- The comparison processes `eq`, `neq`, `lt`, `lte`, `gt`, `gte` don't support temporal comparison any longer. Instead explicitly use `date_difference`.
- New definition for `aggregate_spatial`:
- Allows more than 3 input dimensions [#126](https://github.com/Open-EO/openeo-processes/issues/126)
- Allow to not export statistics by changing the parameter `target_dimension` [#366](https://github.com/Open-EO/openeo-processes/issues/366)
Expand All @@ -52,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `between`: Support for temporal comparison.
- Deprecated `GeometryCollections` are not supported any longer. [#389](https://github.com/Open-EO/openeo-processes/issues/389)
- Deprecated PROJ definitions for the CRS are not supported any longer.
- The comparison processes `eq`, `neq`, `lt`, `lte`, `gt`, `gte` and `array_contains`:
- Removed support for temporal comparison. Instead explicitly use `date_difference`.
- Removed support for the input data types array and object. [#208](https://github.com/Open-EO/openeo-processes/issues/208)

### Fixed

Expand Down
44 changes: 7 additions & 37 deletions array_contains.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "array_contains",
"summary": "Check whether the array contains a given value",
"description": "Checks whether the array specified for `data` contains the value specified in `value`. Returns `true` if there's a match, otherwise `false`.\n\n**Remarks:**\n\n* To get the index or the label of the value found, use ``array_find()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. A `null` return value from ``eq()`` is handled exactly as `false` (no match).\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating-point numbers due to floating-point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.\n* If the specified value is an array, object or null, the process always returns `false`. See the examples for one to check for `null` values.",
"description": "Checks whether the array specified for `data` contains the value specified in `value`. Returns `true` if there's a match, otherwise `false`.\n\n**Remarks:**\n\n* To get the index or the label of the value found, use ``array_find()``.\n* All definitions for the process ``eq()`` regarding the comparison of values apply here as well. A `null` return value from ``eq()`` is handled exactly as `false` (no match).\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*.\n* An integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`. Still, this process may return unexpectedly `false` when comparing floating-point numbers due to floating-point inaccuracy in machine-based computation.\n* Temporal strings are treated as normal strings and MUST NOT be interpreted.",
"categories": [
"arrays",
"comparison",
Expand All @@ -22,7 +22,12 @@
"name": "value",
"description": "Value to find in `data`. If the value is `null`, this process returns always `false`.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
Expand Down Expand Up @@ -77,25 +82,6 @@
},
"returns": false
},
{
"arguments": {
"data": [
[
1,
2
],
[
3,
4
]
],
"value": [
1,
2
]
},
"returns": false
},
{
"arguments": {
"data": [
Expand All @@ -111,22 +97,6 @@
"value": 2
},
"returns": false
},
{
"arguments": {
"data": [
{
"a": "b"
},
{
"c": "d"
}
],
"value": {
"a": "b"
}
},
"returns": false
}
],
"links": [
Expand Down
31 changes: 13 additions & 18 deletions eq.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "eq",
"summary": "Equal to comparison",
"description": "Compares whether `x` is strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* If any operand is an array or object, the return value is `false`.\n* Strings are expected to be encoded in UTF-8 by default.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"description": "Compares whether `x` is strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"categories": [
"texts",
"comparison"
Expand All @@ -11,14 +11,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
Expand Down Expand Up @@ -142,21 +152,6 @@
},
"returns": false
},
{
"arguments": {
"x": [
1,
2,
3
],
"y": [
1,
2,
3
]
},
"returns": false
},
{
"arguments": {
"x": null,
Expand Down
14 changes: 12 additions & 2 deletions gt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
Expand Down
31 changes: 13 additions & 18 deletions gte.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "gte",
"summary": "Greater than or equal to comparison",
"description": "Compares whether `x` is greater than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If any operand is an array or object, the return value is `false`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"description": "Compares whether `x` is greater than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"categories": [
"comparison"
],
Expand All @@ -10,14 +10,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
Expand Down Expand Up @@ -73,21 +83,6 @@
},
"returns": false
},
{
"arguments": {
"x": [
1,
2,
3
],
"y": [
1,
2,
3
]
},
"returns": false
},
{
"arguments": {
"x": null,
Expand Down
14 changes: 12 additions & 2 deletions lt.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
Expand Down
31 changes: 13 additions & 18 deletions lte.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "lte",
"summary": "Less than or equal to comparison",
"description": "Compares whether `x` is less than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If any operand is an array or object, the return value is `false`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"description": "Compares whether `x` is less than or equal to `y`.\n\n**Remarks:**\n\n* If any operand is `null`, the return value is `null`.\n* If the operands are not equal (see process ``eq()``) and any of them is not a `number`, the process returns `false`.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"categories": [
"comparison"
],
Expand All @@ -10,14 +10,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
}
],
Expand Down Expand Up @@ -73,21 +83,6 @@
},
"returns": false
},
{
"arguments": {
"x": [
1,
2,
3
],
"y": [
1,
2,
3
]
},
"returns": false
},
{
"arguments": {
"x": null,
Expand Down
31 changes: 13 additions & 18 deletions neq.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "neq",
"summary": "Not equal to comparison",
"description": "Compares whether `x` is **not** strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* If any operand is an array or object, the return value is `false`.\n* Strings are expected to be encoded in UTF-8 by default.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"description": "Compares whether `x` is **not** strictly equal to `y`.\n\n**Remarks:**\n\n* Data types MUST be checked strictly. For example, a string with the content *1* is not equal to the number *1*. Nevertheless, an integer *1* is equal to a floating-point number *1.0* as `integer` is a sub-type of `number`.\n* If any operand is `null`, the return value is `null`.\n* Strings are expected to be encoded in UTF-8 by default.\n* Temporal strings are normal strings. To compare temporal strings as dates/times, use ``date_difference()``.",
"categories": [
"texts",
"comparison"
Expand All @@ -11,14 +11,24 @@
"name": "x",
"description": "First operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
"name": "y",
"description": "Second operand.",
"schema": {
"description": "Any data type is allowed."
"type": [
"number",
"boolean",
"string",
"null"
]
}
},
{
Expand Down Expand Up @@ -135,21 +145,6 @@
},
"returns": true
},
{
"arguments": {
"x": [
1,
2,
3
],
"y": [
1,
2,
3
]
},
"returns": false
},
{
"arguments": {
"x": null,
Expand Down

0 comments on commit 883bd80

Please sign in to comment.