该问题通常是由于在AWS Glue作业中使用的数据源未被正确识别,因此需要确保所使用的数据源被正确识别。一个可能的解决方法是使用正确的数据源类型和相应的依赖项。下面是一个Python代码示例,可以用于指定正确的数据源类型:
from awsglue.context import GlueContext from pyspark.context import SparkContext from pyspark.sql.functions import * from awsglue.transforms import * from awsglue.dynamicframe import *
sc = SparkContext.getOrCreate() glueContext = GlueContext(sc) spark = glueContext.spark_session
dynamic_frame = glueContext.create_dynamic_frame.from_options( connection_type="s3", connection_options={ "path": "s3://bucket/path/to/file", "format": "json" }, format="json" )
dynamic_frame.write.format('parquet').save('s3://output-bucket/output-dir',
connection_options={"region": "us-west-2"})