Skip to content

substring incompatible with spark for negative start index #3919

@andygrove

Description

@andygrove

Describe the bug

Upstream bug: apache/datafusion#21510

Add these tests to substring.sql:

query
SELECT substring(s, -2, 3) FROM test_substring

query
SELECT substring(s, -10, 3) FROM test_substring

query
SELECT substring(s, -300, 3) FROM test_substring

Example failure:

== Results ==
!== Correct Answer - 4 ==              == Spark Answer - 4 ==
 struct<substring(s, -10, 3):string>   struct<substring(s, -10, 3):string>
 []                                    []
![]                                    [abc]
 [ell]                                 [ell]
 [null]                                [null]

Steps to reproduce

No response

Expected behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions