Azure / Azure/Azure-DataFactory

DF incorrectly maps Oracle NUMBER(18) to BIGINT instead of DECIMAL(18,0), causing SqlDecimal-to-BIGINT conversion failures

Abierto
#751 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
PowerShell
Estrellas
529
Forks
623
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

### Summary
When using **Azure Data Factory’s Auto-Creat​e Table** feature with Oracle as the source and SQL Server as the sink, ADF inconsistently maps Oracle numeric types.

- Oracle `NUMBER(38)` → correctly mapped to `DECIMAL(38,0)`
- Oracle `NUMBER(18)` → incorrectly mapped to **BIGINT**

This is unsafe because ADF internally reads Oracle NUMBER values as **SqlDecimal**, which cannot always be converted to BIGINT. This directly causes pipeline failures during copy operations.

---

### Actual Behavior
ADF creates the SQL table with:

```sql
ACCOUNT_ID BIGINT

But during ingestion, ADF reads Oracle NUMBER as SqlDecimal and fails with:

The given value '526797' of type SqlDecimal cannot be converted to type bigint.

This matches previously documented ADF behaviors where numeric conversion between source decimals and SQL numeric types fails when precision/scale are not compatible. [learn.microsoft.com]
Additionally, Oracle NUMBER fields may contain internal decimal precision even when declared as integer-like, which is known to cause precision issues during ADF Oracle→SQL migrations and requires workarounds (CAST, ROUND, TO_CHAR) to avoid failures. [github.com],

Expected Behavior
ADF should map Oracle NUMBER(18) to DECIMAL(18,0), not BIGINT.
Why?

DECIMAL(18,0) is fully compatible with Oracle NUMBER semantics.
It avoids ingestion failures when ADF receives SqlDecimal values.
It preserves precision safely.
The performance difference vs BIGINT is negligible.
DECIMAL has no practical drawbacks in SQL Server for integer data.
ADF already maps NUMBER(38) to DECIMAL(38,0) — so mapping NUMBER(18) the same way ensures consistency.

Impact
This inconsistency breaks large-scale dynamic ingestion pipelines using:

dynamic datasets
metadata-driven loops
auto-create table

Auto-create cannot be reliably used because ADF may arbitrarily choose BIGINT even when DECIMAL is the correct and safe type.
This forces users to implement workarounds such as:

dynamic CASTing in SELECT statements
TO_CHAR conversions
manual schema overrides
disabling auto-create entirely

These are unnecessary if ADF simply mapped NUMBER(18) → DECIMAL(18,0).

Repro Steps

Source: Oracle table with column ACCOUNT_ID NUMBER(18)
Sink: SQL Server
Enable “Auto-create table”
Run ADF Copy activity
Observe:
Sink column created as BIGINT
Copy activity fails with SqlDecimal → BIGINT conversion errors

Request
Please update the type-mapping behavior:
Proposed mapping change:

From: NUMBER(p) where p ≤ 19 and scale=0 MAPS TO bigint
To: NUMBER(p) where p ≤ 19 and scale=0 MAPS TO decimal(p,0)

This makes the behavior safe, predictable, and consistent with how NUMBER(38) is handled.

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

No se nombran archivos del repositorio, pruebas ni puntos de entrada del código. Empieza con la reproducción de Oracle NUMBER(18) a SQL Server usando ADF Auto-create Table y verifica el esquema BIGINT generado y el fallo de conversión de SqlDecimal; se considera terminado cuando el mapeo produce DECIMAL(18,0) y la copia se realiza correctamente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
azure, sql
Área
cloud, data-engineering, databases
Tipo de issue
Error
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Bien especificado
Aptitud para principiantes
30/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.