Skip to content

fix: 优化contains_all方法中,参数为空时的判断 #29

Merged
zhou-hao merged 6 commits intojetlinks:masterfrom
kyouji:master
Oct 23, 2025
Merged

fix: 优化contains_all方法中,参数为空时的判断 #29
zhou-hao merged 6 commits intojetlinks:masterfrom
kyouji:master

Conversation

@kyouji
Copy link
Contributor

@kyouji kyouji commented Oct 21, 2025

contains_all的参数为null时,应该返回false

kyouji added 4 commits March 20, 2025 10:24
# Conflicts:
#	src/main/java/org/jetlinks/reactor/ql/supports/DefaultReactorQLMetadata.java
contains_all参数为null时,应该返回false
@kyouji
Copy link
Contributor Author

kyouji commented Oct 21, 2025

@zhou-hao 大佬帮忙看看

TreeSet<Object> set =
CastUtils.castCollection(first, new TreeSet<>(CompareUtils::compare));

Flux<?> cache = flux.skip(1).cache();
Copy link
Member

Choose a reason for hiding this comment

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

可以不用cache判断吧?
flux.map(val-> handleContain() )
.defaultIfEmpty()
.all 这样?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

不行。flatStream方法会把空数组转换为empty的Flux。无法区分空数组的情况

Copy link
Member

Choose a reason for hiding this comment

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

直接map里判断撒. 不执行flatStream.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

可以了,改为了用两次defaultIfEmpty判断。按contains_all的语义,空数组应该返回true。

@kyouji kyouji requested a review from zhou-hao October 22, 2025 10:16
@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.00%. Comparing base (075f9c7) to head (82fd39e).

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #29      +/-   ##
============================================
+ Coverage     86.94%   87.00%   +0.06%     
- Complexity      959      962       +3     
============================================
  Files            63       63              
  Lines          2574     2586      +12     
  Branches        359      359              
============================================
+ Hits           2238     2250      +12     
  Misses          172      172              
  Partials        164      164              

☔ 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.

});
return flux
.skip(1)
.flatMap(val -> Flux
Copy link
Member

Choose a reason for hiding this comment

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

使用concatMap. 内存更友好.

@zhou-hao zhou-hao merged commit 0045add into jetlinks:master Oct 23, 2025
2 checks passed
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.

2 participants