Class ResultFetcher


  • public class ResultFetcher
    extends Object
    A fetcher to fetch result from submitted statement.

    The fetcher uses the Iterator model. It means every time fetch the result with the current token, the fetcher will move forward and retire the old data.

    After closes, the fetcher will not fetch the results from the remote but is able to return all data in the local cache.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      org.apache.flink.table.gateway.api.results.ResultSet fetchResults​(long token, int maxFetchSize)
      Fetch results from the result store.
      org.apache.flink.table.gateway.api.results.ResultSet fetchResults​(org.apache.flink.table.gateway.api.results.FetchOrientation orientation, int maxFetchSize)  
      static ResultFetcher fromResults​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle, org.apache.flink.table.catalog.ResolvedSchema resultSchema, List<org.apache.flink.table.data.RowData> results)  
      static ResultFetcher fromResults​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle, org.apache.flink.table.catalog.ResolvedSchema resultSchema, List<org.apache.flink.table.data.RowData> results, org.apache.flink.api.common.JobID jobID, org.apache.flink.table.api.ResultKind resultKind)  
      static ResultFetcher fromTableResult​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle, org.apache.flink.table.api.internal.TableResultInternal tableResult, boolean isQueryResult)  
      org.apache.flink.table.catalog.ResolvedSchema getResultSchema()  
      ResultStore getResultStore()  
      ResultFetcher withResourceManager​(org.apache.flink.table.resource.ResourceManager resourceManager)  
    • Method Detail

      • fromTableResult

        public static ResultFetcher fromTableResult​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle,
                                                    org.apache.flink.table.api.internal.TableResultInternal tableResult,
                                                    boolean isQueryResult)
      • fromResults

        public static ResultFetcher fromResults​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle,
                                                org.apache.flink.table.catalog.ResolvedSchema resultSchema,
                                                List<org.apache.flink.table.data.RowData> results)
      • fromResults

        public static ResultFetcher fromResults​(org.apache.flink.table.gateway.api.operation.OperationHandle operationHandle,
                                                org.apache.flink.table.catalog.ResolvedSchema resultSchema,
                                                List<org.apache.flink.table.data.RowData> results,
                                                @Nullable
                                                org.apache.flink.api.common.JobID jobID,
                                                org.apache.flink.table.api.ResultKind resultKind)
      • withResourceManager

        public ResultFetcher withResourceManager​(org.apache.flink.table.resource.ResourceManager resourceManager)
      • close

        public void close()
      • getResultSchema

        public org.apache.flink.table.catalog.ResolvedSchema getResultSchema()
      • fetchResults

        public org.apache.flink.table.gateway.api.results.ResultSet fetchResults​(org.apache.flink.table.gateway.api.results.FetchOrientation orientation,
                                                                                 int maxFetchSize)
      • fetchResults

        public org.apache.flink.table.gateway.api.results.ResultSet fetchResults​(long token,
                                                                                 int maxFetchSize)
        Fetch results from the result store. It tries to return the data cached in the buffer first. If the buffer is empty, then fetch results from the ResultStore. It's possible multiple threads try to fetch results in parallel. To keep the data integration, use the synchronized to allow only one thread can fetch the result at any time.
      • getResultStore

        @VisibleForTesting
        public ResultStore getResultStore()