OleMussmann commented on issue #1100:
URL: https://github.com/apache/arrow-adbc/issues/1100#issuecomment-1747452757
After some more testing, I think it works a bit different than stated in the
issue text above, my apologies. The bug is still there, the explanation might
be slightly different, though. StringView works fine and returns the correct
length. The problem lies in the way `strncmp` is used: it evaluates the
comparison after `name.size_bytes` bytes. Imagine I search for a `table_name`
`adbc_pkey_test_something_something` with a length of 34 bytes. It will match
an existing table called `adbc_pkey_test` with a length of 14 bytes. Let's see
this typed out:
```
adbc_pkey_test_something_something <- long table_name
adbc_pkey_testtest_canceladbc_fkey_test_baseadbc_fkey_testadbc_composite_pk[...]
<- name.data
^
(compared until here, name.size_bytes: 14 bytes)
```
The `strncmp` comparison stops after 14 bytes (`name.size_bytes`), not
checking the full length of `table_name`. It finds thus false positive matches
when a table name starts with the name of an existing table and extends beyond.
I hope this is the correct interpretation now. I ran into this issue by
trying to see how certain tests fail, but sometimes they passed where they
should not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]