我已使用"Jetty Base and Jetty Home"机制从我的配置中拆分了Jetty安装。
通过引用新的Jetty主目录,可以很容易地将Jetty 9.4.3升级到9.4.6。
在我的Jetty基本目录中,我激活了cdi module
,它已在{$jetty.base}/lib/cdi
下载了各种lib文件。
尽管Jetty 9.4.6在其模块描述中引用了新版本的焊接框架,但我的Jetty基本目录中的那些库并未自动更新。更新这些库的推荐方法是什么?
停用模块,删除库并重新激活它感觉有点奇怪......
答案 0 :(得分:3)
将from pyspark.sql import SparkSession
from pyspark.sql.types import StructType, StringType, FloatType, TimestampType
sparkSession = SparkSession.builder \
.master("local") \
.appName("SparkSession") \
.getOrCreate()
dfStruct = StructType().add("date", TimestampType(), False)
dfStruct.add("open", FloatType(), False)
dfStruct.add("high", FloatType(), False)
dfStruct.add("low", FloatType(), False)
dfStruct.add("close", FloatType(), False)
dfStruct.add("ticker", StringType(), False)
#print elements of StructType -- reports nullable is false
for d in dfStruct: print d
#data looks like this:
#date,open,high,low,close,ticker
# 2014-10-14 23:20:32,7.14,9.07,0.0,7.11,ARAY
# 2014-10-14 23:20:36,9.74,10.72,6.38,9.25,ARC
# 2014-10-14 23:20:38,31.38,37.0,28.0,30.94,ARCB
# 2014-10-14 23:20:44,15.39,17.37,15.35,15.3,ARCC
# 2014-10-14 23:20:49,5.59,6.5,5.31,5.48,ARCO
#read csv file and apply dfStruct as the schema
df = sparkSession.read.csv(path = "/<path tofile>/stock_data.csv", \
schema = dfStruct, \
sep = ",", \
ignoreLeadingWhiteSpace = True, \
ignoreTrailingWhiteSpace = True \
)
#reports nullable as True!
df.printSchema()
添加到--create-files
命令行一次。
如果模块被正确定义(有时它不是。如果是,那就是一个bug),只引用所需的特定jar文件,而不是旧文件。