Skip to content

Commit

Permalink
Support BigInt in the QueryResult component (prestodb#24336)
Browse files Browse the repository at this point in the history
Check the data type of a row and pass different selector functions.
BigInt data type needs to explicitly use the `toString()` function to
print out the value.

Signed-off-by: Yihong Wang <yh.wang@ibm.com>
  • Loading branch information
yhwang authored Jan 23, 2025
1 parent b1d4e22 commit bd4c541
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 3 additions & 2 deletions presto-ui/src/components/QueryResults.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ export function QueryResults({ results }) {

const getColumns = () => {
return results.columns.map((row, index) => {
return {
let column = {
name: row.name,
selector: row => row[index],
};
column.selector = row.type === 'bigint' ? row => row[index].toString() : row => row[index];
return column;
});
};

Expand Down
2 changes: 1 addition & 1 deletion presto-ui/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"webpack-dev-server": "^4.15.1"
},
"dependencies": {
"@prestodb/presto-js-client": "^1.0.0",
"@prestodb/presto-js-client": "^1.0.1",
"antlr4": "^4.13.1-patch-1",
"clsx": "^2.1.0",
"copy-webpack-plugin": "^12.0.2",
Expand Down
8 changes: 4 additions & 4 deletions presto-ui/src/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1098,10 +1098,10 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@prestodb/presto-js-client@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@prestodb/presto-js-client/-/presto-js-client-1.0.0.tgz#fa458866581a6ec4e0b9be7f8ab5bae3097f8c8a"
integrity sha512-B8d0Wl8XMrtqotRTTM45GVk6bV7GER1Pbt4vUb2Ex5dUP1/WkqKMuD0LMWoO9zaiSS70DtBpvwu372BS1GjNgQ==
"@prestodb/presto-js-client@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@prestodb/presto-js-client/-/presto-js-client-1.0.1.tgz#978c9c22c17677f3157df80383efb23412d4aa70"
integrity sha512-6NHcpSi9EQZKgfYgOUYgyTuC4PAjs+23o9ANym5wZ/Omu8m586OplRVmels0MrzPC5LdHA94FWkscuunaEvcDg==

"@sindresorhus/merge-streams@^2.1.0":
version "2.3.0"
Expand Down

0 comments on commit bd4c541

Please sign in to comment.