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

NullPointer Exception When Creating HeatMap #164

Closed
kanghq opened this issue Dec 9, 2017 · 5 comments
Closed

NullPointer Exception When Creating HeatMap #164

kanghq opened this issue Dec 9, 2017 · 5 comments

Comments

@kanghq
Copy link

kanghq commented Dec 9, 2017

Babylon 0.2.1
GeoSpark 0.6.2
Spark 2.0.1
Followed the template to create a heat map but an error occurred.
Wondering any specific requirement for the input PolygonRDD?
I think the error occurred at Visualize function, Colorize()
Line 512
this.maxPixelCount = this.distributedRasterCountMatrix.max(new RasterPixelCountComparator())._2;

	Envelope BJBoundary = new Envelope(114.24,118.24,37.54,41.54);
	HeatMap visualizationOperator = new HeatMap(1000,600,BJBoundary,false,2);
	visualizationOperator.Visualize(sc, mypolygonRDD);
	BabylonImageGenerator imageGenerator = new  BabylonImageGenerator();
	imageGenerator.SaveRasterImageAsLocalFile(visualizationOperator.rasterImage, outputPath,ImageType.PNG);

java.lang.NullPointerException
at org.datasyslab.babylon.utils.Pixel.equals(Pixel.java:140)
at org.apache.spark.util.collection.AppendOnlyMap.changeValue(AppendOnlyMap.scala:143)
at org.apache.spark.util.collection.SizeTrackingAppendOnlyMap.changeValue(SizeTrackingAppendOnlyMap.scala:32)
at org.apache.spark.util.collection.ExternalAppendOnlyMap.insertAll(ExternalAppendOnlyMap.scala:163)
at org.apache.spark.Aggregator.combineCombinersByKey(Aggregator.scala:50)
at org.apache.spark.shuffle.BlockStoreShuffleReader.read(BlockStoreShuffleReader.scala:85)
at org.apache.spark.rdd.ShuffledRDD.compute(ShuffledRDD.scala:109)
at org.apache.spark.rdd.RDD.computeOrReadCheckpoint(RDD.scala:319)
at org.apache.spark.rdd.RDD.iterator(RDD.scala:283)
at org.apache.spark.scheduler.ResultTask.runTask(ResultTask.scala:70)
at org.apache.spark.scheduler.Task.run(Task.scala:86)
at org.apache.spark.executor.Executor$TaskRunner.run(Executor.scala:274)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

@kanghq
Copy link
Author

kanghq commented Dec 10, 2017

please add following sentences in the Pixel Class equals function.
You did not check the type of Object O, which will cause above exception!

if(!(o instanceof Pixel))
return false;

@geoHeil
Copy link

geoHeil commented Dec 11, 2017

Probably caused by kryo

@jiayuasu
Copy link
Member

@kanghq After adding this line, will you still be able to see the correct image?

@kanghq
Copy link
Author

kanghq commented Dec 12, 2017

@jiayuasu yup image shows correctly.

@geoHeil I think NULL check is always required in Java when overriding equals function. no matter what serialization tool you use.

https://users.soe.ucsc.edu/~eaugusti/archive/102-winter16/misc/howToOverrideEquals.html
How To Override the equals method inherited from the Object class...

@jiayuasu
Copy link
Member

jiayuasu commented Dec 13, 2017

@kanghq Thanks for the reminder. Do you mind sharing some of your data with me so that I can reproduce this issue?

Because GeoSparkViz does have unit tests for many different datasets and every release passed tests. I am very curious about what triggers this problem and what leads to a Null pixel.

jiayuasu pushed a commit that referenced this issue Jun 7, 2024
* feat: Add ST_ForceCollection

* fix: snowflake tests

* fix: snowflake tests

* chore: remove print statement

* chore: add GeometryCollection test

* docs: add detailed explanation
jiayuasu added a commit that referenced this issue Jun 7, 2024
* [TASK-78] Add ST_ForceCollection (#164)

* feat: Add ST_ForceCollection

* fix: snowflake tests

* fix: snowflake tests

* chore: remove print statement

* chore: add GeometryCollection test

* docs: add detailed explanation

* Update version

* [TASK-78] Add ST_Force3DZ (#165)

* feat: add ST_Force3DZ

* fix: add snowflake function registration for all arities

* fix: add 3D support for snowflake

* fix: typo

* Update version

---------

Co-authored-by: Furqaan Khan <46216254+furqaankhan@users.noreply.github.com>
Kontinuation pushed a commit to Kontinuation/sedona that referenced this issue Oct 11, 2024
* feat: Add ST_ForceCollection

* fix: snowflake tests

* fix: snowflake tests

* chore: remove print statement

* chore: add GeometryCollection test

* docs: add detailed explanation
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

3 participants