forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added LogicalHighlightTest and removed check for instance of Highligh…
…tFunction in Analyzer as this case should not be reachable. Signed-off-by: forestmvey <forestv@bitquilltech.com>
- Loading branch information
1 parent
13ce12b
commit ec1e504
Showing
2 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
core/src/test/java/org/opensearch/sql/planner/logical/LogicalHighlightTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.sql.planner.logical; | ||
|
||
import static org.opensearch.sql.ast.dsl.AstDSL.alias; | ||
import static org.opensearch.sql.ast.dsl.AstDSL.highlight; | ||
import static org.opensearch.sql.ast.dsl.AstDSL.relation; | ||
import static org.opensearch.sql.ast.dsl.AstDSL.stringLiteral; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
import org.opensearch.sql.analysis.AnalyzerTestBase; | ||
import org.opensearch.sql.ast.tree.Highlight; | ||
import org.opensearch.sql.expression.DSL; | ||
import org.opensearch.sql.expression.config.ExpressionConfig; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
|
||
@Configuration | ||
@ExtendWith(SpringExtension.class) | ||
@ContextConfiguration(classes = {ExpressionConfig.class, AnalyzerTestBase.class}) | ||
@ExtendWith(MockitoExtension.class) | ||
public class LogicalHighlightTest extends AnalyzerTestBase { | ||
@Test | ||
public void analyze_highlight_with_one_field() { | ||
assertAnalyzeEqual( | ||
LogicalPlanDSL.highlight( | ||
LogicalPlanDSL.relation("schema"), | ||
DSL.literal("field")), | ||
new Highlight( | ||
alias("highlight('field')", | ||
highlight(stringLiteral("field")))) | ||
.attach(relation("schema"))); | ||
} | ||
} |