{
  "comment" : "This is generated by ESQL's AbstractFunctionTestCase. Do not edit it. See ../README.md for how to regenerate it.",
  "type" : "scalar",
  "name" : "greatest",
  "description" : "Returns the maximum value from multiple columns. This is similar to `MV_MAX`\nexcept it is intended to run on multiple columns at once.",
  "note" : "When run on `keyword` or `text` fields, this returns the last string in alphabetical order. When run on `boolean` columns this will return `true` if any values are `true`.",
  "signatures" : [
    {
      "params" : [
        {
          "name" : "first",
          "type" : "boolean",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "boolean"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "boolean",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "boolean",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "boolean"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "date",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "date",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "date"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "date_nanos",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "date_nanos",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "date_nanos"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "double",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "double",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "double"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "integer",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "integer"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "integer",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "integer",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "integer"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "ip",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "ip",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "ip"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "keyword",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "keyword"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "keyword",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "keyword",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "keyword"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "long",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "long",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "long",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "long"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "text",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "keyword"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "text",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "text",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "keyword"
    },
    {
      "params" : [
        {
          "name" : "first",
          "type" : "version",
          "optional" : false,
          "description" : "First of the columns to evaluate."
        },
        {
          "name" : "rest",
          "type" : "version",
          "optional" : true,
          "description" : "The rest of the columns to evaluate."
        }
      ],
      "variadic" : true,
      "returnType" : "version"
    }
  ],
  "examples" : [
    "ROW a = 10, b = 20\n| EVAL g = GREATEST(a, b)"
  ],
  "preview" : false,
  "snapshot_only" : false
}
