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

Read CSV ArrayIndexOutOfBoundsException #320

pedromorfeu opened this issue Jan 14, 2019 · 1 comment


Copy link

commented Jan 14, 2019

Expected behavior

It should be allowed to use an offset > 0.

Actual behavior

Say offset is 8. For a Point, endOffset is 9. So, code (FormatMapper#readCoordinates):

final Coordinate[] coordinates = new Coordinate[(actualEndOffset - startOffset + 1) / 2];

will calculate a coordinates array with size 1, which is correct.

However, the for loop will try to access array index 4 in coordinates[i / 2]:

for (int i = this.startOffset; i <= actualEndOffset; i += 2) {
      coordinates[i / 2] = new Coordinate(Double.parseDouble(columns[i]), Double.parseDouble(columns[i + 1]));

Steps to reproduce the problem

Read file:



val objectRDD = new PointRDD(sc, "src/main/resources/offset-error.csv", 3, FileDataSplitter.CSV, true)


GeoSpark version = 1.1.3

Apache Spark version = 2.1.0

JRE version = 1.8? Yes

API type = Scala or Java? Scala


This comment has been minimized.

Copy link

commented Jan 15, 2019

@pedromorfeu Thanks for finding this issue. It is really a naive mistake from me.

@jiayuasu jiayuasu self-assigned this Jan 15, 2019

@jiayuasu jiayuasu added this to the 1.2.0 milestone Jan 15, 2019

@jiayuasu jiayuasu referenced this issue Mar 4, 2019

@jiayuasu jiayuasu closed this Mar 4, 2019

@jiayuasu jiayuasu added resolved and removed in progress labels Mar 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.