Liu Zhengri created CALCITE-7632:
------------------------------------
Summary: Replace java.util.Stack with java.util.ArrayDeque in
Pattern and TopDownRuleDriver
Key: CALCITE-7632
URL: https://issues.apache.org/jira/browse/CALCITE-7632
Project: Calcite
Issue Type: Improvement
Components: core
Reporter: Liu Zhengri
Replace `java.util.Stack` (which extends `Vector` with unnecessary
synchronization overhead) with `java.util.ArrayDeque` in two locations:
1. `Pattern.java` - `PatternBuilder.stack` field (used for SQL MATCH_RECOGNIZE
NFA pattern matching)
2. `TopDownRuleDriver.java` - task queue (used for Volcano optimizer top-down
Cascades-style optimization)
This eliminates the `@SuppressWarnings("JdkObsolete")` annotations and `//
TODO: replace with Deque` comments that have existed since CALCITE-4314 (2020).
Benefits:
- `Stack` extends `Vector` with synchronized methods (unnecessary lock overhead
in single-threaded contexts)
- `ArrayDeque` is non-synchronized and officially recommended by Java
documentation as a replacement for `Stack`
- Removes Error Prone `JdkObsolete` warnings
- Better memory expansion strategy (ArrayDeque doubles capacity vs Vector
linear growth)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)