Query KeyConditions with a malformed N value gets HTTP 200, where DynamoDB answers The parameter cannot be converted to a numeric value

Abierto Apto para principiantes
#1,252 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 5 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust, sqlite

Línea de trabajo

Empieza con desugar_key_conditions en crates/engine/src/legacy_filter.rs y handle_query en crates/engine/src/query.rs; después, lee validate_and_normalize_number en crates/core/src/validation/number.rs y la comprobación del valor de expresión en PR #544. Añade la comprobación numérica para los valores N en Legacy KeyConditions antes de almacenarlos. Se considera terminado cuando los valores N malformados y vacíos devuelvan HTTP 400 con el texto de error de DynamoDB, mientras que un valor N válido siga devolviendo HTTP 200; cubre estos casos en pruebas.

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

Descripción

Query on a KEYS_ONLY GSI ngsi with HASH n (N), with the legacy KeyConditions {"n": {"ComparisonOperator": "EQ", "AttributeValueList": [{"N": "abc"}]}}, gets HTTP 200 with Count 0 from ExtendDB. The same request with an empty number, {"N": ""}, gets the same answer.

Amazon DynamoDB answers both requests with HTTP 400 ValidationException:

Value DynamoDB
{"N": "abc"} The parameter cannot be converted to a numeric value: abc
{"N": ""} The parameter cannot be converted to a numeric value: (the text ends in a colon and a space)

With {"N": "1"} both answer HTTP 200 with Count 0. The table has HASH pk and RANGE sk, both S, and holds no items.

The expression form gets the same answers: n = :v with :v set to {"N": "abc"} or {"N": ""} gets HTTP 200 from ExtendDB and the texts above from DynamoDB. #618 lists Query expression values among the values that get no number check, and open PR #544 adds that check for ExpressionAttributeValues.

Measured in us-east-1 on 20 Nov 2026 with signed requests from the AWS SDK for Python, with its parameter validation and retries off. Each request went out twice and got the same answer both times. The ExtendDB answers come from the v1.0.0 release binary on SQLite (npm @extenddb/linux-x64 1.0.0, commit c2e9a32b0), measured the same day with the same requests, twice. origin/main at 2ef56139e changes none of the files named below since v1.0.0.

desugar_key_conditions in crates/engine/src/legacy_filter.rs copies each AttributeValueList value into the key condition's value map as written. In handle_query (crates/engine/src/query.rs), check_key_value_type compares the type descriptor with the key schema and does not read the number. No call to validate_and_normalize_number (crates/core/src/validation/number.rs) reads these values before storage, so the SQLite backend looks up the text abc and finds no row.

Not measured: a RANGE key entry, the other operators, and PostgreSQL, MongoDB and Cassandra. #618 records HTTP 500 for a BatchWriteItem that writes an N sort key abc. I did not check whether this Query answers 200 on the other backends.

Proposed change: check each N value of KeyConditions with the number rules before storage, and answer the texts above. The check for ExpressionAttributeValues in #544 gives the expression form the same answers. The empty value needs the colon and the space that #960 asks for.

Lenguaje dominante
Rust
Estrellas
517
Forks
60
Merge medio
4 d 23 h
PR fusionados (30 d)
134

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ExtendDB/extenddb

Todos los issues de ExtendDB/extenddb

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.