File tree Expand file tree Collapse file tree
core/src/main/java/org/opensearch/sql
expression/function/udf/condition Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -61,4 +61,9 @@ private PPLOperandTypes() {}
6161 public static final UDFOperandMetadata DATE_OR_TIMESTAMP_OR_STRING =
6262 UDFOperandMetadata .wrap (
6363 (CompositeOperandTypeChecker ) OperandTypes .DATE_OR_TIMESTAMP .or (OperandTypes .STRING ));
64+ public static final UDFOperandMetadata STRING_DATE_OR_TIMESTAMP =
65+ UDFOperandMetadata .wrap (
66+ (CompositeOperandTypeChecker )
67+ OperandTypes .family (SqlTypeFamily .STRING , SqlTypeFamily .DATE )
68+ .or (OperandTypes .family (SqlTypeFamily .STRING , SqlTypeFamily .TIMESTAMP )));
6469}
Original file line number Diff line number Diff line change 55
66package org .opensearch .sql .expression .function .udf .condition ;
77
8+ import static org .opensearch .sql .calcite .utils .PPLOperandTypes .STRING_DATE_OR_TIMESTAMP ;
89import static org .opensearch .sql .calcite .utils .UserDefinedFunctionUtils .prependFunctionProperties ;
910import static org .opensearch .sql .utils .DateTimeUtils .getRelativeZonedDateTime ;
1011
2627import org .opensearch .sql .data .model .ExprValue ;
2728import org .opensearch .sql .expression .function .FunctionProperties ;
2829import org .opensearch .sql .expression .function .ImplementorUDF ;
30+ import org .opensearch .sql .expression .function .UDFOperandMetadata ;
2931
3032public class EarliestFunction extends ImplementorUDF {
3133 public EarliestFunction () {
@@ -37,6 +39,11 @@ public SqlReturnTypeInference getReturnTypeInference() {
3739 return ReturnTypes .BOOLEAN ;
3840 }
3941
42+ @ Override
43+ public UDFOperandMetadata getOperandMetadata () {
44+ return STRING_DATE_OR_TIMESTAMP ;
45+ }
46+
4047 public static class EarliestImplementor implements NotNullImplementor {
4148 @ Override
4249 public Expression implement (
Original file line number Diff line number Diff line change 55
66package org .opensearch .sql .expression .function .udf .condition ;
77
8+ import static org .opensearch .sql .calcite .utils .PPLOperandTypes .STRING_DATE_OR_TIMESTAMP ;
89import static org .opensearch .sql .calcite .utils .UserDefinedFunctionUtils .prependFunctionProperties ;
910import static org .opensearch .sql .utils .DateTimeUtils .getRelativeZonedDateTime ;
1011
2627import org .opensearch .sql .data .model .ExprValue ;
2728import org .opensearch .sql .expression .function .FunctionProperties ;
2829import org .opensearch .sql .expression .function .ImplementorUDF ;
30+ import org .opensearch .sql .expression .function .UDFOperandMetadata ;
2931
3032public class LatestFunction extends ImplementorUDF {
3133 public LatestFunction () {
@@ -37,6 +39,11 @@ public SqlReturnTypeInference getReturnTypeInference() {
3739 return ReturnTypes .BOOLEAN ;
3840 }
3941
42+ @ Override
43+ public UDFOperandMetadata getOperandMetadata () {
44+ return STRING_DATE_OR_TIMESTAMP ;
45+ }
46+
4047 public static class LatestImplementor implements NotNullImplementor {
4148 @ Override
4249 public Expression implement (
Original file line number Diff line number Diff line change @@ -448,8 +448,8 @@ integTest {
448448
449449 dependsOn ' :opensearch-sql-plugin:bundlePlugin'
450450 if (getOSFamilyType() != " windows" ) {
451- dependsOn startPrometheus
452- finalizedBy stopPrometheus
451+ // dependsOn startPrometheus
452+ // finalizedBy stopPrometheus
453453 }
454454
455455 // enable calcite codegen in IT
You can’t perform that action at this time.
0 commit comments