|
@@ -36,14 +36,31 @@ public class NullPredicatesTests extends ESTestCase {
|
|
|
if (System.getProperty("generateDocs") == null) {
|
|
|
return;
|
|
|
}
|
|
|
- DocsV3Support.OperatorConfig op = new DocsV3Support.OperatorConfig(
|
|
|
- "predicates",
|
|
|
- "IS NULL and IS NOT NULL",
|
|
|
- TestCastOperator.class,
|
|
|
- DocsV3Support.OperatorCategory.UNARY,
|
|
|
- false
|
|
|
+ renderNullPredicate(
|
|
|
+ new DocsV3Support.OperatorConfig(
|
|
|
+ "predicates",
|
|
|
+ "IS NULL and IS NOT NULL",
|
|
|
+ TestNullPredicates.class,
|
|
|
+ DocsV3Support.OperatorCategory.UNARY,
|
|
|
+ false
|
|
|
+ )
|
|
|
);
|
|
|
- var docs = new DocsV3Support.OperatorsDocsSupport("predicates", NullPredicatesTests.class, op, NullPredicatesTests::signatures);
|
|
|
+ renderNullPredicate(
|
|
|
+ new DocsV3Support.OperatorConfig("is_null", "IS NULL", TestIsNullPredicate.class, DocsV3Support.OperatorCategory.UNARY, false)
|
|
|
+ );
|
|
|
+ renderNullPredicate(
|
|
|
+ new DocsV3Support.OperatorConfig(
|
|
|
+ "is_not_null",
|
|
|
+ "IS NOT NULL",
|
|
|
+ TestIsNotNullPredicate.class,
|
|
|
+ DocsV3Support.OperatorCategory.UNARY,
|
|
|
+ false
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void renderNullPredicate(DocsV3Support.OperatorConfig op) throws IOException {
|
|
|
+ var docs = new DocsV3Support.OperatorsDocsSupport(op.name(), NullPredicatesTests.class, op, NullPredicatesTests::signatures);
|
|
|
docs.renderSignature();
|
|
|
docs.renderDocs();
|
|
|
}
|
|
@@ -62,14 +79,82 @@ public class NullPredicatesTests extends ESTestCase {
|
|
|
/**
|
|
|
* This class only exists to provide FunctionInfo for the documentation
|
|
|
*/
|
|
|
- public class TestCastOperator {
|
|
|
+ public class TestNullPredicates {
|
|
|
@FunctionInfo(
|
|
|
operator = "predicates",
|
|
|
returnType = {},
|
|
|
- description = "For NULL comparison use the `IS NULL` and `IS NOT NULL` predicates:",
|
|
|
+ description = "For NULL comparison use the `IS NULL` and `IS NOT NULL` predicates.",
|
|
|
examples = { @Example(file = "null", tag = "is-null"), @Example(file = "null", tag = "is-not-null") }
|
|
|
)
|
|
|
- public TestCastOperator(
|
|
|
+ public TestNullPredicates(
|
|
|
+ @Param(
|
|
|
+ name = "field",
|
|
|
+ type = {
|
|
|
+ "boolean",
|
|
|
+ "cartesian_point",
|
|
|
+ "cartesian_shape",
|
|
|
+ "date",
|
|
|
+ "date_nanos",
|
|
|
+ "double",
|
|
|
+ "geo_point",
|
|
|
+ "geo_shape",
|
|
|
+ "integer",
|
|
|
+ "ip",
|
|
|
+ "keyword",
|
|
|
+ "long",
|
|
|
+ "text",
|
|
|
+ "unsigned_long",
|
|
|
+ "version" },
|
|
|
+ description = "Input value. The input can be a single- or multi-valued column or an expression."
|
|
|
+ ) Expression v
|
|
|
+ ) {}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This class only exists to provide FunctionInfo for the documentation
|
|
|
+ */
|
|
|
+ public class TestIsNullPredicate {
|
|
|
+ @FunctionInfo(
|
|
|
+ operator = "predicates",
|
|
|
+ returnType = {},
|
|
|
+ description = "Use `IS NULL` to filter data based on whether the field exists or not.",
|
|
|
+ examples = { @Example(file = "null", tag = "is-null") }
|
|
|
+ )
|
|
|
+ public TestIsNullPredicate(
|
|
|
+ @Param(
|
|
|
+ name = "field",
|
|
|
+ type = {
|
|
|
+ "boolean",
|
|
|
+ "cartesian_point",
|
|
|
+ "cartesian_shape",
|
|
|
+ "date",
|
|
|
+ "date_nanos",
|
|
|
+ "double",
|
|
|
+ "geo_point",
|
|
|
+ "geo_shape",
|
|
|
+ "integer",
|
|
|
+ "ip",
|
|
|
+ "keyword",
|
|
|
+ "long",
|
|
|
+ "text",
|
|
|
+ "unsigned_long",
|
|
|
+ "version" },
|
|
|
+ description = "Input value. The input can be a single- or multi-valued column or an expression."
|
|
|
+ ) Expression v
|
|
|
+ ) {}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * This class only exists to provide FunctionInfo for the documentation
|
|
|
+ */
|
|
|
+ public class TestIsNotNullPredicate {
|
|
|
+ @FunctionInfo(
|
|
|
+ operator = "predicates",
|
|
|
+ returnType = {},
|
|
|
+ description = "Use `IS NOT NULL` to filter data based on whether the field exists or not.",
|
|
|
+ examples = { @Example(file = "null", tag = "is-not-null") }
|
|
|
+ )
|
|
|
+ public TestIsNotNullPredicate(
|
|
|
@Param(
|
|
|
name = "field",
|
|
|
type = {
|