Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 |
Tags
- OpenSSL
- CRT
- kerberos
- setdefault
- Python
- Spark
- pyhive
- OOM
- distcp
- airflow
- python2
- executor
- ssh
- install
- hadoop
- webhdfs
- PFX
- OutOfMemory
- kerberosClient
- Keygen
- Linux
- python3
- encoding
- Celery
- unquote
- hive
- supserset
Archives
- Today
- Total
복싱하는_개발자.dev
[ERROR] PickleException: expected zero arguments for construction of ClassDict (for numpy.dtype) 본문
Spark
[ERROR] PickleException: expected zero arguments for construction of ClassDict (for numpy.dtype)
개복자 2022. 3. 28. 15:21삽질을.. 삽질을 했다...
해당 에러가 난 이유는 spark를 쓰면서 UDF 를 만들고 withColumn으로 데이터를 멋지게(?) 만들어 내려고 했는데 뜬금없이 발생.
일단 그 앞에서는
numpy(np) array 값을 dataframe 화 시키기 위해서 작업했던 부분이 있어서 그부분이 문제인 줄 알았지만
사실상 그부분이 아니라 UDF의 return값이 명확하지 않았던 것이 이슈였다..
# 변경 전
def udf_function(arg):
return 100/np.log(2) + arg
udf_name = udf(lambda x: udf_function(x))
df.withColumn('cal', udf_name("column_nm"))
PickleException: expected zero arguments for construction of ClassDict (for numpy.dtype)
... 에러 발생
# 변경 후
def udf_function(arg):
return float(100/np.log(2) + arg)
udf_name = udf(lambda x: udf_function(x))
df.withColumn('cal', udf_name("column_nm"))
udf 의 return값을 정확히 명시해줘야 한다는걸 다시한번 되새겨보자..!
'Spark' 카테고리의 다른 글
| [Spark] spark 작업 시 Java OOM(Out Of Memory) ERROR 처리 (0) | 2022.03.16 |
|---|---|
| [Spark] spark cluster vs client mode (0) | 2022.03.08 |
Comments