apache / apache/parquet-java

Breaking change in Avro 1.12.1 affects parquet-avro users: logical types now deserialize to different Java types

Abierto
#3,515 1 comentario 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Java
Estrellas
3.1k
Forks
1.6k
Merge medio
3 d 12 h
PR fusionados (30 d)
33

Descripción

## Summary

Avro 1.12.1 introduces a breaking change that affects `parquet-avro` users. Multiple logical types are now deserialized to their proper Java types instead of their underlying primitive types when using `ReflectData`, causing `ClassCastException` in existing code.

## Background

- **Upstream issue:** https://issues.apache.org/jira/browse/AVRO-3989
- **Pull request:** https://github.com/apache/avro/pull/3354
- **Avro version affected:** 1.12.1 (released as a patch version)

## Problem

The fix in AVRO-3989 changed the deserialization behavior for ALL logical types. When using within parquet-avro `ReflectData` or `SpecificData` classes, these fields now return their logical Java type objects instead of their underlying primitive types from `GenericRecord`.

### Affected logical types and conversions:

| Logical Type | Old Type (≤1.12.0) | New Type (1.12.1) |
|--------------|-------------------|-------------------|
| `timestamp-millis` | `Long` | `Instant` |
| `timestamp-micros` | `Long` | `Instant` |
| `date` | `Integer` | `LocalDate` |
| `time-millis` | `Integer` | `LocalTime` |
| `time-micros` | `Long` | `LocalTime` |
| `local-timestamp-millis` | `Long` | `LocalDateTime` |
| `local-timestamp-micros` | `Long` | `LocalDateTime` |
| `uuid` | `String` | `UUID` |
| `decimal` | `ByteBuffer` | `BigDecimal` |

This breaks existing code that expects primitive values:

```java
// This used to work in Avro 1.12.0
Long timestamp = (Long) genericRecord.get("timestamp_field");
Integer date = (Integer) genericRecord.get("date_field");
String uuid = (String) genericRecord.get("uuid_field");

// In Avro 1.12.1, all of these throw ClassCastException
// because values are now Instant, LocalDate, UUID, etc.
```

## Impact

- **Widespread breakage:** Affects anyone using parquet-avro with ANY logical types
- Code that has worked for years suddenly breaks after a patch version update
- The breaking nature wasn't clearly documented in Avro's changelog
- This is a significant behavior change that affects the entire logical type system

## Heads up for future avro updates

I apologize if this isn't the right place to report this, please feel free to redirect me if there's a better venue for this discussion. My main goal is to ensure that when parquet-java does consider updating Avro, the team and users are aware of this significant behavioral change.

## For Current Users

If you're using parquet-avro and explicitly upgrading Avro to 1.12.1+ in your project, be aware of this breaking change. You'll need to update code that reads logical type fields from `GenericRecord`.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza con el enlace AVRO-3989 del issue y el comportamiento de ReflectData, SpecificData y GenericRecord descrito aquí; no se nombra ningún archivo ni prueba de parquet-java. Compara el manejo de los tipos lógicos indicados en Avro 1.12.0 y 1.12.1 y, después, determina con los maintainers qué cambio o documentación se espera antes de definir cuándo se considera terminado.

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

Evaluación

Stack tecnológico
java
Área
data-engineering
Tipo de issue
Error
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.