Skip to content

round IndexAccess for numerical strings over int columns#2246

Merged
jycor merged 1 commit intomainfrom
james/concat
Jan 9, 2024
Merged

round IndexAccess for numerical strings over int columns#2246
jycor merged 1 commit intomainfrom
james/concat

Conversation

@jycor
Copy link
Copy Markdown
Contributor

@jycor jycor commented Jan 8, 2024

},
},
{
Query: "select * from mytable where i > '-0.5';",
Copy link
Copy Markdown
Contributor

@max-hoffman max-hoffman Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried an index lookup but I'm not seeing the same issue for some reason, does that make sense that it's just static range scans?

select /*+ LOOKUP_JOIN(b,a) */ * from mytable a join mytable b on a.i = '-.5' and a.s = b.s
Project
 ├─ columns: [a.i:2!null, a.s:3!null, b.i:0!null, b.s:1!null]
 └─ LookupJoin
     ├─ Eq
     │   ├─ a.s:3!null
     │   └─ b.s:1!null
     ├─ TableAlias(b)
     │   └─ Table
     │       ├─ name: mytable
     │       ├─ columns: [i s]
     │       ├─ colSet: (3,4)
     │       └─ tableId: 2
     └─ Filter
         ├─ Eq
         │   ├─ a.i:0!null
         │   └─ -.5 (longtext)
         └─ TableAlias(a)
             └─ IndexedTableAccess(mytable)
                 ├─ index: [mytable.i]
                 ├─ keys: [-.5 (longtext)]
                 ├─ colSet: (1,2)
                 ├─ tableId: 1
                 └─ Table
                     ├─ name: mytable
                     └─ columns: [i s]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it hits this case if we are using a lookup join:
https://github.com/dolthub/go-mysql-server/pull/2246/files#diff-66b16c24d40520a9c552a4093466441a1623797f6aea41f208809bf2eee3de8cR114

(The range is empty unless its a whole number)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kk, so I guess this bug only applies to non-equalities.

Copy link
Copy Markdown
Contributor

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, seems like there is potential for adjacent tests to make sure index conversions work for different types

@jycor jycor merged commit 0445289 into main Jan 9, 2024
@jycor jycor deleted the james/concat branch January 9, 2024 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected Result when Querying with CONCAT

2 participants