You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/nest-server/src/app/app.service.ts
+8-1Lines changed: 8 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,14 @@ export class AppService {
48
48
constresults=awaitclient.query(
49
49
`select returnflag, linestatus, sum(quantity) as sum_qty, sum(extendedprice) as sum_base_price, sum(extendedprice * (1 - discount)) as sum_disc_price, sum(extendedprice * (1 - discount) * (1 + tax)) as sum_charge, avg(quantity) as avg_qty, avg(extendedprice) as avg_price, avg(discount) as avg_disc, count(*) as count_order from lineitem where shipdate <= date '1998-12-01' group by returnflag, linestatus order by returnflag, linestatus`,
Copy file name to clipboardExpand all lines: presto-client/README.md
+46-4Lines changed: 46 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,11 +97,18 @@ try {
97
97
98
98
### Additional notes
99
99
100
-
Additional notes
100
+
Additional notes on the `query` method:
101
101
102
-
- The `query` method is asynchronous and will return a promise that resolves to a PrestoQuery object.
103
-
- The `query` method will automatically retry the query if it fails due to a transient error.
104
-
- The `query` method will cancel the query if the client is destroyed.
102
+
- It's asynchronous and will return a promise that resolves to a PrestoQuery object.
103
+
- It will automatically retry the query if it fails due to a transient error.
104
+
- It will cancel the query if the client is destroyed.
105
+
-\*It parses big numbers with the BigInt JavaScript primitive. If your Presto response includes a number bigger than `Number.MAX_SAFE_INTEGER`, it will be parsed into a bigint, so you may need to consider that when handling the response, or serializing it.
106
+
107
+
\* Only if the current JavaScript environment supports the reviver with context in the JSON.parse callback. Check compatibility here:
Otherwise, bigger numbers will lose precision due to the default JavaScript JSON parsing.
105
112
106
113
## Get Query metadata information
107
114
@@ -240,3 +247,38 @@ const client = new PrestoClient({
240
247
user: 'root',
241
248
})
242
249
```
250
+
251
+
## Troubleshooting
252
+
253
+
### Do not know how to serialize a BigInt
254
+
255
+
Example error message:
256
+
257
+
```
258
+
Do not know how to serialize a BigInt
259
+
TypeError: Do not know how to serialize a BigInt
260
+
at JSON.stringify (<anonymous>)
261
+
```
262
+
263
+
Make sure to write a custom replacer and handle the serialization of BigInts if your Presto query returns a number bigger than `Number.MAX_SAFE_INTEGER`.
If working with numbers bigger than `Number.MAX_SAFE_INTEGER`, and your environment does not support the `JSON.parse` with the context in the reviver (Node.js > 21.0.0, and certain browser versions), the default JSON.parse will make the number lose precision.
0 commit comments