You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "gupta-sahil01 (via GitHub)" <gi...@apache.org> on 2026/09/10 18:03:28 UTC
[PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
gupta-sahil01 opened a new pull request, #8484:
URL: https://github.com/apache/texera/pull/8484
<!--
Thanks for sending a pull request (PR)! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines:
[Contributing to Texera](https://github.com/apache/texera/blob/main/CONTRIBUTING.md)
2. Ensure you have added or run the appropriate tests for your PR
3. If the PR is work in progress, mark it a draft on GitHub.
4. Please write your PR title to summarize what this PR proposes, we
are following Conventional Commits style for PR titles as well:
- `fix` is for behavior that worked before and no longer does; adding or
removing a functionality, or reworking one so that user-facing behavior
intentionally changes, is a `feat`; a change that leaves the user-facing
behavior unchanged is a `refactor`.
- A test-only PR is `test(<module>): ...`; repairing a broken test is
`fix(test, <module>): ...`.
- A dependency bump is `fix(deps, <module>): ...` when it patches a CVE
and `chore(deps, <module>): ...` otherwise; GitHub Actions bumps take
`ci` as their module, e.g. `chore(deps, ci): ...`.
- A PR targeting a release branch appends the version as the last scope
component, e.g. `fix(deps, frontend, v1.2): ...`.
See CONTRIBUTING.md for the full convention.
5. Be sure to keep the PR description updated to reflect all changes.
-->
### What changes were proposed in this PR?
The `Filter` operator hard-codes OR semantics — a tuple passes as soon as any one
predicate matches. Users who need AND (e.g. `age > 30 AND country = "US"`) have to
chain multiple `Filter` operators, which adds workflow clutter and an extra hop per
condition.
This PR makes the combination configurable:
- **New `PredicateCombinator` enum** (`OR` → `"any (OR)"`, `AND` → `"all (AND)"`),
following the `@JsonValue` / `@JsonCreator` pattern already used by
`ComparisonType` in the same package.
- **New `predicateCombinator` property** on `SpecializedFilterOpDesc`, defaulting to
`OR`. The UI dropdown renders automatically from the JSON schema, so there are no
frontend changes.
- **`SpecializedFilterOpExec`** now selects `forall` for AND and `exists` for OR.
- **Docs and descriptions** updated to stop claiming OR-only behavior.
**Backward compatibility:** the default is `OR`, and a stored descriptor without the
field deserializes to `OR`, so existing workflows behave exactly as before and no
migration is needed.
**One behavioral note for reviewers:** an empty predicate list continues to drop every
tuple in *both* modes. A bare `forall` returns `true` on an empty list, which would
have silently flipped an empty Filter from "drop everything" to "pass everything", so
the AND branch is guarded with `predicates.nonEmpty &&`. There is a test covering this.
Nested predicate trees (e.g. `(A AND B) OR C`) are intentionally out of scope — they
need more extensive UI work and are noted as a follow-up in the issue.
<!--
Please clarify what changes you are proposing. The purpose of this section
is to outline the changes. Here are some tips for you:
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
3. If it is a refactoring, clarify what has been changed.
3. It would be helpful to include a before-and-after comparison using
screenshots or GIFs.
4. Please consider writing useful notes for better and faster reviews.
-->
### Any related issues, documentation, discussions?
Closes #6939
Operator documentation updated in the same PR:
`docs/reference/operators/data-cleaning/filter.md`.
<!--
Please use this section to link other resources if not mentioned already.
1. If this PR fixes an issue, please include `Fixes #1234`, `Resolves #1234`
or `Closes #1234`. If it is only related, simply mention the issue number.
2. If there is design documentation, please add the link.
3. If there is a discussion in the mailing list, please add the link.
-->
### How was this PR tested?
New and updated unit tests, all run locally via
`sbt "WorkflowOperator/testOnly *filter*"` — 67 tests across 7 suites, all passing.
- **`PredicateCombinatorSpec`** (new): wire names via `getName`, case-insensitive
`fromString`, rejection of an unknown name, and the Jackson round-trip.
- **`SpecializedFilterOpDescSpec`**: the property defaults to `OR`; a hand-written
descriptor JSON with **no** `predicateCombinator` field deserializes to `OR`
(this is the backward-compatibility claim above); an explicit `AND` survives the
round-trip through the polymorphic `LogicalOp` base; `operatorInfo` advertises the
new behavior.
- **`SpecializedFilterOpExecSpec`**: with two predicates where only one matches, OR
keeps the tuple and AND drops it; AND keeps it when both match; AND with an empty
predicate list drops everything; AND and OR agree on a single predicate. A
`before` block resets the shared descriptor between tests so a mode set in one
test cannot leak into the ones after it.
The empty-list guard was additionally verified by mutation: removing
`predicates.nonEmpty &&` from the executor makes exactly one test fail, confirming
the case is genuinely covered rather than incidentally passing.
<!--
If tests were added, say they were added here. Or simply mention that if the PR
is tested with existing test cases. Make sure to include/update test cases that
check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how
you tested step by step, ideally copy and paste-able, so that other reviewers can
test and check, and descendants can verify in the future. If tests were not added,
please describe why they were not added and/or why it was difficult to add.
-->
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5)
<!--
If generative AI tooling has been used in the process of authoring this PR,
please include the phrase: 'Generated-by: ' followed by the name of the tool
and its version. If no, write 'No'.
Please refer to the [ASF Generative Tooling Guidance](https://www.apache.org/legal/generative-tooling.html) for details.
-->
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub) via notifications" <no...@texera.apache.org>.
gupta-sahil01 commented on code in PR #8484:
URL: https://github.com/apache/texera/pull/8484#discussion_r4544540871
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpDesc.scala:
##########
@@ -29,9 +30,14 @@ import org.apache.texera.amber.util.JSONUtils.objectMapper
class SpecializedFilterOpDesc extends FilterOpDesc {
@JsonProperty(value = "predicates", required = true)
- @JsonPropertyDescription("multiple predicates in OR")
+ @JsonPropertyDescription("multiple predicates to be combined")
var predicates: List[FilterPredicate] = List.empty
+ @JsonProperty(required = true, defaultValue = "any (OR)")
+ @JsonSchemaTitle("Combine Predicates With")
+ @JsonPropertyDescription("how to combine multiple predicates")
+ var predicateCombinator: PredicateCombinator = PredicateCombinator.OR
Review Comment:
Done: made it optional (not in the schema's required list) and moved it above predicates. I also added @JsonSetter(nulls = Nulls.SKIP) so an explicit null keeps the OR default instead of reaching the executor as null.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpExec.scala:
##########
@@ -25,5 +25,11 @@ import org.apache.texera.amber.util.JSONUtils.objectMapper
class SpecializedFilterOpExec(descString: String) extends FilterOpExec {
private val desc: SpecializedFilterOpDesc =
objectMapper.readValue(descString, classOf[SpecializedFilterOpDesc])
- setFilterFunc((tuple: Tuple) => desc.predicates.exists(_.evaluate(tuple)))
+ setFilterFunc((tuple: Tuple) =>
+ desc.predicateCombinator match {
+ case PredicateCombinator.AND =>
+ desc.predicates.nonEmpty && desc.predicates.forall(_.evaluate(tuple))
+ case _ => desc.predicates.exists(_.evaluate(tuple))
+ }
+ )
Review Comment:
Done: both cases are named, and the function is chosen once.
##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpExecSpec.scala:
##########
@@ -135,4 +139,65 @@ class SpecializedFilterOpExecSpec extends AnyFlatSpec with BeforeAndAfter {
opExec.close()
})
}
+
+ it should "keep a tuple under OR when only one predicate matches" in {
+ opDesc.predicates = List(
+ new FilterPredicate("int", ComparisonType.EQUAL_TO, "0"),
+ new FilterPredicate("string", ComparisonType.EQUAL_TO, "world")
+ )
+ opDesc.predicateCombinator = PredicateCombinator.OR
+ val opExec = new SpecializedFilterOpExec(objectMapper.writeValueAsString(opDesc))
+ opExec.open()
+ assert(opExec.processTuple(nonNullTuple, inputPort).nonEmpty)
+ opExec.close()
+ }
+
+ it should "drop a tuple under AND when only one predicate matches" in {
Review Comment:
Added the reversed-order AND test and removed the no-op line.
##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpDescSpec.scala:
##########
@@ -70,4 +75,27 @@ class SpecializedFilterOpDescSpec extends AnyFlatSpec with Matchers {
restored shouldBe a[SpecializedFilterOpDesc]
restored.asInstanceOf[SpecializedFilterOpDesc].predicates shouldBe empty
}
+
+ "SpecializedFilterOpDesc" should
Review Comment:
Added both: 'xor' fails with a ValueInstantiationException naming the field, and a null combinator behaves as OR.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/PredicateCombinator.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.operator.filter;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum PredicateCombinator {
+ OR("any (OR)"),
+
+ AND("all (AND)");
+
+ private final String name;
+
+ private PredicateCombinator(String name) {
+ this.name = name;
+ }
+
+ // use the name string instead of enum string in JSON
+ @JsonValue
+ public String getName() {
+ return this.name;
+ }
+
+ // Handle custom deserialization for enum
Review Comment:
Kept it to match ComparisonType. It also gives the ValueInstantiationException the bad-input test checks for.
##########
docs/reference/operators/data-cleaning/filter.md:
##########
@@ -31,10 +31,11 @@ tags: [data-cleaning]
| Property | Requirement | Type | Default | Description |
|----------|-------------|------|---------|-------------|
-| Predicates | ✓ | List<Filter Predicate> | - | Multiple predicates in OR |
+| Predicates | ✓ | List<Filter Predicate> | - | Multiple predicates to be combined |
| ↳ Attribute | ✓ | String | - | |
| ↳ Condition | ✓ | =, >, >=, <, <=, !=, is null,<br>is not null | - | |
| ↳ Value | | String | - | |
+| Combine Predicates With | ✓ | any (OR), all (AND) | any (OR) | How to combine multiple predicates |
Review Comment:
Done: dropped the check mark, moved the row above Predicates, and added a line saying that 'all (AND)' with no predicates keeps no rows. Also fixed _index.md.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub) via notifications" <no...@texera.apache.org>.
gupta-sahil01 commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-6810126872
/request-review @aglinxinyuan
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub)" <gi...@apache.org>.
gupta-sahil01 commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-5826874197
/request-review @xuang7
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-5623230477
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/8484?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.94%. Comparing base ([`ec3a9dd`](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`8425ccd`](https://app.codecov.io/gh/apache/texera/commit/8425ccd69f692c67c15f89630604646e76c872b6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #8484 +/- ##
============================================
- Coverage 93.94% 93.94% -0.01%
Complexity 4827 4827
============================================
Files 1209 1209
Lines 49705 49703 -2
Branches 6074 6074
============================================
- Hits 46695 46693 -2
Misses 1522 1522
Partials 1488 1488
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | | *Carryforward flag |
|---|---|---|---|
| [access-control-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `80.18% <ø> (ø)` | | |
| [agent-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `99.32% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [amber](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `89.92% <ø> (-0.01%)` | :arrow_down: | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [computing-unit-managing-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `75.05% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [config-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `87.12% <ø> (ø)` | | |
| [file-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.65% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [frontend](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `96.77% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [notebook-migration-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `83.73% <ø> (ø)` | | |
| [pyamber](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `98.47% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [workflow-compiling-service](https://app.codecov.io/gh/apache/texera/pull/8484/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `77.19% <ø> (ø)` | | Carriedforward from [ec3a9dd](https://app.codecov.io/gh/apache/texera/commit/ec3a9dd3ca9c361cbd7f339d8bc78669024e84e8?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
*This pull request uses carry forward flags. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/texera/pull/8484?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-5623266450
<!-- texera-benchmarks-comment -->
## ⚠️ Benchmark changes need a look
🟢 2 better · 🔴 3 worse · ⚪ 10 noise (<±5%) · 0 without baseline
> Compared against main `ded7ba1` benchmarked on **this same runner**, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.
[Dashboard](https://apache.github.io/texera/dev/bench/) · [Run](https://github.com/apache/texera/actions/runs/34511978082)
| | config | throughput | MB/s | latency | max Δ latest / 7d |
|---|---|---:|---:|---:|---:|
| 🔴 | bs=10 sw=10 sl=64 | 419 | 0.256 | 24,036/31,032/31,032 us | 🔴 +14.7% / 🔴 +92.3% |
| 🟢 | bs=100 sw=10 sl=64 | 925 | 0.565 | 105,845/138,018/138,018 us | 🟢 -7.6% / 🔴 +27.0% |
| ⚪ | bs=1000 sw=10 sl=64 | 1,086 | 0.663 | 924,025/990,868/990,868 us | ⚪ within ±5% / 🟢 -7.6% |
<details><summary>Baseline details</summary>
Latest main `ded7ba1` from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---:|---:|---:|---:|---:|
| bs=10 sw=10 sl=64 | throughput | 419 tuples/sec | 453 tuples/sec | 755.28 tuples/sec | -7.5% | -44.5% |
| bs=10 sw=10 sl=64 | MB/s | 0.256 MB/s | 0.276 MB/s | 0.461 MB/s | -7.2% | -44.5% |
| bs=10 sw=10 sl=64 | p50 | 24,036 us | 20,949 us | 12,957 us | +14.7% | +85.5% |
| bs=10 sw=10 sl=64 | p95 | 31,032 us | 32,247 us | 16,134 us | -3.8% | +92.3% |
| bs=10 sw=10 sl=64 | p99 | 31,032 us | 32,247 us | 20,333 us | -3.8% | +52.6% |
| bs=100 sw=10 sl=64 | throughput | 925 tuples/sec | 950 tuples/sec | 980.1 tuples/sec | -2.6% | -5.6% |
| bs=100 sw=10 sl=64 | MB/s | 0.565 MB/s | 0.58 MB/s | 0.598 MB/s | -2.6% | -5.6% |
| bs=100 sw=10 sl=64 | p50 | 105,845 us | 103,451 us | 101,894 us | +2.3% | +3.9% |
| bs=100 sw=10 sl=64 | p95 | 138,018 us | 149,307 us | 108,718 us | -7.6% | +27.0% |
| bs=100 sw=10 sl=64 | p99 | 138,018 us | 149,307 us | 122,482 us | -7.6% | +12.7% |
| bs=1000 sw=10 sl=64 | throughput | 1,086 tuples/sec | 1,101 tuples/sec | 1,011 tuples/sec | -1.4% | +7.4% |
| bs=1000 sw=10 sl=64 | MB/s | 0.663 MB/s | 0.672 MB/s | 0.617 MB/s | -1.3% | +7.4% |
| bs=1000 sw=10 sl=64 | p50 | 924,025 us | 905,258 us | 996,422 us | +2.1% | -7.3% |
| bs=1000 sw=10 sl=64 | p95 | 990,868 us | 986,338 us | 1,037,670 us | +0.5% | -4.5% |
| bs=1000 sw=10 sl=64 | p99 | 990,868 us | 986,338 us | 1,072,152 us | +0.5% | -7.6% |
</details>
<details><summary>Raw CSV</summary>
```csv
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,477.77,200,128000,419,0.256,24036.19,31031.70,31031.70
1,100,10,64,20,2161.79,2000,1280000,925,0.565,105845.27,138018.28,138018.28
2,1000,10,64,20,18413.24,20000,12800000,1086,0.663,924025.35,990867.74,990867.74
```
</details>
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on code in PR #8484:
URL: https://github.com/apache/texera/pull/8484#discussion_r4394514026
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpDesc.scala:
##########
@@ -29,9 +30,14 @@ import org.apache.texera.amber.util.JSONUtils.objectMapper
class SpecializedFilterOpDesc extends FilterOpDesc {
@JsonProperty(value = "predicates", required = true)
- @JsonPropertyDescription("multiple predicates in OR")
+ @JsonPropertyDescription("multiple predicates to be combined")
var predicates: List[FilterPredicate] = List.empty
+ @JsonProperty(required = true, defaultValue = "any (OR)")
+ @JsonSchemaTitle("Combine Predicates With")
+ @JsonPropertyDescription("how to combine multiple predicates")
+ var predicateCombinator: PredicateCombinator = PredicateCombinator.OR
Review Comment:
Two things here:
- `required = true` puts `predicateCombinator` in the schema's `required` list.
- Workflows saved before this PR don't have that key, and nothing fills in schema defaults when a workflow loads.
- The frontend validator then rejects every existing Filter: Run shows "Invalid Workflow" until someone opens each Filter's property panel, and Form View readers can't fix it at all.
- Projection's `isDrop` and Keyword Search's `isCaseSensitive` went in the same way, but here it's free to avoid. Making it optional keeps the default and the preselected dropdown, like `Histogram2DOpDesc`'s normalization property does.
- Could you declare it above `predicates`, as #6939 proposed? Right now the dropdown renders below every predicate row and the add button, so with several predicates you can't see which mode applies.
```suggestion
@JsonProperty(required = false, defaultValue = "any (OR)")
@JsonSchemaTitle("Combine Predicates With")
@JsonPropertyDescription("how to combine multiple predicates")
var predicateCombinator: PredicateCombinator = PredicateCombinator.OR
@JsonProperty(value = "predicates", required = true)
@JsonPropertyDescription("multiple predicates to be combined")
var predicates: List[FilterPredicate] = List.empty
```
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpExec.scala:
##########
@@ -25,5 +25,11 @@ import org.apache.texera.amber.util.JSONUtils.objectMapper
class SpecializedFilterOpExec(descString: String) extends FilterOpExec {
private val desc: SpecializedFilterOpDesc =
objectMapper.readValue(descString, classOf[SpecializedFilterOpDesc])
- setFilterFunc((tuple: Tuple) => desc.predicates.exists(_.evaluate(tuple)))
+ setFilterFunc((tuple: Tuple) =>
+ desc.predicateCombinator match {
+ case PredicateCombinator.AND =>
+ desc.predicates.nonEmpty && desc.predicates.forall(_.evaluate(tuple))
+ case _ => desc.predicates.exists(_.evaluate(tuple))
+ }
+ )
Review Comment:
Nit: with `case _`, a future third combinator would silently run as OR. Naming `OR` explicitly gets a compiler warning instead, and choosing the function once avoids re-matching on every tuple. No null case is needed: `getPhysicalOp` serializes without nulls, so the executor always gets the OR default.
```suggestion
setFilterFunc(desc.predicateCombinator match {
case PredicateCombinator.AND =>
(tuple: Tuple) => desc.predicates.nonEmpty && desc.predicates.forall(_.evaluate(tuple))
case PredicateCombinator.OR =>
(tuple: Tuple) => desc.predicates.exists(_.evaluate(tuple))
})
```
##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpDescSpec.scala:
##########
@@ -70,4 +75,27 @@ class SpecializedFilterOpDescSpec extends AnyFlatSpec with Matchers {
restored shouldBe a[SpecializedFilterOpDesc]
restored.asInstanceOf[SpecializedFilterOpDesc].predicates shouldBe empty
}
+
+ "SpecializedFilterOpDesc" should
Review Comment:
Could you also test bad input at this level? Two cases:
- `"predicateCombinator": "xor"` read as `LogicalOp` should fail with a `ValueInstantiationException` that names the field.
- An executor built from JSON with `"predicateCombinator": null` should behave as OR.
AGENTS.md's test rules ask for bad-input coverage on user input.
##########
common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/filter/SpecializedFilterOpExecSpec.scala:
##########
@@ -135,4 +139,65 @@ class SpecializedFilterOpExecSpec extends AnyFlatSpec with BeforeAndAfter {
opExec.close()
})
}
+
+ it should "keep a tuple under OR when only one predicate matches" in {
+ opDesc.predicates = List(
+ new FilterPredicate("int", ComparisonType.EQUAL_TO, "0"),
+ new FilterPredicate("string", ComparisonType.EQUAL_TO, "world")
+ )
+ opDesc.predicateCombinator = PredicateCombinator.OR
+ val opExec = new SpecializedFilterOpExec(objectMapper.writeValueAsString(opDesc))
+ opExec.open()
+ assert(opExec.processTuple(nonNullTuple, inputPort).nonEmpty)
+ opExec.close()
+ }
+
+ it should "drop a tuple under AND when only one predicate matches" in {
Review Comment:
Every AND case puts `int = 0` first, and that predicate is true for `nonNullTuple`. So no test shows the first predicate can reject a row under AND: `predicates.tail.forall(...)` or `predicates.last.evaluate(...)` would pass the whole suite. Could you add the same pair in the other order?
```scala
it should "drop a tuple under AND when the first predicate fails" in {
opDesc.predicates = List(
new FilterPredicate("string", ComparisonType.EQUAL_TO, "world"),
new FilterPredicate("int", ComparisonType.EQUAL_TO, "0")
)
opDesc.predicateCombinator = PredicateCombinator.AND
val opExec = new SpecializedFilterOpExec(objectMapper.writeValueAsString(opDesc))
opExec.open()
assert(opExec.processTuple(nonNullTuple, inputPort).isEmpty)
opExec.close()
}
```
Minor: line 148 does nothing, because the `before` hook already resets the combinator to OR.
##########
common/workflow-operator/src/main/scala/org/apache/texera/amber/operator/filter/PredicateCombinator.java:
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.operator.filter;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonValue;
+
+public enum PredicateCombinator {
+ OR("any (OR)"),
+
+ AND("all (AND)");
+
+ private final String name;
+
+ private PredicateCombinator(String name) {
+ this.name = name;
+ }
+
+ // use the name string instead of enum string in JSON
+ @JsonValue
+ public String getName() {
+ return this.name;
+ }
+
+ // Handle custom deserialization for enum
Review Comment:
Optional: Jackson already reads a `@JsonValue` enum back from its value, and most enums in this module (`JoinType`, for example) don't have this creator. Fine to keep if you'd rather match `ComparisonType`.
##########
docs/reference/operators/data-cleaning/filter.md:
##########
@@ -31,10 +31,11 @@ tags: [data-cleaning]
| Property | Requirement | Type | Default | Description |
|----------|-------------|------|---------|-------------|
-| Predicates | ✓ | List<Filter Predicate> | - | Multiple predicates in OR |
+| Predicates | ✓ | List<Filter Predicate> | - | Multiple predicates to be combined |
| ↳ Attribute | ✓ | String | - | |
| ↳ Condition | ✓ | =, >, >=, <, <=, !=, is null,<br>is not null | - | |
| ↳ Value | | String | - | |
+| Combine Predicates With | ✓ | any (OR), all (AND) | any (OR) | How to combine multiple predicates |
Review Comment:
If the property becomes optional, drop the ✓, and if it moves above Predicates, move this row up too. Also worth one line saying that "all (AND)" with no predicates keeps no rows, since most people expect "all" of nothing to keep everything.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub)" <gi...@apache.org>.
gupta-sahil01 commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-6448128405
Any updates here @aglinxinyuan ?
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-5623190645
<!-- texera-reviewer-suggestion -->
### Automated Reviewer Suggestions
Based on the `git blame` history of the changed files, we recommend the following reviewers:
- **Committers with relevant context:** `@parshimers`
You can request their reviews formally with `/request-review @parshimers`.
- **Contributors with relevant context:** `@Yicong-Huang`, `@aglinxinyuan`
You can notify them by mentioning `@Yicong-Huang`, `@aglinxinyuan` in a comment.
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub)" <gi...@apache.org>.
gupta-sahil01 commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-5623474852
/request-review @parshimers
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] feat(workflow-operator): let Filter combine predicates with AND [texera]
Posted by "gupta-sahil01 (via GitHub) via notifications" <no...@texera.apache.org>.
gupta-sahil01 commented on PR #8484:
URL: https://github.com/apache/texera/pull/8484#issuecomment-6810114216
Rebased onto main and addressed the review. The Python export now joins with & under AND, the exists comments are reworded, and there's a two-predicate AND export test. predicateCombinator is now optional, so saved Filters stay valid. _index.md is updated. Filter tests pass locally (76 passed; 4 pandas parity tests skipped locally because pandas isn't installed).
--
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.
To unsubscribe, e-mail: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org