class_docstr: A :class:`~pyflink.table.TableResult` is the representation of the statement execution result.
  
  .. versionadded:: 1.11.0
class_docstr_tok: ["A",":","class",":","`","~pyflink.table.TableResult","`","is","the","representation","of","the","statement","execution","result",".","..","versionadded",":",":","1.11.0"]
docstr: Get the result contents as a closeable row iterator.
  
  Note:
  
  For SELECT operation, the job will not be finished unless all result data has been
  collected. So we should actively close the job to avoid resource leak through
  CloseableIterator#close method. Calling CloseableIterator#close method will cancel the job
  and release related resources.
  
  For DML operation, Flink does not support getting the real affected row count now. So the
  affected row count is always -1 (unknown) for every sink, and them will be returned until
  the job is finished.
  Calling CloseableIterator#close method will cancel the job.
  
  For other operations, no flink job will be submitted (get_job_client() is always empty), and
  the result is bounded. Do noting when calling CloseableIterator#close method.
  
  Recommended code to call CloseableIterator#close method looks like:
  
  >>> table_result = t_env.execute("select ...")
  >>> with table_result.collect() as results:
  >>>    for result in results:
  >>>        ...
  
  In order to fetch result to local, you can call either collect() and print(). But, they can
  not be called both on the same TableResult instance.
  
  :return: A CloseableIterator.
  
  .. versionadded:: 1.12.0
docstr_tok: ["Get","the","result","contents","as","a","closeable","row","iterator",".","Note",":","For","SELECT","operation",",","the","job","will","not","be","finished","unless","all","result","data","has","been","collected",".","So","we","should","actively","close","the","job","to","avoid","resource","leak","through","CloseableIterator","#","close","method",".","Calling","CloseableIterator","#","close","method","will","cancel","the","job","and","release","related","resources",".","For","DML","operation",",","Flink","does","not","support","getting","the","real","affected","row","count","now",".","So","the","affected","row","count","is","always","-1","(","unknown",")","for","every","sink",",","and","them","will","be","returned","until","the","job","is","finished",".","Calling","CloseableIterator","#","close","method","will","cancel","the","job",".","For","other","operations",",","no","flink","job","will","be","submitted","(","get_job_client","(",")","is","always","empty",")",",","and","the","result","is","bounded",".","Do","noting","when","calling","CloseableIterator","#","close","method",".","Recommended","code","to","call","CloseableIterator","#","close","method","looks","like",":",">",">",">","table_result","=","t_env.execute","(","``","select","...","''",")",">",">",">","with","table_result.collect","(",")","as","results",":",">",">",">","for","result","in","results",":",">",">",">","...","In","order","to","fetch","result","to","local",",","you","can","call","either","collect","(",")","and","print","(",")",".","But",",","they","can","not","be","called","both","on","the","same","TableResult","instance",".",":","return",":","A","CloseableIterator",".","..","versionadded",":",":","1.12.0"]
code: def collect(self) -> "CloseableIterator":
      """
      Get the result contents as a closeable row iterator.
  
      Note:
  
      For SELECT operation, the job will not be finished unless all result data has been
      collected. So we should actively close the job to avoid resource leak through
      CloseableIterator#close method. Calling CloseableIterator#close method will cancel the job
      and release related resources.
  
      For DML operation, Flink does not support getting the real affected row count now. So the
      affected row count is always -1 (unknown) for every sink, and them will be returned until
      the job is finished.
      Calling CloseableIterator#close method will cancel the job.
  
      For other operations, no flink job will be submitted (get_job_client() is always empty), and
      the result is bounded. Do noting when calling CloseableIterator#close method.
  
      Recommended code to call CloseableIterator#close method looks like:
  
      >>> table_result = t_env.execute("select ...")
      >>> with table_result.collect() as results:
      >>>    for result in results:
      >>>        ...
  
      In order to fetch result to local, you can call either collect() and print(). But, they can
      not be called both on the same TableResult instance.
  
      :return: A CloseableIterator.
  
      .. versionadded:: 1.12.0
      """
      field_data_types = (
          self._get_java_table_schema().getFieldDataTypes()
      )
  
      j_iter = self._j_table_result.collect()
  
      return CloseableIterator(j_iter, field_data_types)
  
imports: from typing import Optional
  from py4j.java_gateway import get_method
  from pyflink.common.types import RowKind
  from pyflink.common import Row
  from pyflink.common.job_client import JobClient
  from pyflink.java_gateway import get_gateway
  from pyflink.table.result_kind import ResultKind
  from pyflink.table.table_schema import TableSchema
  from pyflink.table.types import _from_java_data_type
  from pyflink.table.utils import pickled_bytes_to_python_converter
label_desc: Use image node_id 6 for calling the TableResult obj's underlying member method code with example usage: obj.collect() and returns: CloseableIterator