@@ -348,7 +348,7 @@ public String getDataStore(String label, String parameters, Map<String, Object>
348348 }
349349
350350 public String getDataStoreAI (String label , String parameters , Map <String , Object > drivers , String selections ,
351- String likeSelections , Integer maxRowCount , String aggregations , String summaryRow , int offset , int fetchSize ,
351+ String likeSelections , Integer maxRowCount , String aggregations , String summaryRow , int offset , int fetchSize , Integer maxRows ,
352352 Boolean isNearRealtime , String options , Set <String > indexes ) {
353353 LOGGER .debug ("IN" );
354354 DatasetManagementAPI datasetManagementAPI = getDatasetManagementAPI ();
@@ -468,7 +468,7 @@ public String getDataStoreAI(String label, String parameters, Map<String, Object
468468 timing = MonitorFactory .start ("Knowage.AbstractDataSetResource.getDataStore:convertToJson" );
469469 Object gridDataFeed = dataWriter .write (dataStore );
470470
471- transformForAI (gridDataFeed );
471+ transformForAI (gridDataFeed , maxRows != null ? maxRows : 100 );
472472
473473 timing .stop ();
474474
@@ -490,13 +490,13 @@ public String getDataStoreAI(String label, String parameters, Map<String, Object
490490 }
491491 }
492492
493- private void transformForAI (Object gridDataFeed ) throws JSONException {
493+ private void transformForAI (Object gridDataFeed , int maxRows ) throws JSONException {
494494 if (gridDataFeed instanceof JSONObject ) {
495495 JSONObject jsonObject = (JSONObject ) gridDataFeed ;
496496 JSONArray originalRows = jsonObject .getJSONArray ("rows" );
497497 JSONArray slicedRows = new JSONArray ();
498498
499- for (int i = 0 ; i < originalRows .length () && i < 100 ; i ++) {
499+ for (int i = 0 ; i < originalRows .length () && i < maxRows ; i ++) {
500500 slicedRows .put (originalRows .get (i ));
501501 }
502502
0 commit comments