[ 
https://issues.apache.org/jira/browse/FLINK-29881?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

yiwei93 updated FLINK-29881:
----------------------------
    Description: 
use restful api , fetch result from  
{code:java}
  
http://*****:8083/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0{code}
the result is 
{code:java}
{
  "results": {
    "columns": [
      {
        "name": "localtimestamp",
        "logicalType": {
          "type": "TIMESTAMP_WITHOUT_TIME_ZONE",
          "nullable": false,
          "precision": 3
        },
        "comment": null
      }
    ],
    "data": [
      {
        "kind": "INSERT",
        "fields": [
          "2022-11-04T11:41:40.036"
        ]
      }
    ]
  },
  "resultType": "PAYLOAD",
  "nextResultUri": 
"/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/1"
}{code}
use api to fetch ,the code is 
{code:java}
ApiClient client = new ApiClient();
client.setHost("hermes02");
client.setPort(8083);
client.setScheme("http");
defaultApi = new DefaultApi(client);

OpenSessionRequestBody openSessionRequestBody = new OpenSessionRequestBody();
OpenSessionResponseBody openSessionResponseBody = 
defaultApi.openSession(openSessionRequestBody);

SessionHandle sessionHandle = new 
SessionHandle().identifier(UUID.fromString(openSessionResponseBody.getSessionHandle()));

ExecuteStatementRequestBody executeStatementRequestBody = new 
ExecuteStatementRequestBody().statement("select localtimestamp");
ExecuteStatementResponseBody executeStatementResponseBody = 
defaultApi.executeStatement(sessionHandle.getIdentifier(), 
executeStatementRequestBody);

FetchResultsResponseBody fetchResultsResponseBody = 
defaultApi.fetchResults(sessionHandle.getIdentifier(), 
UUID.fromString(executeStatementResponseBody.getOperationHandle()), 0L);{code}
the result is 
{code:java}
class FetchResultsResponseBody {
    results: class ResultSet {
        resultType: null
        nextToken: null
        resultSchema: null
        data: []
    }
    resultType: NOT_READY
    nextResultUri: 
/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0
}{code}

  was:
use restful api , fetch result from  
{code:java}
  
http://hermes02:8083/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0{code}
the result is 
{code:java}
{
  "results": {
    "columns": [
      {
        "name": "localtimestamp",
        "logicalType": {
          "type": "TIMESTAMP_WITHOUT_TIME_ZONE",
          "nullable": false,
          "precision": 3
        },
        "comment": null
      }
    ],
    "data": [
      {
        "kind": "INSERT",
        "fields": [
          "2022-11-04T11:41:40.036"
        ]
      }
    ]
  },
  "resultType": "PAYLOAD",
  "nextResultUri": 
"/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/1"
}{code}
use api to fetch ,the code is 
{code:java}
ApiClient client = new ApiClient();
client.setHost("hermes02");
client.setPort(8083);
client.setScheme("http");
defaultApi = new DefaultApi(client);

OpenSessionRequestBody openSessionRequestBody = new OpenSessionRequestBody();
OpenSessionResponseBody openSessionResponseBody = 
defaultApi.openSession(openSessionRequestBody);

SessionHandle sessionHandle = new 
SessionHandle().identifier(UUID.fromString(openSessionResponseBody.getSessionHandle()));

ExecuteStatementRequestBody executeStatementRequestBody = new 
ExecuteStatementRequestBody().statement("select localtimestamp");
ExecuteStatementResponseBody executeStatementResponseBody = 
defaultApi.executeStatement(sessionHandle.getIdentifier(), 
executeStatementRequestBody);

FetchResultsResponseBody fetchResultsResponseBody = 
defaultApi.fetchResults(sessionHandle.getIdentifier(), 
UUID.fromString(executeStatementResponseBody.getOperationHandle()), 0L);{code}
the result is 
{code:java}
class FetchResultsResponseBody {
    results: class ResultSet {
        resultType: null
        nextToken: null
        resultSchema: null
        data: []
    }
    resultType: NOT_READY
    nextResultUri: 
/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0
}{code}


> when Fetch results in sql gateway, the result using open api is different  
> from using restful api  
> ---------------------------------------------------------------------------------------------------
>
>                 Key: FLINK-29881
>                 URL: https://issues.apache.org/jira/browse/FLINK-29881
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / Gateway
>    Affects Versions: 1.16.0
>            Reporter: yiwei93
>            Priority: Major
>         Attachments: image-2022-11-04-14-47-00-762.png
>
>
> use restful api , fetch result from  
> {code:java}
>   
> http://*****:8083/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0{code}
> the result is 
> {code:java}
> {
>   "results": {
>     "columns": [
>       {
>         "name": "localtimestamp",
>         "logicalType": {
>           "type": "TIMESTAMP_WITHOUT_TIME_ZONE",
>           "nullable": false,
>           "precision": 3
>         },
>         "comment": null
>       }
>     ],
>     "data": [
>       {
>         "kind": "INSERT",
>         "fields": [
>           "2022-11-04T11:41:40.036"
>         ]
>       }
>     ]
>   },
>   "resultType": "PAYLOAD",
>   "nextResultUri": 
> "/v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/1"
> }{code}
> use api to fetch ,the code is 
> {code:java}
> ApiClient client = new ApiClient();
> client.setHost("hermes02");
> client.setPort(8083);
> client.setScheme("http");
> defaultApi = new DefaultApi(client);
> OpenSessionRequestBody openSessionRequestBody = new OpenSessionRequestBody();
> OpenSessionResponseBody openSessionResponseBody = 
> defaultApi.openSession(openSessionRequestBody);
> SessionHandle sessionHandle = new 
> SessionHandle().identifier(UUID.fromString(openSessionResponseBody.getSessionHandle()));
> ExecuteStatementRequestBody executeStatementRequestBody = new 
> ExecuteStatementRequestBody().statement("select localtimestamp");
> ExecuteStatementResponseBody executeStatementResponseBody = 
> defaultApi.executeStatement(sessionHandle.getIdentifier(), 
> executeStatementRequestBody);
> FetchResultsResponseBody fetchResultsResponseBody = 
> defaultApi.fetchResults(sessionHandle.getIdentifier(), 
> UUID.fromString(executeStatementResponseBody.getOperationHandle()), 0L);{code}
> the result is 
> {code:java}
> class FetchResultsResponseBody {
>     results: class ResultSet {
>         resultType: null
>         nextToken: null
>         resultSchema: null
>         data: []
>     }
>     resultType: NOT_READY
>     nextResultUri: 
> /v1/sessions/9a8fcf37-73e5-43ca-bcc3-d44d8b71a24c/operations/b40085c1-a2c5-42f4-80e7-0971c5ef9710/result/0
> }{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to