PhysicalPlanDSL.java

1
/*
2
 * Copyright OpenSearch Contributors
3
 * SPDX-License-Identifier: Apache-2.0
4
 */
5
6
7
package org.opensearch.sql.planner.physical;
8
9
import com.google.common.collect.ImmutableList;
10
import com.google.common.collect.ImmutableSet;
11
import java.util.Arrays;
12
import java.util.List;
13
import java.util.Map;
14
import lombok.experimental.UtilityClass;
15
import org.apache.commons.lang3.tuple.Pair;
16
import org.opensearch.sql.ast.tree.RareTopN.CommandType;
17
import org.opensearch.sql.ast.tree.Sort.SortOption;
18
import org.opensearch.sql.expression.Expression;
19
import org.opensearch.sql.expression.LiteralExpression;
20
import org.opensearch.sql.expression.NamedExpression;
21
import org.opensearch.sql.expression.ReferenceExpression;
22
import org.opensearch.sql.expression.aggregation.NamedAggregator;
23
import org.opensearch.sql.expression.window.WindowDefinition;
24
25
/**
26
 * Physical Plan DSL.
27
 */
28
@UtilityClass
29
public class PhysicalPlanDSL {
30
31
  public static AggregationOperator agg(
32
      PhysicalPlan input, List<NamedAggregator> aggregators, List<NamedExpression> groups) {
33 1 1. agg : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::agg → KILLED
    return new AggregationOperator(input, aggregators, groups);
34
  }
35
36
  public static FilterOperator filter(PhysicalPlan input, Expression condition) {
37 1 1. filter : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::filter → KILLED
    return new FilterOperator(input, condition);
38
  }
39
40
  public static RenameOperator rename(
41
      PhysicalPlan input, Map<ReferenceExpression, ReferenceExpression> renameMap) {
42 1 1. rename : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rename → KILLED
    return new RenameOperator(input, renameMap);
43
  }
44
45
  public static ProjectOperator project(PhysicalPlan input, NamedExpression... fields) {
46 1 1. project : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::project → KILLED
    return new ProjectOperator(input, Arrays.asList(fields), ImmutableList.of());
47
  }
48
49
  public static ProjectOperator project(PhysicalPlan input, List<NamedExpression> fields,
50
                                        List<NamedExpression> namedParseExpressions) {
51 1 1. project : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::project → KILLED
    return new ProjectOperator(input, fields, namedParseExpressions);
52
  }
53
54
  public static RemoveOperator remove(PhysicalPlan input, ReferenceExpression... fields) {
55 1 1. remove : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::remove → KILLED
    return new RemoveOperator(input, ImmutableSet.copyOf(fields));
56
  }
57
58
  public static EvalOperator eval(
59
      PhysicalPlan input, Pair<ReferenceExpression, Expression>... expressions) {
60 1 1. eval : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::eval → KILLED
    return new EvalOperator(input, Arrays.asList(expressions));
61
  }
62
63
  public static SortOperator sort(PhysicalPlan input, Pair<SortOption,
64
      Expression>... sorts) {
65 1 1. sort : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::sort → KILLED
    return new SortOperator(input, Arrays.asList(sorts));
66
  }
67
68
  public static DedupeOperator dedupe(PhysicalPlan input, Expression... expressions) {
69 1 1. dedupe : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::dedupe → KILLED
    return new DedupeOperator(input, Arrays.asList(expressions));
70
  }
71
72
  public static DedupeOperator dedupe(
73
      PhysicalPlan input,
74
      int allowedDuplication,
75
      boolean keepEmpty,
76
      boolean consecutive,
77
      Expression... expressions) {
78 1 1. dedupe : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::dedupe → KILLED
    return new DedupeOperator(
79
        input, Arrays.asList(expressions), allowedDuplication, keepEmpty, consecutive);
80
  }
81
82
  public WindowOperator window(PhysicalPlan input,
83
                               NamedExpression windowFunction,
84
                               WindowDefinition windowDefinition) {
85 1 1. window : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::window → KILLED
    return new WindowOperator(input, windowFunction, windowDefinition);
86
  }
87
88
  public static RareTopNOperator rareTopN(PhysicalPlan input, CommandType commandType,
89
                                          List<Expression> groups, Expression... expressions) {
90 1 1. rareTopN : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rareTopN → KILLED
    return new RareTopNOperator(input, commandType, Arrays.asList(expressions), groups);
91
  }
92
93
  public static RareTopNOperator rareTopN(PhysicalPlan input, CommandType commandType,
94
                                          int noOfResults,
95
                                          List<Expression> groups, Expression... expressions) {
96 1 1. rareTopN : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rareTopN → KILLED
    return new RareTopNOperator(input, commandType, noOfResults, Arrays.asList(expressions),
97
        groups);
98
  }
99
100
  @SafeVarargs
101
  public ValuesOperator values(List<LiteralExpression>... values) {
102 1 1. values : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::values → KILLED
    return new ValuesOperator(Arrays.asList(values));
103
  }
104
105
  public static LimitOperator limit(PhysicalPlan input, Integer limit, Integer offset) {
106 1 1. limit : replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::limit → KILLED
    return new LimitOperator(input, limit, offset);
107
  }
108
}

Mutations

33

1.1
Location : agg
Killed by : org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest]/[method:print_physical_plan()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::agg → KILLED

37

1.1
Location : filter
Killed by : org.opensearch.sql.executor.ExplainTest.[engine:junit-jupiter]/[class:org.opensearch.sql.executor.ExplainTest]/[method:can_explain_project_filter_table_scan()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::filter → KILLED

42

1.1
Location : rename
Killed by : org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest]/[method:print_physical_plan()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rename → KILLED

46

1.1
Location : project
Killed by : org.opensearch.sql.planner.physical.ProjectOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.ProjectOperatorTest]/[method:project_schema()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::project → KILLED

51

1.1
Location : project
Killed by : org.opensearch.sql.planner.physical.ProjectOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.ProjectOperatorTest]/[method:project_fields_with_unused_parse_expressions()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::project → KILLED

55

1.1
Location : remove
Killed by : org.opensearch.sql.planner.physical.RemoveOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.RemoveOperatorTest]/[method:invalid_to_retrieve_schema_from_remove()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::remove → KILLED

60

1.1
Location : eval
Killed by : org.opensearch.sql.planner.physical.EvalOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.EvalOperatorTest]/[method:do_nothing_with_none_tuple_value()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::eval → KILLED

65

1.1
Location : sort
Killed by : org.opensearch.sql.planner.physical.SortOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.SortOperatorTest]/[method:sort_one_field_without_input()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::sort → KILLED

69

1.1
Location : dedupe
Killed by : org.opensearch.sql.planner.physical.DedupeOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.DedupeOperatorTest]/[method:dedupe_one_field_no_duplication()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::dedupe → KILLED

78

1.1
Location : dedupe
Killed by : org.opensearch.sql.planner.physical.DedupeOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.DedupeOperatorTest]/[method:dedupe_one_field_in_consecutive_mode_all_consecutive()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::dedupe → KILLED

85

1.1
Location : window
Killed by : org.opensearch.sql.planner.DefaultImplementorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.DefaultImplementorTest]/[method:visitWindowOperatorShouldReturnPhysicalWindowOperator()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::window → KILLED

90

1.1
Location : rareTopN
Killed by : org.opensearch.sql.executor.ExplainTest.[engine:junit-jupiter]/[class:org.opensearch.sql.executor.ExplainTest]/[method:can_explain_rare_top_n()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rareTopN → KILLED

96

1.1
Location : rareTopN
Killed by : org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.PhysicalPlanNodeVisitorTest]/[method:test_PhysicalPlanVisitor_should_return_null()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::rareTopN → KILLED

102

1.1
Location : values
Killed by : org.opensearch.sql.planner.physical.ValuesOperatorTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.physical.ValuesOperatorTest]/[method:shouldHaveNoChild()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::values → KILLED

106

1.1
Location : limit
Killed by : org.opensearch.sql.executor.ExplainTest.[engine:junit-jupiter]/[class:org.opensearch.sql.executor.ExplainTest]/[method:can_explain_limit()]
replaced return value with null for org/opensearch/sql/planner/physical/PhysicalPlanDSL::limit → KILLED

Active mutators

Tests examined


Report generated by PIT 1.9.0