Field.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.Collections;
11
import java.util.List;
12
import lombok.EqualsAndHashCode;
13
import lombok.Getter;
14
import lombok.ToString;
15
import org.opensearch.sql.ast.AbstractNodeVisitor;
16
17
@Getter
18
@ToString
19
@EqualsAndHashCode(callSuper = false)
20
public class Field extends UnresolvedExpression {
21
22
  private final UnresolvedExpression field;
23
24
  private final List<Argument> fieldArgs;
25
26
  /**
27
   * Constructor of Field.
28
   */
29
  public Field(UnresolvedExpression field) {
30
    this(field, Collections.emptyList());
31
  }
32
33
  /**
34
   * Constructor of Field.
35
   */
36
  public Field(UnresolvedExpression field, List<Argument> fieldArgs) {
37
    this.field = field;
38
    this.fieldArgs = fieldArgs;
39
  }
40
41
  public boolean hasArgument() {
42 2 1. hasArgument : negated conditional → NO_COVERAGE
2. hasArgument : replaced boolean return with true for org/opensearch/sql/ast/expression/Field::hasArgument → NO_COVERAGE
    return !fieldArgs.isEmpty();
43
  }
44
45
  @Override
46
  public List<UnresolvedExpression> getChild() {
47 1 1. getChild : replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/Field::getChild → SURVIVED
    return ImmutableList.of(this.field);
48
  }
49
50
  @Override
51
  public <R, C> R accept(AbstractNodeVisitor<R, C> nodeVisitor, C context) {
52 1 1. accept : replaced return value with null for org/opensearch/sql/ast/expression/Field::accept → KILLED
    return nodeVisitor.visitField(this, context);
53
  }
54
}

Mutations

42

1.1
Location : hasArgument
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : hasArgument
Killed by : none
replaced boolean return with true for org/opensearch/sql/ast/expression/Field::hasArgument → NO_COVERAGE

47

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

52

1.1
Location : accept
Killed by : org.opensearch.sql.planner.logical.LogicalDedupeTest.[engine:junit-jupiter]/[class:org.opensearch.sql.planner.logical.LogicalDedupeTest]/[method:analyze_dedup_with_one_field_with_customize_option()]
replaced return value with null for org/opensearch/sql/ast/expression/Field::accept → KILLED

Active mutators

Tests examined


Report generated by PIT 1.9.0