fix sparse getindex regression

This PR aims to fix broken `getindex` for sparse matrices with index type other than `Int` and adds some related tests.
ref #7131, #7047

same here, convert  to `int`?