Exemplo n.º 1
0
        /// <summary>
        /// Reads the data sets from the given <see cref="IInputEndpoint"/> and under the
        /// specified <see cref="SparkSession"/>.
        /// </summary>
        /// <param name="sparkSession">The <see cref="SparkSession"/> which creates the <see cref="DataFrame"/>.</param>
        /// <param name="inputEndpoint">The <see cref="IInputEndpoint"/> instance which provides the information
        /// of the input data sets.</param>
        /// <param name="projectContext">The data that contains project and revision information.</param>
        /// <returns>The <see cref="DataFrame"/> for data processing.</returns>
        public DataFrame ReadFrom(SparkSession sparkSession, IInputEndpoint inputEndpoint, ProjectContext projectContext)
        {
            if (sparkSession == null)
            {
                throw new ArgumentNullException(nameof(sparkSession));
            }

            if (inputEndpoint == null)
            {
                throw new ArgumentNullException(nameof(inputEndpoint));
            }

            if (projectContext == null)
            {
                throw new ArgumentNullException(nameof(projectContext));
            }

            if (inputEndpoint is TEndpoint endPoint)
            {
                return(ReadFromInternal(sparkSession, endPoint, projectContext));
            }

            throw new InputReaderException($"Input endpoint {inputEndpoint.GetType().FullName} can't be converted to type {typeof(TEndpoint).FullName}");
        }