Skip to content

Conversation

@ddelnano
Copy link
Member

@ddelnano ddelnano commented Aug 17, 2023

Summary: Add compiler optimization to remove px.contains calls with empty strings

The majority of our pxl scripts have parameters that default to empty strings. This results in px.contains function calls that will always return the original data set (an empty string "" will always be found in any input string). An example of this can be seen in the following screenshot (the filter arguments highlighted below):

Screenshot 2023-08-17 at 8 27 35 AM

Relevant Issues: Fixes #618

Type of change: /kind feature

Test Plan: Used analyze and explain query options to test the following conditions:

  • Verified what the http_data pxl script looks like when there are no arguments supplied without any optimizations -- graphviz_with_empty_contains
  • Verified what the http_data pxl script looks like if the px.contains calls here are removed from the script. The optimization should produce the same graph as this case. -- graphviz_without_empty_contains
  • Verified the optimization results in the expected query graph and loaded a variety of pxl scripts to make sure queries appeared normal -- latest_graphviz_with_optimization

ddelnano and others added 10 commits August 11, 2023 22:42
…return false

Test Plan:
- New unit tests pass
- [ ] Verify in a staging environment that a query explain shows the nodes removed

Signed-off-by: Dom Del Nano <ddelnano@newrelic.com>

Differential Revision: https://phab.corp.pixielabs.ai/D12911

(cherry picked from commit 555043957b94f16e2163d1429b6f979d5fe77cec)
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
…ains are pruned

Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
… correct behavior

Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
@ddelnano ddelnano requested a review from a team August 17, 2023 15:35
…hange

Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
@ddelnano
Copy link
Member Author

Moved this to a draft since I didn't expect to run into the sanitization issues and bugs with the GCC build. @pixie-io/maintainers would appreciate a review to see if you have any comments in addition to the fixes I need to get a passing build.

@ddelnano ddelnano marked this pull request as draft August 17, 2023 16:05
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
@ddelnano ddelnano force-pushed the ddelnano/add-contains-compiler-optimization branch 2 times, most recently from b4bfd92 to 73c4fd7 Compare August 18, 2023 06:41
Signed-off-by: Dom Del Nano <ddelnano@pixielabs.ai>
@ddelnano ddelnano force-pushed the ddelnano/add-contains-compiler-optimization branch from 73c4fd7 to 3274a56 Compare August 18, 2023 06:41
@ddelnano ddelnano marked this pull request as ready for review August 18, 2023 15:23
@JamesMBartlett JamesMBartlett merged commit 9a4ad3c into pixie-io:main Aug 21, 2023
@ddelnano ddelnano deleted the ddelnano/add-contains-compiler-optimization branch December 6, 2023 21:42
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.

PxL Compiler Optimization: Drop filters using px.contains() with empty strings

2 participants