예제 #1
0
        public void TestSignaturesV2_3_X()
        {
            Assert.IsType <SparkContext>(_spark.SparkContext);

            Assert.IsType <Builder>(SparkSession.Builder());

            SparkSession.ClearDefaultSession();
            SparkSession.SetDefaultSession(_spark);
            Assert.IsType <SparkSession>(SparkSession.GetDefaultSession());

            Assert.IsType <RuntimeConfig>(_spark.Conf());

            Assert.IsType <StreamingQueryManager>(_spark.Streams());

            Assert.IsType <SparkSession>(_spark.NewSession());

            Assert.IsType <DataFrameReader>(_spark.Read());

            Assert.IsType <DataFrame>(_spark.Range(10));
            Assert.IsType <DataFrame>(_spark.Range(10, 100));
            Assert.IsType <DataFrame>(_spark.Range(10, 100, 10));
            Assert.IsType <DataFrame>(_spark.Range(10, 100, 10, 5));

            _spark.Range(10).CreateOrReplaceTempView("testView");
            Assert.IsType <DataFrame>(_spark.Table("testView"));

            Assert.IsType <DataStreamReader>(_spark.ReadStream());

            Assert.IsType <UdfRegistration>(_spark.Udf());

            Assert.IsType <Catalog>(_spark.Catalog);
        }
        public void TestSignaturesV2_3_X()
        {
            var            intMemoryStream = new MemoryStream <int>(_spark);
            StreamingQuery sq1             = intMemoryStream
                                             .ToDF().WriteStream().QueryName("intQuery").Format("console").Start();
            string id1 = sq1.Id;

            var            stringMemoryStream = new MemoryStream <string>(_spark);
            StreamingQuery sq2 = stringMemoryStream
                                 .ToDF().WriteStream().QueryName("stringQuery").Format("console").Start();
            string id2 = sq2.Id;

            StreamingQueryManager sqm = _spark.Streams();

            StreamingQuery[] streamingQueries = sqm.Active().ToArray();
            Assert.Equal(2, streamingQueries.Length);

            Assert.IsType <StreamingQuery>(sqm.Get(id1));
            Assert.IsType <StreamingQuery>(sqm.Get(id2));

            sqm.ResetTerminated();

            sqm.AwaitAnyTermination(10);

            sq1.Stop();
            sq2.Stop();
        }