Skip to content

Commit 925172c

Browse files
set infer rows limit and save loaded table schema for column descriptors in table view (#49)
1 parent 783f843 commit 925172c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/views/tableView.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ export class TableView {
4242
private _disposables: Disposable[] = [];
4343

4444
// tabular data vars
45+
private _tableSchema: any;
4546
private _tableData: [] = [];
4647
private _currentDataPage: number = 0;
4748
private _totalRows: number = 0;
4849

49-
// default page data size for data streaming setup
50-
// TODO: move this to tabular data viewer config options later
50+
// TODO: move the settings below to tabular data viewer config options later
51+
// default page data size for incremental data loading into table view
5152
private readonly _pageDataSize: number = 1000;
5253

54+
// infer table schema rows sample size limit
55+
private readonly _inferDataSize = 100;
56+
5357
/**
5458
* Reveals current table view or creates new table webview panel for tabular data display.
5559
*
@@ -198,14 +202,14 @@ export class TableView {
198202
const table = await Table.load(this._documentUri.fsPath);
199203

200204
// infer table shema
201-
const tableInfo = await table.infer();
202-
console.log('tabular.data.view:tableInfo:', tableInfo);
205+
this._tableSchema = await table.infer(this._inferDataSize);
206+
console.log('tabular.data.view:tableInfo:', this._tableSchema);
203207

204208
// read all table data rows
205209
const tableData: [] = await table.read({keyed: true});
206210
this.logTableData(tableData, table.headers);
207211

208-
// save table data for incrementally loading into table view later
212+
// save table data for incremental load into table view later
209213
this._tableData = tableData;
210214
this._totalRows = this._tableData.length;
211215

0 commit comments

Comments
 (0)