Tag Archives: Sparksql error

[Solved] sparkSQL Error: WARN TaskMemoryManager: Failed to allocate a page (bytes), try again.

Background

Recently, when running sparksql, I frequently print logs and report errors in the middle of execution:

WARN TaskMemoryManager: Failed to allocate a page (104876 bytes), try again.
WARN TaskMemoryManager: Failed to allocate a page (104876 bytes), try again.

reason

There is not enough memory to perform tasks, and resources need to be recycled frequently

Solution:

1. Optimize SQL scripts. (preferred, that’s how I solved it at that time)
2. Increase driver memory, — driver memory 6g

My SQL at that time was simplified as follows:

select name 
from stu
where id in (select id from in_stu);

Stu data volume is 800W, in_stu data volume is 1.2kW

Optimized as:

select name 
from stu
where id in (select distinct id from in_stu);

after optimization, The data volume of In_stu ID is reduced to 11 W, and the problem is solved.

[Solved] Sparksql error: Exception in thread “main” org.apache.spark.sql.catalyst.errors.package$TreeNodeException

Exception in thread “main” org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
Exchange hashpartitioning(subject#6, 200)
+- *HashAggregate(keys=[subject#6, name#7], functions=[count(1)], output=[subject#6, name#7, c#12L])
+- Exchange hashpartitioning(subject#6, name#7, 200)
+- *HashAggregate(keys=[subject#6, name#7], functions=[partial_count(1)], output=[subject#6, name#7, count#43L])
+- *Project [_1#3 AS subject#6, _2#4 AS name#7]
+- *SerializeFromObject [staticinvoke(class org.apache.spark.unsafe.types.UTF8String, StringType, fromString, assertnotnull(input[0, scala.Tuple2, true])._1, true) AS _1#3, staticinvoke(class org.apache.spark.unsafe.types.UTF8String, StringType, fromString, assertnotnull(input[0, scala.Tuple2, true])._2, true) AS _2#4]
+- Scan ExternalRDDScan[obj#2]Caused by: org.apache.spark.sql.catalyst.errors.package$TreeNodeException: execute, tree:
Caused by: org.apache.hadoop.mapred.InvalidInputException: Input path does not exist: hdfs://leetom:8020/user/root/file/dataSource/teacher.txt



Modify: