Skip to content

[Feature] Add "in" Operator to FilterTransform for Array Membership Filtering #20990

Open
@mrwunderbar666

Description

@mrwunderbar666

What problem does this feature solve?

Currently, the FilterTransform in Apache ECharts supports a rich set of conditional expressions including relational and logical operators (lt, gt, eq, reg, and, or, not, etc.). However, it does not support a mechanism to check whether a data value exists within a specified list—commonly known as an "in" operation.

Please add support for an in operator in RelationalExpressionOption, allowing developers to filter values based on membership in a list or array. This would greatly enhance the expressiveness and efficiency of data filtering within ECharts.

  • Many filtering scenarios require selecting rows where a field matches one of several known values.
  • Current alternatives require verbose or expressions, which are harder to write, maintain, and optimize.
  • The in operator is standard in SQL and many query DSLs, and users naturally expect this functionality.
  • Improves developer ergonomics and code clarity.
  • Aligns with common querying patterns.
  • Enhances performance for large datasets by allowing ECharts to optimize "in" checks internally.

What does the proposed API look like?

type RelationalExpressionOption = {
  dimension: DimensionName | DimensionIndex;
  parser?: 'time' | 'trim' | 'number';
  in?: DataValue[];  // New operator for array membership
  notIn?: DataValue[]; // Optional complement for exclusion
  // existing operators...
};

// Usage example:
transform: {
  type: 'filter',
  config: {
    in: ['Apple', 'Banana', 'Orange'],
    dimension: 'fruit'
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enThis issue is in Englishnew-featurependingWe are not sure about whether this is a bug/new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions