`split_part` with position 0 errors on a NULL string only when the position is a literal
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Domínio
- backend, databases, testing-qa
Direção de pesquisa
Start with datafusion/functions/src/string/split_part.rs, especially the fast path and the array path identified in the issue, then review the expr.slt case around the reported test. Decide how the fast path should behave when every string is NULL, using the stated PostgreSQL strictness expectation and the prior review discussion as context. Update the regression test to reflect the chosen behavior and verify the literal and column position cases agree.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
split_part(s, delimiter, 0) on a row where s is NULL returns NULL when the position comes from a column, and errors with "field position must not be zero" when the position is a literal. The fast path for an array string with a scalar delimiter and position rejects position 0 before it looks at any row. The array path skips rows where any argument is NULL, so it errors only on a row whose three arguments are all non-NULL. The two paths disagree whenever no row has a non-NULL string, such as a batch whose strings are all NULL.
To Reproduce
-- Literal delimiter and position: the fast path
SELECT split_part(s, '.', 0) AS r FROM (VALUES (NULL::text)) AS t(s);
-- Execution error: field position must not be zero
-- The same row with the position from a column: the array path
SELECT split_part(s, '.', p) AS r FROM (VALUES (NULL::text, 0)) AS t(s, p);
-- NULL
-- Only literals
SELECT split_part(NULL::text, '.', 0) AS r;
-- NULL
Expected behavior
All three return NULL. PostgreSQL's split_part is strict: its pg_proc entry leaves proisstrict at its default of true, so a NULL argument returns NULL without calling the function.
expr.slt expects the first query's error ("Position 0 with column input errors even for empty/null inputs"), while the review of #21238 asked for the fast path to match the array path (discussion_r3030106101). Which behavior is intended? If it is NULL, the fast path could return all NULLs when the string array has no valid row before checking the position, and the expr.slt case would expect NULL.
Additional context
Property-based tests found this on main at 14b3edd9a3: calling split_part with an array string and scalar delimiter and position gave an error, and the same call with every argument as an array gave NULL. The reproduction runs on main at 14b3edd9a3. The fast path came with #21238.
- Linguagem predominante
- Rust
- Estrelas
- 9.6k
- Forks
- 2.6k
- Merge médio
- 3d 4h
- PRs com merge (30d)
- 345
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
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/datafusion#27315 · 2 comentários ·
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á 9 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
apache/datafusion#27059 ·
Mantenedores costumam responder em até 1 dia
-
`ProjectionExprs::project_statistics` computes approximate `Statistics::total_byte_size` ignoring column statsTalvez já em andamento @joseph-isaacs assumiu há 10 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
apache/datafusion#27050 ·
Mantenedores costumam responder em até 1 dia
-
physical-plan: decoding an Unnest or Explain node with an unset field panicsTalvez já em andamento @geoHeil assumiu há 8 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
apache/datafusion#26999 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de apache/datafusion
Issues semelhantes
-
P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
HerringtonDarkholme/hd-lang#1770 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
jonathanong/no-mistakes#3332 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
swc-project/swc-next-issues#310 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
swc-project/swc-ai-issues#653 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
lbjlaq/Antigravity-Manager#3937 ·
Mantenedores costumam responder em até 1 dia