WindowFunction.java

1
/*
2
 * Copyright OpenSearch Contributors
3
 * SPDX-License-Identifier: Apache-2.0
4
 */
5
6
7
package org.opensearch.sql.ast.expression;
8
9
import com.google.common.collect.ImmutableList;
10
import java.util.List;
11
import lombok.AllArgsConstructor;
12
import lombok.EqualsAndHashCode;
13
import lombok.Getter;
14
import lombok.RequiredArgsConstructor;
15
import lombok.ToString;
16
import org.apache.commons.lang3.tuple.Pair;
17
import org.opensearch.sql.ast.AbstractNodeVisitor;
18
import org.opensearch.sql.ast.Node;
19
import org.opensearch.sql.ast.tree.Sort.SortOption;
20
21
@AllArgsConstructor
22
@EqualsAndHashCode(callSuper = false)
23
@Getter
24
@RequiredArgsConstructor
25
@ToString
26
public class WindowFunction extends UnresolvedExpression {
27
28
  private final UnresolvedExpression function;
29
  private List<UnresolvedExpression> partitionByList;
30
  private List<Pair<SortOption, UnresolvedExpression>> sortList;
31
32
  @Override
33
  public List<? extends Node> getChild() {
34
    ImmutableList.Builder<UnresolvedExpression> children = ImmutableList.builder();
35
    children.add(function);
36
    children.addAll(partitionByList);
37 1 1. getChild : removed call to java/util/List::forEach → NO_COVERAGE
    sortList.forEach(pair -> children.add(pair.getRight()));
38 1 1. getChild : replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/WindowFunction::getChild → NO_COVERAGE
    return children.build();
39
  }
40
41
  @Override
42
  public <T, C> T accept(AbstractNodeVisitor<T, C> nodeVisitor, C context) {
43 1 1. accept : replaced return value with null for org/opensearch/sql/ast/expression/WindowFunction::accept → KILLED
    return nodeVisitor.visitWindowFunction(this, context);
44
  }
45
46
}

Mutations

37

1.1
Location : getChild
Killed by : none
removed call to java/util/List::forEach → NO_COVERAGE

38

1.1
Location : getChild
Killed by : none
replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/WindowFunction::getChild → NO_COVERAGE

43

1.1
Location : accept
Killed by : org.opensearch.sql.analysis.ExpressionAnalyzerTest.[engine:junit-jupiter]/[class:org.opensearch.sql.analysis.ExpressionAnalyzerTest]/[method:scalar_window_function()]
replaced return value with null for org/opensearch/sql/ast/expression/WindowFunction::accept → KILLED

Active mutators

Tests examined


Report generated by PIT 1.9.0