Skip to content

ability to have null and not null operators in filter & case when op#1703

Merged
Ishankoradia merged 2 commits into
mainfrom
null-logical-operations
Mar 9, 2026
Merged

ability to have null and not null operators in filter & case when op#1703
Ishankoradia merged 2 commits into
mainfrom
null-logical-operations

Conversation

@Ishankoradia

@Ishankoradia Ishankoradia commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Added IS NULL and IS NOT NULL logical operators for workflow filtering and case-when clauses.
    • UI now hides operand selection when a null-check operator is chosen, simplifying input.
    • Save/edit and prefill behavior updated so clauses using null-check operators emit empty/no operands, preserving previous behavior for other operators.

@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

Adds IS NULL and IS NOT NULL operators to two form components. When a null-check operator is selected, operand UI controls are hidden and the form emits empty/null operands; non-null operators retain existing operand handling and validation.

Changes

Cohort / File(s) Summary
CaseWhen form updates
src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/CaseWhenOpForm.tsx
Added IS NULL and IS NOT NULL to LogicalOperators. Adjusted operand slicing/mapping so clauses with null-check operators emit empty operands; preserved between/single-operand behavior for other operators and updated prefill/edit payload logic.
Where filter form updates
src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/WhereFilterOpForm.tsx
Introduced detection of null-check operators (isNullOperator). Hides operand type/column/value controls for null operators, initializes operands appropriately in edit/prefill, and constructs payloads that set operand to null for IS NULL/IS NOT NULL; retains prior column/value structure and validation for other operators.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding IS NULL and IS NOT NULL operators to filter and case-when operations in the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch null-logical-operations

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/CaseWhenOpForm.tsx`:
- Around line 393-399: The current logic sets operands to [] for null operators
which causes useFieldArray to have zero rows and prevents adding operands when
switching to non-null operators; change the initialization in CaseWhenOpForm so
that when clause.operator is a null-check ('IS NULL'/'IS NOT NULL') you still
provide a minimal operand array (e.g., reuse clause.operands if present or
supply a single empty GenericOperand placeholder) instead of an empty array;
update the operands mapping where operands: ... is created (referencing
clause.operator and clause.operands) so the field array always has at least one
operand row to render and edit when the operator changes.
- Around line 117-118: The compile error arises because data.logicalOp?.id is
string | undefined and is passed to Array.prototype.includes; fix by narrowing
the type before calling includes—add a small helper (e.g., function
isNullCheckOp(id?: string): boolean) in CaseWhenOpForm that returns id !==
undefined && ['IS NULL', 'IS NOT NULL'].includes(id), then replace occurrences
of ['IS NULL', 'IS NOT NULL'].includes(data.logicalOp?.id) with
isNullCheckOp(data.logicalOp?.id); ensure both spots (the usage in the
render/logic and the other occurrence) call the helper so includes always
receives a string.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9db4b710-2c9a-4cb2-bc4d-5f4dafccb03b

📥 Commits

Reviewing files that changed from the base of the PR and between 7761cf2 and dfb890a.

📒 Files selected for processing (2)
  • src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/CaseWhenOpForm.tsx
  • src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/WhereFilterOpForm.tsx

Comment on lines +393 to +399
operands: ['IS NULL', 'IS NOT NULL'].includes(clause.operator)
? [] // Empty operands for null operators
: clause.operands.map((op: GenericOperand) => ({
type: op.is_col ? 'col' : 'val',
col_val: op.is_col ? op.value : '',
const_val: !op.is_col ? op.value : '',
})),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Prefilling operands: [] can block editing from null-op to non-null-op.

In edit mode, initializing null operators with an empty operand array can leave useFieldArray with zero operand rows; switching to =/between then has no operand controls to populate.

Suggested fix
- operands: ['IS NULL', 'IS NOT NULL'].includes(clause.operator)
-   ? [] // Empty operands for null operators
+ operands: ['IS NULL', 'IS NOT NULL'].includes(clause.operator)
+   ? [
+       { type: 'val', col_val: '', const_val: '' },
+       { type: 'val', col_val: '', const_val: '' },
+     ]
    : clause.operands.map((op: GenericOperand) => ({
        type: op.is_col ? 'col' : 'val',
        col_val: op.is_col ? op.value : '',
        const_val: !op.is_col ? op.value : '',
      })),
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/components/TransformWorkflow/FlowEditor/Components/OperationPanel/Forms/CaseWhenOpForm.tsx`
around lines 393 - 399, The current logic sets operands to [] for null operators
which causes useFieldArray to have zero rows and prevents adding operands when
switching to non-null operators; change the initialization in CaseWhenOpForm so
that when clause.operator is a null-check ('IS NULL'/'IS NOT NULL') you still
provide a minimal operand array (e.g., reuse clause.operands if present or
supply a single empty GenericOperand placeholder) instead of an empty array;
update the operands mapping where operands: ... is created (referencing
clause.operator and clause.operands) so the field array always has at least one
operand row to render and edit when the operator changes.

is_col: op.type === 'col',
}))
.slice(0, clause.logicalOp?.id === 'between' ? 2 : 1),
operands: ['IS NULL', 'IS NOT NULL'].includes(clause.logicalOp?.id)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows some type script error can you check.
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2345)
(property) logicalOp: {
id: string;
label: string;
} | null

.slice(0, data.logicalOp?.id === 'between' ? 2 : 1)
.slice(
0,
['IS NULL', 'IS NOT NULL'].includes(data.logicalOp?.id)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has a typescript error,
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2345)
(property) logicalOp: {
id: string;
label: string;
} | null

@sentry

sentry Bot commented Mar 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 45.00000% with 22 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.32%. Comparing base (7761cf2) to head (7d29609).

Files with missing lines Patch % Lines
...ponents/OperationPanel/Forms/WhereFilterOpForm.tsx 36.36% 11 Missing and 3 partials ⚠️
...Components/OperationPanel/Forms/CaseWhenOpForm.tsx 55.55% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1703      +/-   ##
==========================================
- Coverage   75.36%   75.32%   -0.05%     
==========================================
  Files         107      107              
  Lines        7973     7991      +18     
  Branches     1929     1946      +17     
==========================================
+ Hits         6009     6019      +10     
- Misses       1840     1934      +94     
+ Partials      124       38      -86     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Ishankoradia Ishankoradia merged commit 58f17d9 into main Mar 9, 2026
3 of 6 checks passed
@Ishankoradia Ishankoradia deleted the null-logical-operations branch March 9, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants