n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
48.12k stars 7.44k forks source link

Google BigQuery Node Returns Integer Values as String Instead of Number #10503

Closed airatvibe closed 1 month ago

airatvibe commented 2 months ago

Bug Description

I'm encountering an issue with the Google BigQuery node in n8n. When querying integer fields from BigQuery, the node returns the values as strings instead of numbers. This behavior can cause unexpected results in subsequent nodes that expect numeric data types.

Google BigQuery node version 2.1 (Latest)

Output example: image

DB schema:

image

[
  {
    "name": "storeId",
    "mode": "NULLABLE",
    "type": "INTEGER",
    "description": "",
    "fields": []
  },
  {
    "name": "GLN",
    "mode": "NULLABLE",
    "type": "INTEGER",
    "description": "",
    "fields": []
  },
  {
    "name": "chainGLN",
    "mode": "NULLABLE",
    "type": "INTEGER",
    "description": "",
    "fields": []
  }
]

To Reproduce

  1. Set up a Google BigQuery node in n8n.
  2. Query a table that contains integer fields.
  3. Inspect the output from the BigQuery node.

Expected behavior

The integer fields should be returned as numbers.

Operating System

Alpine Linux v3.20

n8n Version

1.54.4

Node.js Version

3.4

Database

PostgreSQL

Execution mode

queue

Joffcom commented 2 months ago

Hey @AiratHalitov,

We have created an internal ticket to look into this which we will be tracking as "GHC-177"

airatvibe commented 2 months ago

When I try to cast the values ​​to int type it doesn't help:

SELECT 
  CAST(storeId AS INT64) AS storeId,
  CAST(GLN AS INT64) AS GLN,
  CAST(chainGLN AS INT64) AS chainGLN
FROM `{{ $json.dbname }}`
LIMIT 10;

image

airatvibe commented 1 month ago

Related: https://community.n8n.io/t/google-bigquery-node-returns-integer-values-as-string-instead-of-number/54825

Joffcom commented 1 month ago

Hey @AiratHalitov,

This is likely to be where we don't support int64 fully as Javascript has issues with larger numbers. Instead a string is used to make sure the number is not rounded which would cause more issues.

janober commented 1 month ago

Fix got released with n8n@1.62.1