Example #1
0
        /// <summary>
        /// Open a DSC fileset as a LINQ-to-HPC IQueryable{T}.
        /// </summary>
        /// <typeparam name="T">The type of the records in the table.</typeparam>
        /// <param name="dscFileSetName">The name of the DSC fileset. </param>
        /// <returns>An IQueryable{T} representing the data and associated with the HPC LINQ query provider.</returns>
        public IQueryable <T> FromDsc <T>(string fileSetName)
        {
            ThrowIfDisposed();

            string fullPath = DataPath.MakeDscStreamUri(_dscService, fileSetName);

            try {
                DscFileSet fs = _dscService.GetFileSet(fileSetName);
                if (!fs.IsSealed())
                {
                    throw new DryadLinqException(HpcLinqErrorCode.FileSetMustBeSealed,
                                                 SR.FileSetMustBeSealed);
                }

                int fileCount = fs.GetFiles().Count();
                if (fileCount < 1)
                {
                    throw new DryadLinqException(HpcLinqErrorCode.FileSetMustHaveAtLeastOneFile,
                                                 SR.FileSetMustHaveAtLeastOneFile);
                }
            }
            catch (DscException dscEx) {
                throw new DryadLinqException(HpcLinqErrorCode.FileSetCouldNotBeOpened,
                                             SR.FileSetCouldNotBeOpened, dscEx);
            }

            DryadLinqQuery <T> q = DataProvider.GetPartitionedTable <T>(this, fullPath);

            q.CheckAndInitialize(); // force the data-info checks.
            return(q);
        }
Example #2
0
        public IEnumerator <T> GetEnumerator()
        {
            List <string[]>      filePathList; // a list of dsc files, each of which is represented by an array holding the replica paths
            DscCompressionScheme compressionScheme;

            try
            {
                DscFileSet fileSet = m_context.DscService.GetFileSet(m_fileSetName);
                filePathList = fileSet.GetFiles().Select(file => file.ReadPaths).ToList();
                DryadLinqMetaData metaData = DryadLinqMetaData.FromDscStream(m_context, m_fileSetName);
                compressionScheme = metaData.CompressionScheme;
            }
            catch (Exception e)
            {
                throw new DryadLinqException(HpcLinqErrorCode.FailedToGetReadPathsForStream,
                                             String.Format(SR.FailedToGetReadPathsForStream, this.m_fileSetName), e);
            }

            return(new TableEnumerator(m_context, filePathList, m_fileSetName, compressionScheme));
        }