gpt4 book ai didi

c# - USQL - 自定义输出器找不到 NewtonSoft

转载 作者:行者123 更新时间:2023-12-03 04:20:31 24 4
gpt4 key购买 nike

我有一个 USQL 作业,它从 Azure Blob 读取 json,并在进行一些数据操作后将单行 JSON 文件写入 ADLS。我编写了一个自定义 Ouputter 来编写 JSON 文件。

这就是我的 CustomOutputter 文件的样子:

    using Microsoft.Analytics.Interfaces;
using Microsoft.Analytics.Types.Sql;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Newtonsoft.Json;
namespace demo{

[SqlUserDefinedOutputter(AtomicFileProcessing = true)]
public class JSONOutputter : IOutputter
{
//Actual Code Here
public static class Factory
{
public static JSONOutputter JSONOutputter(bool isHeader = true, Encoding encoding = null)
{
return new JSONOutputter(isHeader, encoding);
}
}
}

我在我的 USQL 作业中使用这个 Ouputter,如下所示:

    OUTPUT @final_output
TO "/output/json/final.json"
USING demo.Factory.JSONOutputter(isHeader: true);

当我使用

编译 USQL 脚本时
ADL: Compile Script

我收到此错误:

    [Info] Start compiling code behind: /users/kumar.pratik/documents/usql/second.usql.cs ...
[Error] Command failed: mono /Users/kumar.pratik/.vscode/extensions/usqlextpublisher.usql-vscode-ext-0.2.11/compilehost/compilehost.exe /users/kumar.pratik/documents/usql/second.usql.cs /Users/kumar.pratik/Documents/usql/usqlCodeBehindReference /Users/kumar.pratik/Documents/usql/second.usql.dll __codeBehind__tRYGlFBeSWcl

[Error] Compile failed

error: "The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)" at line: 8, column 6
error: "The type or namespace name 'JsonTextWriter' could not be found (are you missing a using directive or an assembly reference?)" at line: 17, column 12
error: "The type or namespace name 'JsonTextWriter' could not be found (are you missing a using directive or an assembly reference?)" at line: 44, column 34

有人可以告诉我如何解决这个问题吗?

我正在 Mac OS 上使用 Visual Studio Code

谢谢

最佳答案

您能分享一下您的脚本是什么样子吗?特别是,你是

  1. 将 Visual Studio 的代码隐藏用于您的输出器代码?
  2. 如果问题 1 的答案是否定的:您是否使用 CREATE ASSEMBLY 或通过 Visual Studio Assembly 注册功能在 U-SQL 目录中注册了 Outputter 和 Newtonsoft 库?您是否在脚本中使用 REFERENCE ASSEMBLY 引用了 U-SQL 程序集(包括您自己的代码和 Newtonsoft)?

更多详细信息:https://blogs.msdn.microsoft.com/azuredatalake/2016/08/26/how-to-register-u-sql-assemblies-in-your-u-sql-catalog/

关于c# - USQL - 自定义输出器找不到 NewtonSoft,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49571845/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com