コード例 #1
0
        public MapReduceProcessor(ImportEngine engine, XmlNode node) : base(engine, node)
        {
            maxNullIndex = node.ReadInt("@max_null_index", -1);
            fanOut       = node.ReadInt("@fan_out", 100);
            if (fanOut <= 0)
            {
                throw new BMNodeException(node, "Count should be > 0.");
            }

            if (node.ReadInt("write/@maxparallel", 1) > 0)
            {
                bufferSize = node.ReadInt("write/@buffer", 100);
            }
            readMaxParallel = node.ReadInt("read/@maxparallel", 1);

            directory = node.ReadStr("dir/@name", null);
            if (directory != null)
            {
                directory = engine.Xml.CombinePath(directory);
                keepFiles = node.ReadBool("dir/@keepfiles", false);
                compress  = node.ReadBool("dir/@compress", true);
            }
            List <KeyAndType> list = KeyAndType.CreateKeyList(node.SelectMandatoryNode("sorter"), "key", false);

            sorter = JComparer.Create(list);

            XmlNode hashNode = node.SelectSingleNode("hasher");

            if (hashNode == null)
            {
                hasher = sorter;
            }
            else
            {
                hasher = sorter.Clone(hashNode.ReadStr("@from_sort", null));
                if (hasher == null)
                {
                    list   = KeyAndType.CreateKeyList(hashNode, "key", true);
                    hasher = JComparer.Create(list);
                }
            }

            XmlNode undupNode = node.SelectSingleNode("undupper");

            if (undupNode != null)
            {
                undupper = sorter.Clone(undupNode.ReadStr("@from_sort", null));
                if (undupper == null)
                {
                    list     = KeyAndType.CreateKeyList(undupNode, "key", true);
                    undupper = JComparer.Create(list);
                }

                XmlNode actionsNode = undupNode.SelectSingleNode("actions");
                if (actionsNode != null)
                {
                    undupActions = new UndupActions(engine, this, actionsNode);
                }
            }
        }
コード例 #2
0
        public TopProcessor(ImportEngine engine, XmlNode node) : base(engine, node)
        {
            List <KeyAndType> list = KeyAndType.CreateKeyList(node.SelectMandatoryNode("sorter"), "key", true);

            sorter    = JComparer.Create(list);
            topCount  = node.ReadInt("@count");
            reverse   = node.ReadBool("@reverse", false);
            sortAfter = node.ReadEnum("@sortafter", _SortAfter.True);
        }
コード例 #3
0
        private static Comparer1Base Create(KeyAndType keyAndType)
        {
            switch (keyAndType.Type & (CompareType.String | CompareType.Int | CompareType.Long | CompareType.Double | CompareType.Date))
            {
            case CompareType.String: return(new Comparer1Str(keyAndType));

            case CompareType.Int: return(new Comparer1Int(keyAndType));

            case CompareType.Long: return(new Comparer1Long(keyAndType));

            case CompareType.Double: return(new Comparer1Dbl(keyAndType));

            case CompareType.Date: return(new Comparer1Date(keyAndType));

            default: keyAndType.Type.ThrowUnexpected(); return(null);
            }
        }
コード例 #4
0
        public SortProcessor(ImportEngine engine, XmlNode node) : base(engine, node)
        {
            List <KeyAndType> list = KeyAndType.CreateKeyList(node.SelectMandatoryNode("sorter"), "key", false);

            Sorter = JComparer.Create(list);

            //Interpret undupper
            XmlNode undupNode = node.SelectSingleNode("undupper");

            if (undupNode != null)
            {
                Undupper = Sorter.Clone(undupNode.ReadStr("@from_sort", null));
                if (Undupper == null)
                {
                    list     = KeyAndType.CreateKeyList(undupNode, "key", true);
                    Undupper = JComparer.Create(list);
                }

                XmlNode actionsNode = undupNode.SelectSingleNode("actions");
                if (actionsNode != null)
                {
                    undupActions = new UndupActions(engine, this, actionsNode);
                }
            }

            //Interpret sort scripts
            beforeSort = new DelayedScriptHolder(engine, node.SelectSingleNode("beforesort"), Name);
            if (beforeSort.ScriptName == null)
            {
                beforeSort = null;
            }
            afterSort = new DelayedScriptHolder(engine, node.SelectSingleNode("aftersort"), Name);
            if (afterSort.ScriptName == null)
            {
                afterSort = null;
            }
        }
コード例 #5
0
 public Comparer1Date(KeyAndType keyAndType)
     : base(keyAndType)
 {
 }
コード例 #6
0
 public Comparer1Long(KeyAndType keyAndType)
     : base(keyAndType)
 {
 }
コード例 #7
0
 public Comparer1Int(KeyAndType keyAndType)
     : base(keyAndType)
 {
 }
コード例 #8
0
 public Comparer1Str(KeyAndType keyAndType) : base(keyAndType)
 {
     this.comparison     = (keyAndType.Type & CompareType.CaseInsensitive) != 0 ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
     this.stringComparer = (keyAndType.Type & CompareType.CaseInsensitive) != 0 ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
 }
コード例 #9
0
 public Comparer1Base(KeyAndType keyAndType)
 {
     this.path    = keyAndType.Key;
     this.reverse = (keyAndType.Type & CompareType.Descending) != 0;
 }
コード例 #10
0
        public UniqueProcessor(ImportEngine engine, XmlNode node) : base(engine, node)
        {
            List <KeyAndType> list = KeyAndType.CreateKeyList(node.SelectMandatoryNode("undupper"), "key", true);

            undupper = JComparer.Create(list);
        }