Skip to content

Commit c1775be

Browse files
committed
Test cast decimal
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent c0ead01 commit c1775be

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

integ-test/src/test/java/org/opensearch/sql/ppl/CastFunctionIT.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,24 @@ public void testCastNumericSTRING() throws IOException {
274274
verifyDataRows(actual, rows(true));
275275
}
276276

277+
@Test
278+
public void testCastDecimal() throws IOException {
279+
JSONObject actual =
280+
executeQuery(
281+
String.format(
282+
"source=%s | eval s = cast(0.99 as string), f = cast(12.9 as float), "
283+
+ "d = cast(100.00 as double), i = cast(2.9 as int) "
284+
+ "| fields s, f, d, i",
285+
TEST_INDEX_DATATYPE_NONNUMERIC));
286+
verifySchema(
287+
actual,
288+
schema("s", "string"),
289+
schema("f", "float"),
290+
schema("d", "double"),
291+
schema("i", "int"));
292+
verifyDataRows(actual, rows("0.99", 12.9f, 100.0d, 2));
293+
}
294+
277295
@Test
278296
public void testCastDate() throws IOException {
279297
JSONObject actual =

0 commit comments

Comments
 (0)