我想安装rJava但它不起作用.当我在控制台中键入R CMD javareconf时,出现以下错误:
trying to compile and link a JNI progam
detected JNI cpp flags :
detected JNI linker flags :
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -O3 -pipe -g
-c conftest.c -o conftest.o
conftest.c:1:17: error: jni.h: No such file or directory
conftest.c: In function 'main':
conftest.c:4: warning: implicit declaration of function 'JNI_CreateJavaVM'
make: *** [conftest.o] Error 1
Unable to compile a JNI program
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib64/R
Done. …Run Code Online (Sandbox Code Playgroud) 我在 pyspark 中遇到一个奇怪的问题,我想定义和使用 UDF。我总是收到此错误:
类型错误:返回类型无效:返回类型应为 DataType 或 str,但为 <'pyspark.sql.types.IntegerType'>
我的代码其实很简单:
from pyspark.sql import SparkSession
from pyspark.sql.types import IntegerType
def square(x):
return 2
def _process():
spark = SparkSession.builder.master("local").appName('process').getOrCreate()
spark_udf = udf(square,IntegerType)
Run Code Online (Sandbox Code Playgroud)
问题可能出在 IntegerType 上,但我不知道出了什么问题。我正在使用Python version 3.5.3和spark version 2.4.1