Parse_Syntax_Error Help
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 01:16 AM - edited 02-28-2024 01:19 AM
i'm getting this error: Exception in thread "main" org.apache.spark.sql.catalyst.parser.ParseException: [PARSE_SYNTAX_ERROR] Syntax error at or near ','.(line 1, pos 18) == SQL == sum(mp4) AS Videos, sum(csv+xlsx) AS Sheets, sum(docx+txt+pdf) AS Documents, sum(zip+html+pptx) AS Others, sum(gif+jgp+png) AS Images ------------------^^^
for my code in scala:
// Define field mappings and aggregations
val fieldMappings = Map(
"Documents" -> Seq("docx", "txt", "pdf"),
"Sheets" -> Seq("csv", "xlsx"),
"Images" -> Seq("gif", "jgp", "png"),
"Videos" -> Seq("mp4"),
"Others" -> Seq("zip", "html", "pptx")
)
// // Define aggregation pipeline
val aggregatedDF = inputDF.groupBy("u_id").agg(
expr(
fieldMappings.map { case (category, fields) =>
sum(fields.mkString("+")).alias(category)
}.mkString(", ")
)
)
0 REPLIES 0

