Skip to content

Conversation

@Dayuxiaoshui
Copy link
Contributor

Title

Type

  • feat: (new feature)
  • fix: (bug fix)
  • docs: (doc update)
  • refactor: (refactor code)
  • test: (test code)
  • chore: (other updates)

Scope

  • query: (query engine)
    • parser: (frontend parser)
    • planner: (frontend planner)
    • optimizer: (query optimizer)
    • executor: (execution engine)
    • op: (operators)
  • storage: (storage engine)
    • mvcc: (multi version concurrency control)
    • schema: (graph model and topology)
  • tool: (tools)
    • cli: (cli)
    • sdk: (sdk)
  • none: (N/A)

Description

Issue:

This PR completes the ScalarValue type support for aggregation functions in the execution engine. The aggregate executor now handles all possible ScalarValue variants with proper error handling and NULL safety.

Key Changes:

  • Added Boolean type support for Sum/Avg operations (converts true/false to 1.0/0.0)
  • Added Boolean type support for Min/Max operations (direct boolean comparison)
  • Added comprehensive error handling for unsupported types:
    • String type returns error for Sum/Avg operations
    • Vector/Vertex/Edge types return error for all aggregation operations
  • Added complete NULL value handling:
    • ScalarValue::Null is ignored in aggregation
    • All None variants (Boolean(None), Int8(None), etc.) are ignored
  • Updated AggregateState structs:
    • Added min_bool and max_bool fields to Min/Max variants
    • Updated constructors and finalize functions
  • Ensured exhaustive pattern matching for all ScalarValue variants
  • Removed all TODO comments related to type handling

Testing:

  • All 23 existing aggregate tests pass
  • No breaking changes to existing functionality
  • Complete type coverage with proper error handling

Checklist

  • I have prepared the pull request title according to the requirements.
  • I have successfully run all unit tests and integration tests.
  • I have already rebased the latest master branch.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.

…nctions

- Add Boolean type support for Sum/Avg (converts to 0.0/1.0)
- Add Boolean type support for Min/Max (direct comparison)
- Add comprehensive error handling for unsupported types:
  - String type: returns error for Sum/Avg operations
  - Vector/Vertex/Edge: returns error for all aggregation operations
- Add complete NULL value handling:
  - ScalarValue::Null: ignored in aggregation
  - All None variants (Boolean(None), Int8(None), etc.): ignored
- Update AggregateState structs:
  - Add min_bool and max_bool fields to Min/Max variants
  - Update constructors and finalize functions
- Ensure exhaustive pattern matching for all ScalarValue variants
- Remove all TODO comments related to type handling

All 23 aggregate tests pass. The aggregate executor now supports
complete type coverage with proper error handling and NULL safety.
- Replace boolean order comparisons with logical operations:
  - Min: *v < *current -> !(*v) && *current
  - Max: *v > *current -> *v && !(*current)
- Apply cargo fmt to fix code formatting issues
- All tests still pass after changes
@Dayuxiaoshui
Copy link
Contributor Author

@ColinLeeo 请求审查一下

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.

1 participant