You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Data Factory DSL编译失败:意外逗号错误排查求助

Azure Data Factory Flowlet DSL解析错误:意外逗号排查与解决

问题场景

触发某Flowlet的「数据预览」时,Spark作业失败,提示DSL编译错误:第2行第47位存在意外逗号,但直接查看该Flowlet的DSL脚本和JSON定义,未发现对应位置有多余逗号,且该Flowlet已通过ADF的验证环节。

错误信息

Spark job failed: { "text/plain":
"{"runId":"REDACTED","sessionId":"REDACTED","status":"Failed","payload":{"statusCode":400,"shortMessage":"com.microsoft.dataflow.broker.InvalidOperationException:
DSL compilation failed: DF-DSL-001 - DSL stream has parsing
errors\nLine 2 Position 47: extraneous input ',' expecting ...

相关代码片段

Flowlet DSL脚本

source(useSchema: false,
    allowSchemaDrift: true,
    validateSchema: false,
    ignoreNoFilesFound: false,
    format: 'delimited',
    container: 'newmessagingtemp',
    folderPath: 'testinputs',
    fileName: 'conversation_top_3.csv',
    columnDelimiter: ',',
    escapeChar: '\\',
    quoteChar: '\"',
    columnNamesAsHeader: true) ~> conversationsTop3
conversationsTop3 output() ~> conversationsTop3Output

Flowlet JSON定义

{
    "name": "conversations_csv",
    "properties": {
        "description": "Use a CSV file in place of the source SQL Table for Conversations ",
        "folder": {
            "name": "Tests (can be deleted)"
        },
        "type": "Flowlet",
        "typeProperties": {
            "sources": [
                {
                    "linkedService": {
                        "referenceName": "AzureBlobStorage1",
                        "type": "LinkedServiceReference"
                    },
                    "name": "conversationsTop3",
                    "description": ""
                }
            ],
            "sinks": [],
            "transformations": [
                {
                    "name": "conversationsTop3Output"
                }
            ],
            "scriptLines": [
                "source(useSchema: false,",
                "     allowSchemaDrift: true,",
                "     validateSchema: false,",
                "     ignoreNoFilesFound: false,",
                "     format: 'delimited',",
                "     container: 'newmessagingtemp',",
                "     folderPath: 'testinputs',",
                "     fileName: 'conversation_top_3.csv',",
                "     columnDelimiter: ',',",
                "     escapeChar: '\\\\',",
                "     quoteChar: '\\\"',",
                "     columnNamesAsHeader: true) ~> conversationsTop3",
                "conversationsTop3 output() ~> conversationsTop3Output"
            ]
        }
    }
}

CSV文件说明

CSV为标准格式,包含表头和数据行,无明显格式异常。

排查方向

  1. 转义字符解析偏差:ADF的DSL对转义字符的处理与JSON定义存在映射差异,escapeChar和quoteChar的转义写法可能在编译时被错误解析为多余字符。
  2. 隐藏不可见字符:脚本中可能存在复制粘贴带来的全角空格、零宽空格等不可见字符,导致编译时误判为逗号。
  3. ADF UI格式缓存:ADF保存Flowlet时,UI生成的脚本与实际编译使用的脚本存在格式不一致(如换行、缩进导致的位置偏移),错误提示的行号并非对应你看到的脚本行。

解决办法

  1. 重新手动输入转义字符:删除DSL脚本中escapeChar: '\\'和quoteChar: '\"'这两行,手动重新输入(不要复制粘贴),确保转义符正确。
  2. 清除隐藏字符:将DSL脚本复制到纯文本编辑器(如Notepad++),开启「显示所有字符」功能,检查并删除不可见的多余字符,再粘贴回ADF。
  3. 重建Flowlet:删除现有Flowlet,重新创建一个配置完全相同的Flowlet,避免UI保存时的格式残留问题。
  4. 校验脚本格式:确保DSL脚本中所有参数的逗号均为半角逗号,且参数值的引号配对正确,无多余引号或转义符。

内容的提问来源于stack exchange,提问作者jeancallisti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 07:45:03