Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReadColumnByPath signature takes int not int64 #195

Closed
nickpoorman opened this issue Dec 16, 2019 · 2 comments
Closed

ReadColumnByPath signature takes int not int64 #195

nickpoorman opened this issue Dec 16, 2019 · 2 comments

Comments

@nickpoorman
Copy link

is there any reason why ReadColumnByPathReadColumnByPath takes an int for the number of columns to read?

func (self *ParquetReader) ReadColumnByPath(pathStr string, num int) (values []interface{}, rls []int32, dls []int32, err error) {

In order to use this, the developer has to covert the number of rows to int before passing them in and then they get converted back to int64 again inside ReadColumnByPathReadColumnByPath.

To use:

num := int(pr.GetNumRows())
values, _, _, err := pr.ReadColumnByPath("some.path", num)

Converted back to int64 inside ReadColumnByPathReadColumnByPath:

table, _ := cb.ReadRows(int64(num))

In order to use this safely, I now need to also add some logic to check the size of int on the system it's running on.

if strconv.IntSize != 64 {
    log.Printf("Warning: you are running this on a 32-bit system. Possible overflow if number of rows exceeds: %d. Number of rows: %d", math.MaxInt32, pr.GetNumRows())
}
@xitongsys
Copy link
Owner

hi, @nickpoorman
no specific reasons and i fixed it in latest version. please check it.

@nickpoorman
Copy link
Author

Looks good! Thanks.

zolstein pushed a commit to zolstein/parquet-go that referenced this issue Jun 23, 2023
…skipped (xitongsys#195)

* fix lazy reading of dictionary pages when first column chunk page is skipped

* factorize more code, use less abstractions

* fix comment
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

No branches or pull requests

2 participants