2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ using System ;
5
6
using Microsoft . Spark . Sql ;
6
7
using Microsoft . Spark . Sql . Expressions ;
7
8
using Xunit ;
@@ -23,26 +24,36 @@ public void TestSignaturesV2_3_X()
23
24
Column col2 = Column ( "name" ) ;
24
25
WindowSpec windowSpec = PartitionBy ( "age" ) ;
25
26
26
- windowSpec = windowSpec . PartitionBy ( "age" ) ;
27
- windowSpec = windowSpec . PartitionBy ( "age" , "name" ) ;
28
- windowSpec = windowSpec . PartitionBy ( ) ;
29
- windowSpec = windowSpec . PartitionBy ( col1 ) ;
30
- windowSpec = windowSpec . PartitionBy ( col1 , col2 ) ;
27
+ Assert . IsType < WindowSpec > ( windowSpec . PartitionBy ( "age" ) ) ;
28
+ Assert . IsType < WindowSpec > ( windowSpec . PartitionBy ( "age" , "name" ) ) ;
29
+ Assert . IsType < WindowSpec > ( windowSpec . PartitionBy ( ) ) ;
30
+ Assert . IsType < WindowSpec > ( windowSpec . PartitionBy ( col1 ) ) ;
31
+ Assert . IsType < WindowSpec > ( windowSpec . PartitionBy ( col1 , col2 ) ) ;
31
32
32
- windowSpec = windowSpec . OrderBy ( "age" ) ;
33
- windowSpec = windowSpec . OrderBy ( "age" , "name" ) ;
34
- windowSpec = windowSpec . OrderBy ( ) ;
35
- windowSpec = windowSpec . OrderBy ( col1 ) ;
36
- windowSpec = windowSpec . OrderBy ( col1 , col2 ) ;
33
+ Assert . IsType < WindowSpec > ( windowSpec . OrderBy ( "age" ) ) ;
34
+ Assert . IsType < WindowSpec > ( windowSpec . OrderBy ( "age" , "name" ) ) ;
35
+ Assert . IsType < WindowSpec > ( windowSpec . OrderBy ( ) ) ;
36
+ Assert . IsType < WindowSpec > ( windowSpec . OrderBy ( col1 ) ) ;
37
+ Assert . IsType < WindowSpec > ( windowSpec . OrderBy ( col1 , col2 ) ) ;
37
38
38
- windowSpec = windowSpec . RowsBetween (
39
- Sql . Expressions . Window . UnboundedPreceding ,
40
- Sql . Expressions . Window . UnboundedFollowing ) ;
39
+ Assert . IsType < WindowSpec > (
40
+ windowSpec . RowsBetween (
41
+ Sql . Expressions . Window . UnboundedPreceding ,
42
+ Sql . Expressions . Window . UnboundedFollowing ) ) ;
41
43
42
- windowSpec = windowSpec . RangeBetween (
43
- Sql . Expressions . Window . UnboundedPreceding ,
44
- Sql . Expressions . Window . UnboundedFollowing ) ;
45
- windowSpec = windowSpec . RangeBetween ( UnboundedPreceding ( ) , UnboundedFollowing ( ) ) ;
44
+ Assert . IsType < WindowSpec > (
45
+ windowSpec . RangeBetween (
46
+ Sql . Expressions . Window . UnboundedPreceding ,
47
+ Sql . Expressions . Window . UnboundedFollowing ) ) ;
48
+
49
+ if ( SparkSettings . Version < new Version ( Versions . V3_0_0 ) )
50
+ {
51
+ // The following APIs are removed in Spark 3.0.
52
+ Assert . IsType < WindowSpec > (
53
+ windowSpec . RangeBetween (
54
+ UnboundedPreceding ( ) ,
55
+ UnboundedFollowing ( ) ) ) ;
56
+ }
46
57
}
47
58
}
48
59
}
0 commit comments