Skip to content

Commit

Permalink
fix: make sure parquet-wasm works with duckdb
Browse files Browse the repository at this point in the history
  • Loading branch information
lucien martijn committed Feb 1, 2025
1 parent fcde7a8 commit 61d0545
Show file tree
Hide file tree
Showing 2 changed files with 266 additions and 184 deletions.
63 changes: 42 additions & 21 deletions media/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

let aceEditor

let dataTableBuilt = false
let isQueryRunning = false

let currentPageDataTab = 1
Expand All @@ -36,6 +35,8 @@
let numRecordsDropDownResultTableHasChanged = false
let numRecordsDropdownSelectedIndex = 0

let isQueryAble = false;

const requestSourceDataTab = 'dataTab'
const requestSourceQueryTab = 'queryTab'

Expand Down Expand Up @@ -444,7 +445,9 @@
resultsTable.on('popupOpened', onPopupOpenedQueryResultTab)

resultsTable.on('tableBuilt', function (data) {
initializeSort(requestSourceQueryTab)
if (isQueryAble) {
initializeSort(requestSourceQueryTab)
}
resetQueryControls()
resetQueryResultControls(rowCountQueryTab)
initializeFooter(rowCountQueryTab, requestSourceQueryTab)
Expand Down Expand Up @@ -655,9 +658,11 @@
) {
let columns = headers.map((c) => ({
...c,
sorter: function (a, b, aRow, bRow, column, dir, sorterParams) {
return 0
},
...(isQueryAble && {
sorter: function (a, b, aRow, bRow, column, dir, sorterParams) {
return 0
},
}),
cellClick: onCellClick,
}))

Expand Down Expand Up @@ -696,7 +701,11 @@
})

dataTable.on('tableBuilt', () => {
initializeSort(requestSourceDataTab)
// console.log("data Table built")
if (isQueryAble){
initializeSort(requestSourceDataTab)
}

initializeFooter(rowCountDataTab, requestSourceDataTab)
updatePageCounterState(
currentPageDataTab,
Expand Down Expand Up @@ -922,7 +931,7 @@
clearIcon.style.display = 'none'
}

const searchValue = filterValueInput.value.trim()
const searchValue = filterValueInput?.value.trim()

// Clear the minimum timeout whenever input changes
clearTimeout(minSearchInputTimeout)
Expand Down Expand Up @@ -987,7 +996,7 @@
vscode.postMessage({
type: 'exportQueryResults',
exportType: selectedOption,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
sort: sortObjectQueryTab,
})

Expand Down Expand Up @@ -1103,7 +1112,7 @@
pageSize: pageSize,
pageNumber: pageNumber,
sort: sort,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
source: requestSource,
})
})
Expand Down Expand Up @@ -1136,7 +1145,7 @@
pageSize: pageSize,
pageNumber: pageNumber,
sort: sort,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
source: requestSource,
})
})
Expand Down Expand Up @@ -1167,7 +1176,7 @@
pageSize: pageSize,
pageNumber: pageNumber,
sort: sort,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
source: requestSource,
})
})
Expand Down Expand Up @@ -1200,7 +1209,7 @@
pageSize: pageSize,
pageNumber: pageNumber,
sort: sort,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
source: requestSource,
})
})
Expand Down Expand Up @@ -1246,7 +1255,7 @@
newPageSize: pageSize,
pageNumber: pageNumber,
sort: sort,
searchString: filterValueInput.value,
searchString: filterValueInput?.value,
source: requestSource,
},
})
Expand All @@ -1262,16 +1271,22 @@
case 'init': {
const tableData = body.tableData
if (tableData) {
defaultPageSizes = tableData.settings.defaultPageSizes
rowCountDataTab = tableData.totalRowCount
initDataTable(
[],
tableData.headers,
tableData.totalPageCount
)
initSchema(tableData.schemaTabData)
initMetaData(tableData.metaData)
if (tableData.isQueryAble) {
isQueryAble = tableData.isQueryAble
defaultPageSizes = tableData.settings.defaultPageSizes

if (!tableData.isQueryAble) {
rowCountDataTab = tableData.totalRowCount
amountOfPagesDataTab = tableData.totalPageCount
initDataTable(
tableData.rawData,
tableData.headers,
tableData.totalPageCount
)
document.getElementById('data-tab')?.click()
}
else {
initCodeEditor(
tableData.settings.defaultQuery,
tableData.settings.shortCutMapping,
Expand All @@ -1280,10 +1295,16 @@
)
schemaQueryResult = tableData.schema
rowCountQueryTab = tableData.rowCount
rowCountDataTab = tableData.rowCount
currentPageQueryTab = tableData.currentPage
amountOfPagesQueryTab = tableData.pageCount
initializeQueryResultControls()
initResultTable(tableData.rawData, tableData.headers)
initDataTable(
[],
tableData.headers,
tableData.totalPageCount
)
}
}
break
Expand Down
Loading

0 comments on commit 61d0545

Please sign in to comment.