Comments (2)
In ClickHouse, when using JSON* family formats, numbers larger than Int32 are represented as strings, as Int64+ types maximum values are larger than Number.MAX_SAFE_INTEGER
. This is to avoid integer overflow as max values for these types are bigger than Number.MAX_SAFE_INTEGER
. However, this behavior can be modified with output_format_json_quote_64bit_integers
setting.
Here is an example of how to adjust the JSON output format for 64-bit numbers:
const resultSet = await client.query({
query: 'SELECT * from system.numbers LIMIT 1',
format: 'JSONEachRow',
})
expect(await resultSet.json()).toEqual([ { number: '0' } ])
const resultSet = await client.query({
query: 'SELECT * from system.numbers LIMIT 1',
format: 'JSONEachRow',
clickhouse_settings: { output_format_json_quote_64bit_integers: 0 },
})
expect(await resultSet.json()).toEqual([ { number: 0 } ])
In the first query, the number is returned as a string, while in the second query, with the output_format_json_quote_64bit_integers
setting set to 0, the number is returned as a number.
However, it's important to note that there are some known limitations when using ClickHouse with Node.js/Web. For instance, when using JSON* family formats, numbers larger than Int32 are represented as strings, as Int64+ types maximum values are larger than Number.MAX_SAFE_INTEGER
.
For more details, you can refer to the following documentation:
from clickhouse.
Thanks for the thorough explanation! Apologies for missing this in the docs as well.
from clickhouse.
Related Issues (20)
- Query with hundreds of selected columns is eating up memory HOT 3
- Explicit use-after-dtor logic in `HashTable.h` HOT 1
- Slow index analysis in case of long PK (even if most columns are not used) HOT 2
- encrypt/decrypt functions became 20x times slower after 24.4 HOT 2
- HTTP Interface returns 200 OK in case of server-side receive timeout while reading (parts of) the request body
- Autocast Strings to Int for Enum for JSON
- Why I do not need SELECT on all source tables to select from mv with PASTE JOIN
- Dual password support HOT 4
- Skip Index `set` is not used with IN operator HOT 1
- TopK with Counts HOT 1
- Crash in index analysis with tuple HOT 1
- If you query a directory with s3 or file-like engines, it should be identical to querying `*` inside it. HOT 4
- With analyzer on restriction `joined_subquery_requires_alias` is not working
- Add CTE support to UDF
- Cache dictionary + short circuit evaluation: Expected the argument №3 ('' of type String) to have 256 rows, but it has 240
- Load job "system.part_log" failed JSON exception: error: 1 unexpected end of data HOT 3
- `02572_query_views_log_background_thread` is flaky
- Add ENUM support to WITH FILL
- 23.11 segfault HOT 1
- FINAL on table with is_deleted works 10-30 times slower than expected HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clickhouse.