Skip to content

Commit 73bec7b

Browse files
committed
modify the CalcitePPLFunctionTypeTest text
Signed-off-by: Xinyu Hao <[email protected]>
1 parent e4f619e commit 73bec7b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/java/org/opensearch/sql/expression/function/PPLTypeChecker.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,10 @@ private static List<ExprType> getExprTypes(SqlTypeFamily family) {
400400
OpenSearchTypeFactory.TYPE_FACTORY.createSqlType(SqlTypeName.INTEGER));
401401
case ANY, IGNORE -> List.of(
402402
OpenSearchTypeFactory.TYPE_FACTORY.createSqlType(SqlTypeName.ANY));
403+
// We borrow SqlTypeFamily.NULL to represent EXPR_IP. This is a workaround
404+
// since there is no corresponding IP type family in Calcite.
405+
case NULL -> List.of(
406+
OpenSearchTypeFactory.TYPE_FACTORY.createUDT(OpenSearchTypeFactory.ExprUDT.EXPR_IP));
403407
default -> {
404408
RelDataType type = family.getDefaultConcreteType(OpenSearchTypeFactory.TYPE_FACTORY);
405409
if (type == null) {

ppl/src/test/java/org/opensearch/sql/ppl/calcite/CalcitePPLFunctionTypeTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public void testComparisonWithDifferentType() {
4949
String ppl = "source=EMP | where ENAME < 6 | fields ENAME";
5050
Throwable t = Assert.assertThrows(ExpressionEvaluationException.class, () -> getRelNode(ppl));
5151
verifyErrorMessageContains(
52-
t, "LESS function expects {[COMPARABLE_TYPE,COMPARABLE_TYPE]}, but got [STRING,INTEGER]");
52+
t,
53+
"LESS function expects {[STRING,IP],[IP,STRING],[IP,IP],[COMPARABLE_TYPE,COMPARABLE_TYPE]},"
54+
+ " but got [STRING,INTEGER]");
5355
}
5456

5557
@Test

0 commit comments

Comments
 (0)