Literal.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.EqualsAndHashCode;
12
import lombok.Getter;
13
import lombok.RequiredArgsConstructor;
14
import org.opensearch.sql.ast.AbstractNodeVisitor;
15
16
/**
17
 * Expression node of literal type
18
 * Params include literal value (@value) and
19
 * literal data type (@type) which can be selected from {@link DataType}.
20
 */
21
@Getter
22
@EqualsAndHashCode(callSuper = false)
23
@RequiredArgsConstructor
24
public class Literal extends UnresolvedExpression {
25
26
  private final Object value;
27
  private final DataType type;
28
29
  @Override
30
  public List<UnresolvedExpression> getChild() {
31 1 1. getChild : replaced return value with Collections.emptyList for org/opensearch/sql/ast/expression/Literal::getChild → NO_COVERAGE
    return ImmutableList.of();
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/Literal::accept → KILLED
    return nodeVisitor.visitLiteral(this, context);
37
  }
38
39
  @Override
40
  public String toString() {
41 1 1. toString : replaced return value with "" for org/opensearch/sql/ast/expression/Literal::toString → KILLED
    return String.valueOf(value);
42
  }
43
}

Mutations

31

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

36

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

41

1.1
Location : toString
Killed by : org.opensearch.sql.ast.expression.CastTest.[engine:junit-jupiter]/[class:org.opensearch.sql.ast.expression.CastTest]/[method:cast_to_int_and_integer_should_convert_to_same_function_impl()]
replaced return value with "" for org/opensearch/sql/ast/expression/Literal::toString → KILLED

Active mutators

Tests examined


Report generated by PIT 1.9.0