databricks-sdk-java icon indicating copy to clipboard operation
databricks-sdk-java copied to clipboard

[ISSUE] Bad request error when using QueryEndpointInput with Inputs

Open stikkireddy opened this issue 1 year ago • 0 comments

Description When using the inputs field only the inputs field is allowed and nothing more. Otherwise the server fails to parse the inputs.

Reproduction

import com.databricks.sdk.WorkspaceClient;
import com.databricks.sdk.service.serving.QueryEndpointInput;

WorkspaceClient workspace = new WorkspaceClient(config);
        int[][] sampleInputs = {
            {1, 2, 3},
            {4, 5, 6},
            {7, 8, 9}
        };
QueryEndpointInput queryEndpointInput = new QueryEndpointInput()
          .setInputs(sampleInputs)
          .setName("test");
workspace.servingEndpoints().query(queryEndpointInput);

Expected behavior It sends name as part of the input and the server throws an error which if you send inputs you cannot send any other field as part of the payload including name. Name gets sent over.

Is it a regression? I tried 0.27.0.

Additional context I fixed it by using the following class which uses json ignore for the name for querying:

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.databricks.sdk.service.serving.QueryEndpointInput;

class CustomQueryEndpointInput extends QueryEndpointInput {
    @Override
    @JsonIgnore
    public String getName() {
        return super.getName();
    }

    @Override
    public QueryEndpointInput setName(String name) {
        super.setName(name);
        return this;
    }
}

stikkireddy avatar Jul 22 '24 19:07 stikkireddy