Exemple #1
0
        /// <summary>
        /// Create a class to discover the information about a partitioned table given its uri.
        /// </summary>
        /// <param name="uri">Partitioned table uri.</param>
        /// <param name="uriType">Type of URI.</param>
        /// <param name="statusReporter">Delegate used to report errors.</param>
        /// <param name="code">Code associated to the stage (the uri does not contain the options, they may still be in the code).</param>
        /// <param name="config">Cluster where the job accessing the stream resides.</param>
        public StaticPartitionedTableInformation(ClusterConfiguration config, string uriType, string uri, string[] code, StatusReporter statusReporter)
        {
            this.Config  = config;
            this.UriType = uriType;
            this.Error   = "";
            this.constructorArguments = new SaveConstructorArguments
            {
                // this is all we need
                code = code
            };

            // really ugly, but the uri in the table does not longer contain the options; they were stripped by the DryadLINQ compiler.
            if (code.Length > 0)
            {
                string firstline = code[0];
                firstline = firstline.Trim('[', ']');
                if (firstline.StartsWith("PartitionedTable:"))
                {
                    firstline = firstline.Substring("PartitionedTable:".Length).Trim();
                }
                if (firstline.StartsWith(uri))
                {
                    uri = firstline; // this may contain the options.
                }
            }

            int indexoptions = uri.IndexOf("?");

            if (indexoptions > 0)
            {
                this.Uri     = uri.Substring(0, indexoptions);
                this.Options = uri.Substring(indexoptions + 1);
            }
            else
            {
                this.Uri     = uri;
                this.Options = "";
            }

            this.Name = Path.GetFileName(this.Uri);

            // default values
            this.PartitionCount = -1;
            this.partitions     = new List <StaticPartitionInformation>();
            this.EstimatedSize  = -1;
            this.Header         = Path.GetFileName(this.Uri);

            switch (uriType)
            {
            case "PartitionedFile":
                this.ParsePartitionedFile(statusReporter);
                break;
            }
        }
Exemple #2
0
        /// <summary>
        /// Empty information about a partitioned table.
        /// </summary>
        private StaticPartitionedTableInformation()
        {
            this.constructorArguments = null;
            this.Config  = null;
            this.UriType = "";
            this.Error   = "";
            this.Name    = "";
            this.Header  = "";

            this.PartitionCount = -1;
            this.partitions     = new List <StaticPartitionInformation>();
            this.EstimatedSize  = -1;
        }
Exemple #3
0
        /// <summary>
        /// Create a class to discover the information about a partitioned table given its uri.
        /// </summary>
        /// <param name="uri">Partitioned table uri.</param>
        /// <param name="uriType">Type of URI.</param>
        /// <param name="statusReporter">Delegate used to report errors.</param>
        /// <param name="code">Code associated to the stage (the uri does not contain the options, they may still be in the code).</param>
        /// <param name="config">Cluster where the job accessing the stream resides.</param>
        public StaticPartitionedTableInformation(ClusterConfiguration config, string uriType, string uri, string[] code, StatusReporter statusReporter)
        {
            this.Config = config;
            this.UriType = uriType;
            this.Error = "";
            this.constructorArguments = new SaveConstructorArguments
            {
                // this is all we need
                code = code
            };

            // really ugly, but the uri in the table does not longer contain the options; they were stripped by the DryadLINQ compiler.
            if (code.Length > 0)
            {
                string firstline = code[0];
                firstline = firstline.Trim('[', ']');
                if (firstline.StartsWith("PartitionedTable:"))
                    firstline = firstline.Substring("PartitionedTable:".Length).Trim();
                if (firstline.StartsWith(uri))
                    uri = firstline; // this may contain the options.
            }

            int indexoptions = uri.IndexOf("?");
            if (indexoptions > 0)
            {
                this.Uri = uri.Substring(0, indexoptions);
                this.Options = uri.Substring(indexoptions + 1);
            }
            else
            {
                this.Uri = uri;
                this.Options = "";
            }

            this.Name = Path.GetFileName(this.Uri);

            // default values
            this.PartitionCount = -1;
            this.partitions = new List<StaticPartitionInformation>();
            this.EstimatedSize = -1;
            this.Header = Path.GetFileName(this.Uri);

            switch (uriType)
            {
                case "PartitionedFile":
                    this.ParsePartitionedFile(statusReporter);
                    break;
            }
        }
Exemple #4
0
        /// <summary>
        /// Empty information about a partitioned table.
        /// </summary>
        private StaticPartitionedTableInformation()
        {
            this.constructorArguments = null;
            this.Config = null;
            this.UriType = "";
            this.Error = "";
            this.Name = "";
            this.Header = "";

            this.PartitionCount = -1;
            this.partitions = new List<StaticPartitionInformation>();
            this.EstimatedSize = -1;
        }