Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class RowMatrix(
throw new IllegalArgumentException(s"Argument with more than 65535 cols: $cols")
}
if (cols > 10000) {
val mem = cols * cols * 8
val mem = (math.pow(cols, 2) * 8).formatted("%,.0f")
Copy link
Member

Choose a reason for hiding this comment

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

I know it's minor, but I think it might be simpler to report megabytes in the warning message, since the reported size is at least 800MB. Then this can be simply val memMB = (cols.toLong * cols) / 125000; that multiplication can't overflow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Surely I can do it. I was worrying some one may ask for the accurate number in the PR~~ :)

Another thing is, /125000 might should be changed to >> 15?

Copy link
Member

Choose a reason for hiding this comment

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

>> 17 ? a mebibyte is 2^20 bytes so that would make sense. I don't know what the overall stance on mega vs mebibyte is in the nomenclature here but think everything is megabytes, in which case / 125000 is right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, 17...I'll send update tomorrow morning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe this 1000/1024 thing is why they send actual bytes in the beginning... :)

logWarning(s"$cols columns will require at least $mem bytes of memory!")
}
}
Expand Down