sql icon indicating copy to clipboard operation
sql copied to clipboard

ML command supports category_field parameter

Open gaobinlong opened this issue 5 months ago • 8 comments

Description

From the document of ML command, it shows that ml supports category_field command, but actually it doesn't work. This PR makes ML command supports category_field parameter.

Request:

POST _plugins/_ppl?format=jdbc
{
  "query":"source = abcd_test | eval value = cast(value as double) | fields value, category | ml action='trainandpredict' algorithm='rcf' input='value' category_field='category'"
}

Response:

{
  "schema": [
    {
      "name": "value",
      "type": "double"
    },
    {
      "name": "category",
      "type": "string"
    },
    {
      "name": "score",
      "type": "double"
    },
    {
      "name": "anomalous",
      "type": "boolean"
    }
  ],
  "datarows": [
    [
      1,
      "a",
      0,
      false
    ],
    [
      2,
      "b",
      0,
      false
    ]
  ],
  "total": 2,
  "size": 2
}

Related Issues

https://github.com/opensearch-project/sql/issues/3406

Check List

  • [x] New functionality includes testing.
  • [x] New functionality has been documented.
  • [ ] New functionality has javadoc added.
  • [ ] New functionality has a user manual doc added.
  • [ ] API changes companion pull request created.
  • [x] Commits are signed per the DCO using --signoff.
  • [ ] Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

gaobinlong avatar Jul 22 '25 07:07 gaobinlong

@LantaoJin @qianheng-aws @songkant-aws please help to review this PR, thanks!

gaobinlong avatar Jul 23 '25 09:07 gaobinlong

This PR is stalled because it has been open for 30 days with no activity.

LGTM

songkant-aws avatar Oct 15 '25 05:10 songkant-aws

@LantaoJin @qianheng-aws @yuancu Need other reviews.

songkant-aws avatar Oct 15 '25 05:10 songkant-aws

This PR is stalled because it has been open for 2 weeks with no activity.

This PR is stalled because it has been open for 2 weeks with no activity.

@LantaoJin can you re-review?

Swiddis avatar Nov 25 '25 18:11 Swiddis

This PR is stalled because it has been open for 2 weeks with no activity.