簡體   English   中英

SSIS腳本轉換任務即將進行

[英]SSIS script transformation task taking way to long

我有以下腳本轉換組件。

public class ScriptMain : UserComponent
{
    Regex findCOMMAexp, findAmpersandExp, findANDExp;

    public override void PreExecute()
    {
        base.PreExecute();

        //extract and compress publishers.
        findANDExp = new Regex(@"(\w+\s*)+(?=\band\b)",RegexOptions.Compiled);
        findCOMMAexp = new Regex(@"(\w+\s*)+[,]\s*(\w+\s*)",RegexOptions.Compiled);
        findAmpersandExp = new Regex(@"(\w+\s*)+[&]\s*(\w+\s*)",RegexOptions.Compiled);
    }

    public override void PostExecute()
    {
        base.PostExecute();
    }

    public override void Input0_ProcessInputRow(Input0Buffer Row)
    {        
        Row.CompressedPublisher = compressPublisher(Row.F018Publisher);
    }

    public String compressPublisher(String str)
    {

        Match match;

        if (str.Contains("/"))
        {
            return str.Substring(0, str.IndexOf(('/')));
        }
        else if ((match = findANDExp.Match(str)).Success)
        {
            return match.ToString();
        }
        else if ((match = findCOMMAexp.Match(str)).Success)
        {
            return Regex.Replace(str, ",", "");
        }
        else
        {
            return str;
        }
    }
}

3個Regex對象在主類中定義,在PreExecute()初始化,並在由ProcessInputRow調用的方法中使用。 我有一個數據庫源,該源提取單個varchar(45)字符串,定義為F018Publisher。 我嘗試解析9k條目時,在10分鍾后停止了此任務。 怎么了?

謝謝。

我將其包裝到C#命令行應用程序中,並將ABCDEFGHIJKLMOPQRSTUVWXYZ01234567890123456789作為compressPublisher的參數傳遞,並且它從未從此檢查返回, else if ((match = findANDExp.Match(str)).Success)

同樣的評論也發布到Twitter

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM