简体   繁体   English

您能否在 AWS Glue 中使用 PySpark 而不是 Glue PySpark?

[英]Can you use PySpark instead of Glue PySpark in AWS Glue?

I find Glue PySpark has it's own little twist to everything like is 'select' is 'select_fields' in Glue PySpark.我发现 Glue PySpark 对所有内容都有自己的小改动,例如 Glue PySpark 中的“select”是“select_fields”。 How can I use spark instead of the Glue version?如何使用 spark 而不是 Glue 版本?

You can just use the SparkSession directly instead of the GlueContext wrapper:您可以直接使用SparkSession而不是GlueContext包装器:

from pyspark.context import SparkContext
from awsglue.context import GlueContext

sc = SparkContext()
gc = GlueContext(sc.getOrCreate())
spark = gc.spark_session

df = spark.read.format(...).load(...)

df.select("*").show()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM