Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ruleengine): fix duplicate payload problems #11172

Merged
merged 3 commits into from Jul 5, 2023

Conversation

lafirest
Copy link
Member

@lafirest lafirest commented Jun 30, 2023

Fixes EMQX-10197

Summary

馃 Generated by Copilot at 95973a3

Added path aliases for SQL queries in rule engine. This allows users to refer to nested payload fields with shorter names in the SELECT clause. Refactored some internal functions in emqx_rule_runtime.erl to support this feature.

PR Checklist

Please convert it to a draft if any of the following conditions are not met. Reviewers may skip over until all the items are checked:

  • Added tests for the changes
  • Changed lines covered in coverage report
  • Change log has been added to changes/{ce,ee}/(feat|perf|fix)-<PR-id>.en.md files
  • For internal contributor: there is a jira ticket to track this change
  • If there should be document changes, a PR to emqx-docs.git is sent, or a jira ticket is created to follow up
  • Schema changes are backward compatible

Checklist for CI (.github/workflows) changes

  • If changed package build workflow, pass this action (manual trigger)
  • Change log has been added to changes/ dir for user-facing artifacts update

?ephemeral_alias(unknown, unknown).

handle_path_alias({path, [{key, <<"payload">>} | Rest]}, #{payload := _Payload} = _Columns) ->
Copy link
Member Author

Choose a reason for hiding this comment

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

make sure the payload in the path has the same type as it in the columns or it possibly be duplicated

@lafirest lafirest marked this pull request as ready for review July 3, 2023 06:41
@lafirest lafirest requested review from a team and kjellwinblad as code owners July 3, 2023 06:41
@lafirest lafirest marked this pull request as draft July 3, 2023 06:43
@lafirest lafirest marked this pull request as ready for review July 3, 2023 07:03
@lafirest lafirest force-pushed the fix/dup_payload branch 3 times, most recently from c7e91e0 to cd4e421 Compare July 3, 2023 08:47
@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 5443373944

  • 6 of 8 (75.0%) changed or added relevant lines in 2 files are covered.
  • 32 unchanged lines in 10 files lost coverage.
  • Overall coverage increased (+0.05%) to 81.974%

Changes Missing Coverage Covered Lines Changed/Added Lines %
apps/emqx_rule_engine/src/emqx_rule_funcs.erl 0 1 0.0%
apps/emqx_rule_engine/src/emqx_rule_runtime.erl 6 7 85.71%
Files with Coverage Reduction New Missed Lines %
apps/emqx_gateway_mqttsn/src/emqx_mqttsn_frame.erl 1 64.61%
apps/emqx_rule_engine/src/emqx_rule_runtime.erl 1 76.92%
apps/emqx/src/emqx_connection.erl 1 83.7%
apps/emqx/src/emqx_pool.erl 1 94.12%
apps/emqx/src/emqx_banned.erl 2 89.55%
apps/emqx/src/emqx_channel.erl 2 87.56%
apps/emqx_ft/src/emqx_ft_storage_exporter_fs.erl 4 78.26%
apps/emqx_resource/src/emqx_resource_metrics.erl 4 53.68%
apps/emqx_resource/src/emqx_resource_buffer_worker.erl 5 93.12%
apps/emqx/src/emqx_reason_codes.erl 11 87.5%
Totals Coverage Status
Change from base Build 5439762080: 0.05%
Covered Lines: 30709
Relevant Lines: 37462

馃挍 - Coveralls

@lafirest lafirest merged commit bf5167a into emqx:master Jul 5, 2023
140 checks passed
@lafirest lafirest deleted the fix/dup_payload branch July 5, 2023 06:20
lafirest added a commit to lafirest/emqx that referenced this pull request Jul 24, 2023
lafirest added a commit that referenced this pull request Jul 24, 2023
fix(nested_put): fix a data loss bug introduced by #11172
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.

None yet

3 participants