Пример #1
0
        private static void ProcessSuccessor(AstEtlFragmentReferenceNode fragmentReference, AstEtlFragmentNode clonedFragment, GraphNode<AstTransformationNode> etlSinkNode, AstSingleInTransformationNode successor)
        {
            if (successor.InputPath == null)
            {
                successor.InputPath = new AstDataflowMappedInputPathNode(successor);
                successor.InputPath.OutputPath = etlSinkNode.Item.PreferredOutputPath;
            }

            // TODO:
            ////successor.InputPath.OutputPath = etlSinkNode.Item.OutputPath;

            foreach (var outputMapping in fragmentReference.Outputs)
            {
                var currentMapping = new AstDataflowColumnMappingNode(successor.InputPath)
                                         {
                                             SourceName = outputMapping.SourcePathColumnName,
                                             TargetName = outputMapping.DestinationPathColumnName
                                         };
                successor.InputPath.Mappings.Add(currentMapping);
            }

            foreach (var inputMapping in fragmentReference.Inputs)
            {
                var currentMapping = new AstDataflowColumnMappingNode(successor.InputPath)
                                         {
                                             SourceName = inputMapping.DestinationPathColumnName,
                                             TargetName = inputMapping.SourcePathColumnName
                                         };
                successor.InputPath.Mappings.Add(currentMapping);
            }

            foreach (var ignore in clonedFragment.Ignores)
            {
                var currentMapping = new AstDataflowColumnMappingNode(successor.InputPath)
                                         {
                                             SourceName = ignore.PathColumnName
                                         };
                successor.InputPath.Mappings.Add(currentMapping);
            }
        }
Пример #2
0
        public static void ValidateEtlFragment(AstEtlFragmentNode etlFragment)
        {
            var graph = new TransformationGraph(etlFragment.Transformations);

            AstTransformationNode root = null;
            foreach (var rootNode in graph.RootNodes)
            {
                if (!(rootNode.Item is AstSourceTransformationNode))
                {
                    if (root != null)
                    {
                        MessageEngine.Trace(etlFragment, Severity.Error, "V0120", "Etl Fragments cannot have more than one root node with InputPaths");
                    }

                    root = rootNode.Item;
                }
            }

            AstTransformationNode leaf = null;
            foreach (var leafNode in graph.LeafNodes)
            {
                if (!(leafNode.Item is AstDestinationNode))
                {
                    if (leaf != null)
                    {
                        MessageEngine.Trace(etlFragment, Severity.Error, "V0121", "Etl Fragments cannot have more than one leaf node with OutputPaths");
                    }

                    leaf = leafNode.Item;
                }
            }
        }