WindowDefinition.java

1
/*
2
 * Copyright OpenSearch Contributors
3
 * SPDX-License-Identifier: Apache-2.0
4
 */
5
6
7
package org.opensearch.sql.expression.window;
8
9
import static org.opensearch.sql.ast.tree.Sort.SortOption;
10
import static org.opensearch.sql.ast.tree.Sort.SortOption.DEFAULT_ASC;
11
12
import java.util.ArrayList;
13
import java.util.List;
14
import lombok.Data;
15
import org.apache.commons.lang3.tuple.ImmutablePair;
16
import org.apache.commons.lang3.tuple.Pair;
17
import org.opensearch.sql.expression.Expression;
18
19
/**
20
 * Window definition that consists of partition and sort by information for a window.
21
 */
22
@Data
23
public class WindowDefinition {
24
25
  private final List<Expression> partitionByList;
26
  private final List<Pair<SortOption, Expression>> sortList;
27
28
  /**
29
   * Return all items in partition by and sort list.
30
   * @return  all sort items
31
   */
32
  public List<Pair<SortOption, Expression>> getAllSortItems() {
33
    List<Pair<SortOption, Expression>> allSorts = new ArrayList<>();
34 1 1. getAllSortItems : removed call to java/util/List::forEach → KILLED
    partitionByList.forEach(expr -> allSorts.add(ImmutablePair.of(DEFAULT_ASC, expr)));
35
    allSorts.addAll(sortList);
36 1 1. getAllSortItems : replaced return value with Collections.emptyList for org/opensearch/sql/expression/window/WindowDefinition::getAllSortItems → KILLED
    return allSorts;
37
  }
38
39
}

Mutations

34

1.1
Location : getAllSortItems
Killed by : org.opensearch.sql.analysis.WindowExpressionAnalyzerTest.[engine:junit-jupiter]/[class:org.opensearch.sql.analysis.WindowExpressionAnalyzerTest]/[method:should_wrap_child_with_window_and_sort_operator_if_project_item_windowed()]
removed call to java/util/List::forEach → KILLED

36

1.1
Location : getAllSortItems
Killed by : org.opensearch.sql.analysis.WindowExpressionAnalyzerTest.[engine:junit-jupiter]/[class:org.opensearch.sql.analysis.WindowExpressionAnalyzerTest]/[method:can_analyze_sort_options()]
replaced return value with Collections.emptyList for org/opensearch/sql/expression/window/WindowDefinition::getAllSortItems → KILLED

Active mutators

Tests examined


Report generated by PIT 1.9.0