`lpad` and `rpad` with a literal length above `i32::MAX` error on a NULL string or fill
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 77/100
Direção de pesquisa
Comece em datafusion/functions/src/unicode/pad.rs, comparando o caminho rápido para comprimentos escalares com o tratamento de NULL no caminho de arrays. Verifique os casos existentes em string_literal.slt e a correção relacionada de split_part mencionada na issue. O trabalho estará concluído quando lpad e rpad retornarem NULL para comprimentos literais excessivos em linhas com uma string NULL ou preenchimento NULL, mas continuarem gerando erro nas linhas em que os argumentos relevantes não forem NULL.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
lpad(s, n) on a row where s is NULL and n is above i32::MAX errors when n is a literal, and returns NULL when n comes from a column. A NULL fill behaves the same, and so does rpad. The fast path for a scalar length rejects a length above i32::MAX before it looks at any row. The array path skips rows where any argument is NULL before it checks the length, so it errors only on a row whose string and fill are both non-NULL.
To Reproduce
-- Literal length: the fast path
SELECT lpad(s, 2147483648) AS r FROM (VALUES (NULL::text)) AS t(s);
-- Execution error: lpad requested length 2147483648 too large, maximum allowed length is 2147483647
-- The same row with the length from a column: the array path
SELECT lpad(s, n) AS r FROM (VALUES (NULL::text, 2147483648)) AS t(s, n);
-- NULL
-- A NULL fill with a literal length
SELECT lpad(s, 2147483648, f) AS r FROM (VALUES ('a', NULL::text)) AS t(s, f);
-- Execution error: lpad requested length 2147483648 too large, maximum allowed length is 2147483647
-- The same row with the length from a column
SELECT lpad(s, n, f) AS r FROM (VALUES ('a', 2147483648, NULL::text)) AS t(s, n, f);
-- NULL
The same four queries with rpad give the same results.
Expected behavior
All four return NULL, as the array path does. string_literal.slt already expects NULL for a NULL string or fill with a literal length in range, and #27352 made split_part's fast path return NULL in the same situation (#27276).
Could the fast path skip a length above i32::MAX, as it already skips one above MAX_SCALAR_TARGET_LEN, instead of returning the error? The array path would then return the error for the first row whose string and fill are non-NULL, and NULL for the other rows.
Additional context
Property-based tests found this on main at e2dc8b048b: one row of a call with an array of lengths returned NULL, and the same row called with every argument as a scalar returned the error. The reproduction runs on main at e2dc8b048b. The check in the fast path came with #20657 and moved to pad.rs in #26367.
- Linguagem predominante
- Rust
- Estrelas
- 9.6k
- Forks
- 2.6k
- Merge médio
- 3d 5h
- PRs com merge (30d)
- 352
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de apache/datafusion
-
`verify-release-candidate.sh` version check doesn't catch `-dev` versions and is skipped on macOSTalvez já em andamento @vinycalves assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
apache/datafusion#27563 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
`MoveTowardsLeafNodes` placement implies speculative evaluation, but the docs don't say soTalvez já em andamento @Inf1mum assumiu há 1 dia. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/datafusion#27487 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
Window constructors panic when the expression list is emptyTalvez já em andamento @abp002 assumiu há 4 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/datafusion#27315 · 3 comentários · 1 responsável ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/datafusion#27094 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Substrait consumer doesn't recognise `shift_left` / `shift_right` from functions_arithmetic.yamlTalvez já em andamento @jonasHanhan assumiu há 15 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/datafusion#27059 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/datafusion
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
tinystream-dev/tinystream#132 ·
-
contract good first issue testing
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
Emmyt24/nova-launch#2436 ·
Mantenedores costumam responder em até 1 dia