Function.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 java.util.Collections;
10
import java.util.List;
11
import java.util.stream.Collectors;
12
import lombok.EqualsAndHashCode;
13
import lombok.Getter;
14
import lombok.RequiredArgsConstructor;
15
import org.opensearch.sql.ast.AbstractNodeVisitor;
16
17
18
/**
19
 * Expression node of scalar function.
20
 * Params include function name (@funcName) and function arguments (@funcArgs)
21
 */
22
@Getter
23
@EqualsAndHashCode(callSuper = false)
24
@RequiredArgsConstructor
25
public class Function extends UnresolvedExpression {
26
  private final String funcName;
27
  private final List<UnresolvedExpression> funcArgs;
28
29
  @Override
30
  public List<UnresolvedExpression> getChild() {
31 1 1. getChild : replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/Function::getChild → NO_COVERAGE
    return Collections.unmodifiableList(funcArgs);
32
  }
33
34
  @Override
35
  public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) {
36 1 1. accept : replaced return value with null for org/opensearch/sql/ast/expression/Function::accept → KILLED
    return nodeVisitor.visitFunction(this, context);
37
  }
38
39
  @Override
40
  public String toString() {
41 1 1. toString : replaced return value with "" for org/opensearch/sql/ast/expression/Function::toString → NO_COVERAGE
    return String.format("%s(%s)", funcName,
42
        funcArgs.stream()
43
            .map(Object::toString)
44
            .collect(Collectors.joining(", ")));
45
  }
46
}

Mutations

31

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

36

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

41

1.1
Location : toString
Killed by : none
replaced return value with "" for org/opensearch/sql/ast/expression/Function::toString → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.9.0