Skip to content

Commit 470290b

Browse files
committed
HUE-9291 [editor] Add a default limit of 1000 records for streaming data in the result grid
1 parent 7a5f68f commit 470290b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.resultGrid.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ const TEMPLATE = `
180180
</div>
181181
`;
182182

183+
const STREAMING_MAX_ROWS = 1000;
184+
183185
class ResultGrid extends DisposableComponent {
184186
constructor(params, element) {
185187
super();
@@ -581,7 +583,8 @@ class ResultGrid extends DisposableComponent {
581583
dataTable.fnAddData(
582584
initial && this.data().length ? this.data() : this.lastFetchedRows(),
583585
undefined,
584-
this.streaming
586+
this.streaming,
587+
STREAMING_MAX_ROWS
585588
);
586589
} catch (e) {}
587590
const $dataTablesWrapper = $snippet.find('.dataTables_wrapper');

desktop/core/src/desktop/js/jquery/plugins/jquery.huedatatable.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,18 @@ $.fn.hueDataTable = function(oInit) {
640640
}
641641
};
642642

643-
self.fnAddData = function(mData, bRedraw, reverse) {
643+
self.fnAddData = function(mData, bRedraw, streaming, streamRecordLimit) {
644644
const $t = self.$table;
645645

646646
if ($t) {
647647
const aoColumns = $t.data('aoColumns') || [];
648-
$t.data(
649-
'data',
650-
reverse ? mData.reverse().concat($t.data('data')) : $t.data('data').concat(mData)
651-
);
648+
const newData = streaming
649+
? mData.reverse().concat($t.data('data'))
650+
: $t.data('data').concat(mData);
651+
if (streaming && streamRecordLimit) {
652+
newData.splice(streamRecordLimit);
653+
}
654+
$t.data('data', newData);
652655

653656
if (mData.length === 0) {
654657
return;

0 commit comments

Comments
 (0)