private void Initialize(VertexCodeGen vertexCodeGen)
        {
            this.m_codeGen = new DryadLinqCodeGen(this.m_context, vertexCodeGen);
            this.m_queryPlan1 = null;
            this.m_queryPlan2 = null;
            this.m_queryPlan3 = null;
            this.m_DryadLinqProgram = null;
            this.m_queryPlan1 = null;
            this.m_exprNodeInfoMap = new Dictionary<Expression, QueryNodeInfo>();
            this.m_referencedQueryMap = new Dictionary<Expression, QueryNodeInfo>();
            this.m_inputUriMap = new Dictionary<string, DLinqInputNode>();
            this.m_outputUriMap = new Dictionary<string, DLinqOutputNode>();
            this.m_queryExecutor = new DryadLinqJobExecutor(this.m_context);

            // Initialize the data structures for the output tables
            this.m_outputTypes = new Type[this.m_queryExprs.Length];
            this.m_queryNodeInfos = new QueryNodeInfo[this.m_queryExprs.Length];
            
            for (int i = 0; i < this.m_queryExprs.Length; i++)
            {
                this.m_queryNodeInfos[i] = this.BuildNodeInfoGraph(this.m_queryExprs[i]);
                this.m_queryNodeInfos[i] = new DummyQueryNodeInfo(this.m_queryExprs[i], false, this.m_queryNodeInfos[i]);

                if (!DataPath.IsValidDataPath(this.m_outputTableUris[i]))
                {
                    throw new DryadLinqException(DryadLinqErrorCode.UnrecognizedDataSource,
                                                 String.Format(SR.UnrecognizedDataSource,
                                                               this.m_outputTableUris[i].AbsoluteUri));
                }
            }
        }
Example #2
0
        /// <summary>
        /// Gets the <see cref="DryadLinqFactory{T}"/> for a specified type. If a factory doesn't exist,
        /// the method generates the serialization code and creates a new factory for the type.
        /// </summary>
        /// <param name="context">An instnance of <see cref="DryadLinqContext"/></param>
        /// <param name="type">A specified type</param>
        /// <returns>A <see cref="DryadLinqFactory{T}"/> for the type</returns>
        public static object GetFactory(DryadLinqContext context, Type type)
        {
            lock (s_codeGenLock)
            {
                if (s_TypeToFactory.ContainsKey(type))
                {
                    return s_TypeToFactory[type];
                }
                
                DryadLinqCodeGen codeGen = new DryadLinqCodeGen(context, new VertexCodeGen(context));
                codeGen.AddDryadCodeForType(type);
                
                // build assembly, and load into memory, because we'll next instantiate
                // the factory type out of the generated assembly.
                codeGen.BuildAssembly(true);

                string factoryTypeFullName = TargetNamespace + "." + DryadLinqFactoryClassName(type);
                object factory = codeGen.m_loadedVertexAssembly.CreateInstance(factoryTypeFullName);
                s_TypeToFactory.Add(type, factory);
                return factory;
            }
        }
Example #3
0
 internal Pipeline(CodeMemberMethod vertexMethod, DryadLinqCodeGen codeGen, string[] writerNames)
 {
     this.m_vertexMethod = vertexMethod;
     this.m_codeGen = codeGen;
     this.m_readerNames = null;
     this.m_writerNames = writerNames;
     this.m_nodes = new List<DLinqQueryNode>();
 }