- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一个简单的脚本来对两个字符串进行评分。请在下面找到 USQL 和后端 .net 代码
CN_Matcher.usql:
REFERENCE ASSEMBLY master.FuzzyString;
@searchlog =
EXTRACT ID int,
Input_CN string,
Output_CN string
FROM "/CN_Matcher/Input/sample.txt"
USING Extractors.Tsv();
@CleansCheck =
SELECT ID,Input_CN, Output_CN, CN_Validator.trial.cleanser(Input_CN) AS Input_CN_Cleansed,
CN_Validator.trial.cleanser(Output_CN) AS Output_CN_Cleansed
FROM @searchlog;
@CheckData= SELECT ID,Input_CN, Output_CN, Input_CN_Cleansed, Output_CN_Cleansed,
CN_Validator.trial.Hamming(Input_CN_Cleansed, Output_CN_Cleansed) AS HammingScore,
CN_Validator.trial.LevinstienDistance(Input_CN_Cleansed, Output_CN_Cleansed) AS LevinstienDistance,
FuzzyString.ComparisonMetrics.JaroWinklerDistance(Input_CN_Cleansed, Output_CN_Cleansed) AS JaroWinklerDistance
FROM @CleansCheck;
OUTPUT @CheckData
TO "/CN_Matcher/CN_Full_Run.txt"
USING Outputters.Tsv();
CN_Matcher.usql.cs:
using Microsoft.Analytics.Interfaces;
using Microsoft.Analytics.Types.Sql;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace CN_Validator
{
public static class trial
{
public static string cleanser(string val)
{
List<string> wordsToRemove = "l.p. registered pc bldg pllc lp. l.c. div. national l p l.l.c international r. limited school azioni joint co-op corporation corp., (corp) inc., societa company llp liability l.l.l.p llc bancorporation manufacturing c dst (inc) jv ltd. llc. technology ltd., s.a. mfg rllp incorporated per venture l.l.p c. p.l.l.c l.p.. p. partnership corp co-operative s.p.a tech schl bancorp association lllp n r ltd inc. l.l.p. p.c. co district int intl assn. sa inc l.p co, co. division lc intl. lp professional corp. a l. l.l.c. building r.l.l.p co.,".Split(' ').ToList();
return string.Join(" ", val.ToLower().Split(' ').Except(wordsToRemove));
}
public static int Hamming(string source, string target)
{
int distance = 0;
if (source.Length == target.Length)
{
for (int i = 0; i < source.Length; i++)
{
if (!source[i].Equals(target[i]))
{
distance++;
}
}
return distance;
}
else { return 99999; }
}
public static int LevinstienDistance(string source, string target)
{
int n = source.Length;
int m = target.Length;
int[,] d = new int[n + 1, m + 1]; // matrix
int cost; // cost
// Step 1
if (n == 0) return m;
if (m == 0) return n;
for (int i = 0; i <= n; d[i, 0] = i++) ;
for (int j = 0; j <= m; d[0, j] = j++) ;
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= m; j++)
{
cost = (target.Substring(j - 1, 1) == source.Substring(i - 1, 1) ? 0 : 1);
d[i, j] = System.Math.Min(System.Math.Min(d[i - 1, j] + 1, d[i, j - 1] + 1),
d[i - 1, j - 1] + cost);
}
}
return d[n, m];
}
}
}
我运行了一个包含 100 个输入的样本批处理,并将并行度设置为 1,将优先级设置为 1000。作业在 1.6 分钟内完成。
我想用 1000 个输入测试同一个作业,并将并行度设置为 1,将优先级设置为 1000,根据我的计算因为 100 个输入需要 1.6 分钟,我认为 1000 个输入需要大约 20 分钟,但是它运行了 50 多分钟,但我没有看到任何进展。
所以我又添加了 100 个输入作业并测试它运行与上次相同。所以我想到增加并行度并将其增加到 3 并再次运行它甚至在 1 小时后仍未完成。
JOB_ID=07c0850d-0770-4430-a288-5cddcfc26699
主要问题是我看不到任何进度或状态。
如果我做错了什么,请告诉我。
在 USQL 中是否可以使用构造函数?因为如果我能够做到这一点,我就不需要一次又一次地执行相同的清洁步骤。
最佳答案
我假设您正在使用文件集语法来指定 1000 个文件?不幸的是,当前文件集的默认实现不能很好地扩展,编译(准备)阶段将花费很长时间(执行也是如此)。我们目前在预览中有更好的实现。能否给我发邮件到 Microsoft dot com 的 usql,我会告诉您如何试用预览版实现。
谢谢迈克尔
关于c# - USQL 执行缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40529157/
我创建了一个简单的脚本来对两个字符串进行评分。请在下面找到 USQL 和后端 .net 代码 CN_Matcher.usql: REFERENCE ASSEMBLY master.FuzzyStrin
我有一个自定义的 USql 应用程序,它扩展了 IApplier 类。 [SqlUserDefinedApplier] public class CsvApplier : IApplier {
我有一个 USQL 作业,它从 Azure Blob 读取 json,并在进行一些数据操作后将单行 JSON 文件写入 ADLS。我编写了一个自定义 Ouputter 来编写 JSON 文件。 这就是
我有 U-SQL 脚本,需要在其中处理一些数据。数据存储在 blob 中,此文件夹结构中每天约有 100 个文件:/{year}/{month}/{day}/{hour}/filenames.tsv
有什么方法可以更新行集中的值 数据: 1,apple,0 2,check,1 3,chec,1 USQL 脚本: @result = EXTRACT ID int, value string, typ
我正在按照此链接 https://blogs.msdn.microsoft.com/azuredatalake/2017/10/24/continuous-integration-made-easy-
有什么方法可以更新行集中的值 数据: 1,apple,0 2,check,1 3,chec,1 USQL 脚本: @result = EXTRACT ID int, value string, typ
我有一个 USQL 脚本和 CSV 提取器来加载我的文件。然而,有些月份文件可能包含 4 列,有些月份可能包含 5 列。 如果我使用包含 4 个或 5 个字段的列列表设置提取器,我会收到有关文件预期宽
我有几个 Azure USQL 脚本,我想在固定时间运行日常作业。我有什么选择? 我想每天执行每个.usql 脚本。我们如何才能实现自动化? 谢谢 最佳答案 很多人建议使用数据工厂。但是,以下内容似乎
我有一个类似 [{}, {}, {}] 的 json,即可以有多行,每行都有许多属性-值对,这些对在每行。 @json = EXTRACT MainId string, Details str
有许多跨单个文件的 USQL 很好的例子。但是,您将如何复制一个非常常见的数据处理示例,在该示例中您想要获取当前系统时间,从该时间中减去 X 天,并根据该结果查询一组数据? SQL 示例: SELEC
对于上下文,我从传感器获取数据并将其存储在像这样的字符串中 "axes" : "...,1,23,21,0,12,10,212,12,..." 大小可能会根据发送数据的机器而改变...所以我的目标是将
有许多跨单个文件的 USQL 很好的例子。但是,您将如何复制一个非常常见的数据处理示例,在该示例中您想要获取当前系统时间,从该时间中减去 X 天,并根据该结果查询一组数据? SQL 示例: SELEC
对于上下文,我从传感器获取数据并将其存储在像这样的字符串中 "axes" : "...,1,23,21,0,12,10,212,12,..." 大小可能会根据发送数据的机器而改变...所以我的目标是将
我正在使用本地 SDK 在本地运行我的作业。但是,我收到以下错误消息: Error : 'System.IO.PathTooLongException: The specified path, fil
Visual Studio:2015 社区版 播放选项是否仅限于 Visual Studio 版本。或者仅在处理位于或输出到 azure 数据湖的源数据的作业时启用它,但不启用使用 usql 本地定位
我们需要使用 Azure 数据工厂和 USQL 处理来自不同文件夹的多个文件。 这是我们的文件夹结构 年-->月-->日 我们为每个日期都有一个文件夹,例如 1,2,3...31。要求是从特定文件夹读
如 this page 中所述, there are several ways how C# code can be used to extend U-SQLexpressions Inline C#
我们有一个调用 API 并获取 json 文件的 Azure 进程。我们将该 json 存储在 Data Lake Store 上。然后,我有一个读取该文件的 USQL 事件,我想将该数据存储在 Az
我正在尝试使用 VS 2017 解析(将带有管道的单列转换为多个字符串列,并将变量类型分配给每个结果列)USQL/Azure 中的管道分隔文件。 该文件已加载到文件夹中,但当我查看它时,它只是一个字符
我是一名优秀的程序员,十分优秀!