Skip to content

Conversation

@mustafahasankhan
Copy link
Contributor

Summary

Optimizes the SearchUtils._apply_operator_condition method by introducing dictionary-based dispatch for frequently used operators, reducing lookup time from O(n) to O(1) for common operations while maintaining 100% backwards compatibility.

Changes

  • Added OPERATOR_MAP class constant with lambda functions for known PyAtlan operators
  • Replaced if-elif chain with dictionary lookup for common operators (eq, startswith, lt, lte, gt, gte, match, has_any_value)
  • Preserved original fallback mechanism for operators not in the map (ensures neq, contains, and any runtime-available operators continue to work)

Performance Impact

  • Before: O(n) operator lookup through if-elif chain (up to 11 comparisons)
  • After: O(1) dictionary lookup for common operators, fallback for others

Backwards Compatibility

✅ 100% backwards compatible - all changes are internal optimizations:

Testing

  • Tested with operators: eq, neq, contains, startswith, between, gt, lt
  • Verified fallback mechanism works for operators not in map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants