Skip to content

Commit 336f323

Browse files
committed
Test eval if function with equal as condition
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent a34eeb7 commit 336f323

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalcitePPLConditionBuiltinFunctionIT.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,19 @@ public void testIfWithLike() throws IOException {
194194
actual, rows(0.0, "John"), rows(0.0, "Jane"), rows(0.0, "Jake"), rows(1.0, "Hello"));
195195
}
196196

197+
@Test
198+
public void testIfWithEquals() throws IOException {
199+
JSONObject actual =
200+
executeQuery(
201+
String.format(
202+
"source=%s | eval jake = if(name='Jake', 1, 0) | fields name, jake",
203+
TEST_INDEX_STATE_COUNTRY));
204+
205+
verifySchema(actual, schema("name", "string"), schema("jake", "int"));
206+
207+
verifyDataRows(actual, rows("Jake", 1), rows("Hello", 0), rows("John", 0), rows("Jane", 0));
208+
}
209+
197210
@Test
198211
public void testIsPresent() throws IOException {
199212
JSONObject actual =

0 commit comments

Comments
 (0)