fhueske commented on a change in pull request #6621:  [FLINK-8686] [sql-client] 
Limit result size for prototyping modes
URL: https://github.com/apache/flink/pull/6621#discussion_r213338591
 
 

 ##########
 File path: 
flink-libraries/flink-sql-client/src/main/java/org/apache/flink/table/client/gateway/local/result/MaterializedCollectStreamResult.java
 ##########
 @@ -47,22 +64,42 @@
         */
        private final Map<Row, Integer> rowPositionCache;
 
+       /** Current snapshot of the materialized table. */
        private final List<Row> snapshot;
 
+       /** Counter for deleted rows to be deleted at the beginning of the 
materialized table. */
+       private int validRowPosition;
+
+       /** Page count of the snapshot (always >= 1). */
        private int pageCount;
 
+       /** Page size of the snapshot (always >= 1). */
        private int pageSize;
 
+       /** Indicator that this is the last snapshot possible (EOS afterwards). 
*/
        private boolean isLastSnapshot;
 
-       public MaterializedCollectStreamResult(TypeInformation<Row> outputType, 
ExecutionConfig config,
-                       InetAddress gatewayAddress, int gatewayPort) {
+       public MaterializedCollectStreamResult(
+                       TypeInformation<Row> outputType,
+                       ExecutionConfig config,
+                       InetAddress gatewayAddress,
+                       int gatewayPort,
+                       int maxRowCount,
+                       int overcommitThreshold) {
                super(outputType, config, gatewayAddress, gatewayPort);
 
+               if (maxRowCount < 0) {
+                       this.maxRowCount = Integer.MAX_VALUE;
+               } else {
+                       this.maxRowCount = maxRowCount;
+               }
+               this.overcommitThreshold = overcommitThreshold;
+
                // prepare for materialization
                materializedTable = new ArrayList<>();
 
 Review comment:
   Initialize larger `ArrayList` (e.g., `max(1, maxSize / 4)`) to avoid 
frequent resizing?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to