diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.Driver).sql new file mode 100644 index 000000000000..a49fee41abe2 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.Driver).sql @@ -0,0 +1,34 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(CASE + WHEN t.IntValue > 20 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t.DoubleValue > toFloat64(15) THEN t.DoubleValue + ELSE NULL + END) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(CASE + WHEN t.IntValue < 80 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.Driver).sql new file mode 100644 index 000000000000..7e47587fd5f4 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.Driver).sql @@ -0,0 +1,11 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.Driver).sql new file mode 100644 index 000000000000..f23808840e41 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..f23808840e41 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.Driver).sql new file mode 100644 index 000000000000..8b5829075fdb --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + AVG(CASE + WHEN t.CategoryId = 1 THEN t.DoubleValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.Driver).sql new file mode 100644 index 000000000000..5deb660c3c79 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..b4d5506aeb84 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,7 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.Driver).sql new file mode 100644 index 000000000000..4d3b09a3c51a --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.Driver).sql new file mode 100644 index 000000000000..be45e7439cf9 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.Driver).sql @@ -0,0 +1,15 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.Driver).sql new file mode 100644 index 000000000000..44f1719f472d --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.Driver).sql new file mode 100644 index 000000000000..45dafce536a4 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..3b87a73e3d07 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.Driver).sql new file mode 100644 index 000000000000..5935f69de17f --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.Driver).sql @@ -0,0 +1,35 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.Driver).sql new file mode 100644 index 000000000000..0f81309acaa8 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (ORDER BY x.Timestamp), + DENSE_RANK() OVER (ORDER BY x.Value), + DENSE_RANK() OVER (ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (ORDER BY x.Value DESC), + DENSE_RANK() OVER (ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.Driver).sql new file mode 100644 index 000000000000..a31194b3f72b --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..a31194b3f72b --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.Driver).sql new file mode 100644 index 000000000000..e7e676747588 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.Driver).sql new file mode 100644 index 000000000000..11605c2f0c2e --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.Driver).sql new file mode 100644 index 000000000000..47c3fe776cad --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.Driver).sql new file mode 100644 index 000000000000..6a7eed676112 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.Driver).sql @@ -0,0 +1,12 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.Driver).sql new file mode 100644 index 000000000000..68c63a07b3b2 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAG(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.Driver).sql new file mode 100644 index 000000000000..139c2518a571 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAG(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.Driver).sql new file mode 100644 index 000000000000..1710eff78aa3 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAG(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.Driver).sql new file mode 100644 index 000000000000..cc33cf47a43e --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.Driver).sql new file mode 100644 index 000000000000..c61f4178cae6 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..c61f4178cae6 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.Driver).sql new file mode 100644 index 000000000000..7c3e13ac42a1 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.Driver).sql new file mode 100644 index 000000000000..4e39f04c9366 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.Driver).sql @@ -0,0 +1,12 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.Driver).sql new file mode 100644 index 000000000000..50e072a32078 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + LEAD(t.DoubleValue) OVER (ORDER BY t.Id), + LAG(t.DecimalValue) OVER (ORDER BY t.Id), + LEAD(t.NullableIntValue) OVER (ORDER BY t.Id), + LEAD(t.IntValue) OVER (ORDER BY t.CategoryId, t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.Driver).sql new file mode 100644 index 000000000000..1142e143e0e7 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..9e8016e7b14b --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.Driver).sql new file mode 100644 index 000000000000..7733b1d102a8 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.Driver).sql new file mode 100644 index 000000000000..784563209fcf --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.Driver).sql new file mode 100644 index 000000000000..9e8016e7b14b --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.Driver).sql new file mode 100644 index 000000000000..b7b63c412d24 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..b7b63c412d24 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.Driver).sql new file mode 100644 index 000000000000..f674eb89d920 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..f674eb89d920 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.Driver).sql new file mode 100644 index 000000000000..7e39cf5970e0 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.Driver).sql @@ -0,0 +1,14 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + DENSE_RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.Driver).sql new file mode 100644 index 000000000000..8781a293be4f --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..aae25dce66c5 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.Driver).sql new file mode 100644 index 000000000000..aae25dce66c5 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.Driver).sql @@ -0,0 +1,8 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.Driver).sql new file mode 100644 index 000000000000..633ec497c1b0 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.Driver).sql @@ -0,0 +1,9 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.Driver).sql new file mode 100644 index 000000000000..84a8557145b8 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..38bc5ceb1e99 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.Driver).sql new file mode 100644 index 000000000000..28d9ebba558b --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.Driver).sql @@ -0,0 +1,35 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.Driver).sql new file mode 100644 index 000000000000..56ea78857d39 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (ORDER BY x.Timestamp), + RANK() OVER (ORDER BY x.Value), + RANK() OVER (ORDER BY x.Timestamp DESC), + RANK() OVER (ORDER BY x.Value DESC), + RANK() OVER (ORDER BY x.Timestamp, x.Value), + RANK() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.Driver).sql new file mode 100644 index 000000000000..2628a0c1764d --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..0c7b29085bd0 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.Driver).sql new file mode 100644 index 000000000000..aa1f37d3406a --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.Driver).sql @@ -0,0 +1,35 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.Driver).sql new file mode 100644 index 000000000000..e889e5c3b918 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.Driver).sql @@ -0,0 +1,33 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (ORDER BY x.Timestamp), + ROW_NUMBER() OVER (ORDER BY x.Value), + ROW_NUMBER() OVER (ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (ORDER BY x.Value DESC), + ROW_NUMBER() OVER (ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.Driver).sql new file mode 100644 index 000000000000..572c8543190a --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.Driver).sql @@ -0,0 +1,15 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.Driver).sql new file mode 100644 index 000000000000..030136865c60 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableShortValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.ByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.Driver).sql new file mode 100644 index 000000000000..030136865c60 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.Driver).sql @@ -0,0 +1,20 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableShortValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.ByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.Driver).sql new file mode 100644 index 000000000000..5aed97a39864 --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.Driver).sql b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.Driver).sql new file mode 100644 index 000000000000..d0f3cb96b98c --- /dev/null +++ b/ClickHouse.Driver/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.Driver).sql @@ -0,0 +1,10 @@ +-- ClickHouse.Driver ClickHouse + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.MySql).sql new file mode 100644 index 000000000000..83074b1b8c26 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(ClickHouse.MySql).sql @@ -0,0 +1,34 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(CASE + WHEN t.IntValue > 20 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t.DoubleValue > toFloat64(15) THEN t.DoubleValue + ELSE NULL + END) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(CASE + WHEN t.IntValue < 80 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.MySql).sql new file mode 100644 index 000000000000..5e9055063190 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(ClickHouse.MySql).sql @@ -0,0 +1,11 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.MySql).sql new file mode 100644 index 000000000000..179ec233d712 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..179ec233d712 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.MySql).sql new file mode 100644 index 000000000000..27f049b66177 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + AVG(CASE + WHEN t.CategoryId = 1 THEN t.DoubleValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.MySql).sql new file mode 100644 index 000000000000..b12c1a10da6e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..5ef8afcba32a --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,7 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.MySql).sql new file mode 100644 index 000000000000..5965317a6427 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.MySql).sql new file mode 100644 index 000000000000..b5f6924999d2 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(ClickHouse.MySql).sql @@ -0,0 +1,15 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.MySql).sql new file mode 100644 index 000000000000..5fbfb64d4646 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.MySql).sql new file mode 100644 index 000000000000..e6ab6e199198 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..f6a8e7ca83c9 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.MySql).sql new file mode 100644 index 000000000000..b0c5a58c2e2e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(ClickHouse.MySql).sql @@ -0,0 +1,35 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.MySql).sql new file mode 100644 index 000000000000..b16e63507fd9 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (ORDER BY x.Timestamp), + DENSE_RANK() OVER (ORDER BY x.Value), + DENSE_RANK() OVER (ORDER BY x.Timestamp DESC), + DENSE_RANK() OVER (ORDER BY x.Value DESC), + DENSE_RANK() OVER (ORDER BY x.Timestamp, x.Value), + DENSE_RANK() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.MySql).sql new file mode 100644 index 000000000000..1b7c71687050 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..1b7c71687050 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.MySql).sql new file mode 100644 index 000000000000..7fc2811648a7 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.MySql).sql new file mode 100644 index 000000000000..454e79ef5cd9 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.MySql).sql new file mode 100644 index 000000000000..69dd6551b55e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.MySql).sql new file mode 100644 index 000000000000..cfc1c7fb09c5 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(ClickHouse.MySql).sql @@ -0,0 +1,12 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.MySql).sql new file mode 100644 index 000000000000..6ec743ddd79c --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAG(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.MySql).sql new file mode 100644 index 000000000000..e685d004a5db --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAG(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.MySql).sql new file mode 100644 index 000000000000..fea7ed98baf1 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAG(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.MySql).sql new file mode 100644 index 000000000000..6cdbbcbc1d6a --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.MySql).sql new file mode 100644 index 000000000000..407c611dbae2 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..407c611dbae2 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.MySql).sql new file mode 100644 index 000000000000..47ba069d9831 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.MySql).sql new file mode 100644 index 000000000000..898ba3caf32e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(ClickHouse.MySql).sql @@ -0,0 +1,12 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.MySql).sql new file mode 100644 index 000000000000..c8872cdef4b3 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + LEAD(t.DoubleValue) OVER (ORDER BY t.Id), + LAG(t.DecimalValue) OVER (ORDER BY t.Id), + LEAD(t.NullableIntValue) OVER (ORDER BY t.Id), + LEAD(t.IntValue) OVER (ORDER BY t.CategoryId, t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.MySql).sql new file mode 100644 index 000000000000..4958efa3c4b6 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..be1567a8a33c --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.MySql).sql new file mode 100644 index 000000000000..bcabbfbfe115 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.MySql).sql new file mode 100644 index 000000000000..10fad7278e48 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.MySql).sql new file mode 100644 index 000000000000..be1567a8a33c --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.MySql).sql new file mode 100644 index 000000000000..e7675034720e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..e7675034720e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.MySql).sql new file mode 100644 index 000000000000..11b7fa75efb2 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..11b7fa75efb2 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.MySql).sql new file mode 100644 index 000000000000..480414aa99a3 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(ClickHouse.MySql).sql @@ -0,0 +1,14 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + DENSE_RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.MySql).sql new file mode 100644 index 000000000000..82393e092500 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..88255811979f --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.MySql).sql new file mode 100644 index 000000000000..88255811979f --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(ClickHouse.MySql).sql @@ -0,0 +1,8 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + t.Id, + NTH_VALUE(t.IntValue, toInt64(2)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.MySql).sql new file mode 100644 index 000000000000..fc30f6c2d69c --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(ClickHouse.MySql).sql @@ -0,0 +1,9 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.MySql).sql new file mode 100644 index 000000000000..51683c5d9d74 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..8580f90319ed --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.MySql).sql new file mode 100644 index 000000000000..2f80118dd5d6 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(ClickHouse.MySql).sql @@ -0,0 +1,35 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.MySql).sql new file mode 100644 index 000000000000..15b7756a5ae5 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (ORDER BY x.Timestamp), + RANK() OVER (ORDER BY x.Value), + RANK() OVER (ORDER BY x.Timestamp DESC), + RANK() OVER (ORDER BY x.Value DESC), + RANK() OVER (ORDER BY x.Timestamp, x.Value), + RANK() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.MySql).sql new file mode 100644 index 000000000000..d12b952d546e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..d496098fddee --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Value DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.MySql).sql new file mode 100644 index 000000000000..fa6350c33a0d --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(ClickHouse.MySql).sql @@ -0,0 +1,35 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 0 + ELSE 1 + END, x.Timestamp), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x.Timestamp IS NULL THEN 1 + ELSE 0 + END, x.Timestamp DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.MySql).sql new file mode 100644 index 000000000000..59f4bb062610 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(ClickHouse.MySql).sql @@ -0,0 +1,33 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + x.Id, + x.Name, + x.CategoryId, + x.Value, + x.Timestamp, + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (ORDER BY x.Timestamp), + ROW_NUMBER() OVER (ORDER BY x.Value), + ROW_NUMBER() OVER (ORDER BY x.Timestamp DESC), + ROW_NUMBER() OVER (ORDER BY x.Value DESC), + ROW_NUMBER() OVER (ORDER BY x.Timestamp, x.Value), + ROW_NUMBER() OVER (ORDER BY x.Timestamp DESC, x.Value DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.MySql).sql new file mode 100644 index 000000000000..cf3ff541401e --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(ClickHouse.MySql).sql @@ -0,0 +1,15 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.MySql).sql new file mode 100644 index 000000000000..aa8572cb63aa --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableShortValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.ByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.MySql).sql new file mode 100644 index 000000000000..aa8572cb63aa --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(ClickHouse.MySql).sql @@ -0,0 +1,20 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableShortValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.ByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(toInt32(t.NullableByteValue)) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.MySql).sql new file mode 100644 index 000000000000..c03903d8fad9 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.MySql).sql b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.MySql).sql new file mode 100644 index 000000000000..289312e65466 --- /dev/null +++ b/ClickHouse.MySql/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(ClickHouse.MySql).sql @@ -0,0 +1,10 @@ +-- ClickHouse.MySql ClickHouse + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(DB2).sql new file mode 100644 index 000000000000..3e74a9f18138 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(DB2).sql @@ -0,0 +1,34 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CASE + WHEN "t"."IntValue" > 20 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN "t"."DoubleValue" > 15 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX(CASE + WHEN "t"."IntValue" < 80 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(DB2).sql new file mode 100644 index 000000000000..3d4c5eaca0d8 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(DB2).sql @@ -0,0 +1,11 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(DB2).sql new file mode 100644 index 000000000000..bbf4fd93eaa3 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(DB2).sql new file mode 100644 index 000000000000..bbf4fd93eaa3 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(DB2).sql new file mode 100644 index 000000000000..e4bca71f5d3a --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + AVG(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(DB2).sql new file mode 100644 index 000000000000..34fb90cb2dca --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(DB2).sql @@ -0,0 +1,7 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + COUNT("t"."NullableIntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(DB2).sql new file mode 100644 index 000000000000..427dcfa9fbe1 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(DB2).sql new file mode 100644 index 000000000000..75bdbbfe5623 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(DB2).sql @@ -0,0 +1,7 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + COUNT("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..4726908e0868 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(DB2).sql @@ -0,0 +1,7 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(DB2).sql new file mode 100644 index 000000000000..a430fe4fcf10 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..e7140433b471 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..733781a718a9 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(DB2).sql new file mode 100644 index 000000000000..14d7162e9896 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(DB2).sql new file mode 100644 index 000000000000..35cca00e1289 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (ORDER BY "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(DB2).sql new file mode 100644 index 000000000000..5e80d07412af --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(DB2).sql @@ -0,0 +1,15 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(DB2).sql new file mode 100644 index 000000000000..092c8dd5bc13 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..f74fcbb34a96 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..e265d9dbbd09 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(DB2).sql new file mode 100644 index 000000000000..f54a058bb7fd --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(DB2).sql new file mode 100644 index 000000000000..807a5f0d13eb --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (ORDER BY "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(DB2).sql new file mode 100644 index 000000000000..0ce6fada6516 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..0ce6fada6516 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(DB2).sql new file mode 100644 index 000000000000..ebf52efa106c --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(DB2).sql new file mode 100644 index 000000000000..ab59ff7c1a12 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(DB2).sql new file mode 100644 index 000000000000..52b6d741d06d --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(DB2).sql new file mode 100644 index 000000000000..4d646c5acce8 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(DB2).sql @@ -0,0 +1,12 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(DB2).sql new file mode 100644 index 000000000000..c127554ce61a --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(DB2).sql new file mode 100644 index 000000000000..664d41f1df6b --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAG("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(DB2).sql new file mode 100644 index 000000000000..948735bc4d96 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAG("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(DB2).sql new file mode 100644 index 000000000000..b30a1c84c98f --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(DB2).sql new file mode 100644 index 000000000000..d3cd731edf05 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..d3cd731edf05 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(DB2).sql new file mode 100644 index 000000000000..3bab65eda054 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(DB2).sql new file mode 100644 index 000000000000..dcfc246857dc --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(DB2).sql @@ -0,0 +1,12 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(DB2).sql new file mode 100644 index 000000000000..104d455cae55 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + LEAD("t"."DoubleValue") OVER (ORDER BY "t"."Id"), + LAG("t"."DecimalValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."NullableIntValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (ORDER BY "t"."CategoryId", "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(DB2).sql new file mode 100644 index 000000000000..ec514c857974 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..03eb215a7dfa --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(DB2).sql new file mode 100644 index 000000000000..6cfa1548f2a5 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(DB2).sql new file mode 100644 index 000000000000..12f3b0b7eb11 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(DB2).sql new file mode 100644 index 000000000000..03eb215a7dfa --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(DB2).sql new file mode 100644 index 000000000000..3a6cf0571865 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(DB2).sql new file mode 100644 index 000000000000..3a6cf0571865 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(DB2).sql new file mode 100644 index 000000000000..2dc0d35372de --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(DB2).sql new file mode 100644 index 000000000000..2dc0d35372de --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(DB2).sql new file mode 100644 index 000000000000..aa13d2093e27 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(DB2).sql @@ -0,0 +1,14 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + DENSE_RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..0aecbc5a1070 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..e69554ca3791 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(DB2).sql new file mode 100644 index 000000000000..592b3d6195f4 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(DB2).sql new file mode 100644 index 000000000000..57f347d76a73 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (ORDER BY "x"."Timestamp"), + NTILE(4) OVER (ORDER BY "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (ORDER BY "x"."Value" DESC), + NTILE(4) OVER (ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(DB2).sql new file mode 100644 index 000000000000..abdc68c51de2 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..3c7677f379ab --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(DB2).sql new file mode 100644 index 000000000000..3c7677f379ab --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(DB2).sql @@ -0,0 +1,8 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..dacb5ab36fa5 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..85005657ab92 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(DB2).sql new file mode 100644 index 000000000000..79f8ca0f0d8a --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(DB2).sql new file mode 100644 index 000000000000..1917e77d74f5 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (ORDER BY "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(DB2).sql new file mode 100644 index 000000000000..22a51d0ccf76 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(DB2).sql @@ -0,0 +1,9 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..b6e7931bfdcb --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..51f6d6bfc522 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(DB2).sql new file mode 100644 index 000000000000..b4c15b7ce915 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(DB2).sql new file mode 100644 index 000000000000..97033d17c09e --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (ORDER BY "x"."Timestamp"), + RANK() OVER (ORDER BY "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC), + RANK() OVER (ORDER BY "x"."Value" DESC), + RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(DB2).sql new file mode 100644 index 000000000000..f0ee8eb4f288 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(DB2).sql new file mode 100644 index 000000000000..b71237a0cd4f --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(DB2).sql new file mode 100644 index 000000000000..19affe23f364 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(DB2).sql @@ -0,0 +1,35 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(DB2).sql new file mode 100644 index 000000000000..42b4dbd1fd89 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(DB2).sql @@ -0,0 +1,33 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (ORDER BY "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(DB2).sql new file mode 100644 index 000000000000..c4307d53aa75 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(DB2).sql @@ -0,0 +1,15 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(DB2).sql new file mode 100644 index 000000000000..3cd14f80704b --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(DB2).sql new file mode 100644 index 000000000000..3cd14f80704b --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(DB2).sql @@ -0,0 +1,20 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(DB2).sql new file mode 100644 index 000000000000..6d9a52e27424 --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(DB2).sql b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(DB2).sql new file mode 100644 index 000000000000..cd559d0d0d8d --- /dev/null +++ b/DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(DB2).sql @@ -0,0 +1,10 @@ +-- DB2 DB2.LUW DB2LUW + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.3).sql new file mode 100644 index 000000000000..9d7b7e0116a7 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.3).sql new file mode 100644 index 000000000000..9d7b7e0116a7 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.3).sql new file mode 100644 index 000000000000..383431d692d5 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.3).sql @@ -0,0 +1,10 @@ +-- Firebird.3 Firebird3 + +SELECT + AVG(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.3).sql new file mode 100644 index 000000000000..83a2f98e7032 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..5e6d1183eb99 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.3).sql @@ -0,0 +1,7 @@ +-- Firebird.3 Firebird3 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.3).sql new file mode 100644 index 000000000000..c8368829910d --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.3).sql @@ -0,0 +1,10 @@ +-- Firebird.3 Firebird3 + +SELECT + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.3).sql new file mode 100644 index 000000000000..742ac31655cb --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.3).sql @@ -0,0 +1,15 @@ +-- Firebird.3 Firebird3 + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.3).sql new file mode 100644 index 000000000000..68b53d21e778 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..55e1e4d537c8 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.3).sql new file mode 100644 index 000000000000..a730ad603253 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.3).sql @@ -0,0 +1,29 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.3).sql new file mode 100644 index 000000000000..c8d798fa2d74 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (ORDER BY "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.3).sql new file mode 100644 index 000000000000..ee08d1ffc8d6 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..ee08d1ffc8d6 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.3).sql new file mode 100644 index 000000000000..c5b5bd48245e --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.3).sql new file mode 100644 index 000000000000..5bf6d61cae01 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.3).sql new file mode 100644 index 000000000000..1a0712113a68 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.3).sql new file mode 100644 index 000000000000..1b68a7dea00e --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.3).sql new file mode 100644 index 000000000000..79394c635638 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.3).sql @@ -0,0 +1,12 @@ +-- Firebird.3 Firebird3 + +SELECT + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.3).sql new file mode 100644 index 000000000000..a4e9839085b2 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.3).sql @@ -0,0 +1,10 @@ +-- Firebird.3 Firebird3 + +SELECT + LEAD("t"."DoubleValue") OVER (ORDER BY "t"."Id"), + LAG("t"."DecimalValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."NullableIntValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (ORDER BY "t"."CategoryId", "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.3).sql new file mode 100644 index 000000000000..237ca85fa2c9 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..6a835678a5fb --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.3).sql new file mode 100644 index 000000000000..600ebc7cd5a0 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.3).sql new file mode 100644 index 000000000000..0406f22d6736 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.3).sql new file mode 100644 index 000000000000..6a835678a5fb --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.3).sql @@ -0,0 +1,8 @@ +-- Firebird.3 Firebird3 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.3).sql new file mode 100644 index 000000000000..37e5ba993baf --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.3).sql new file mode 100644 index 000000000000..37e5ba993baf --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.3).sql new file mode 100644 index 000000000000..dce5f298f911 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.3).sql new file mode 100644 index 000000000000..dce5f298f911 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.3).sql new file mode 100644 index 000000000000..aff401f9504f --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..5c38ae2de415 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.3).sql new file mode 100644 index 000000000000..0a7338a598db --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.3).sql @@ -0,0 +1,29 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.3).sql new file mode 100644 index 000000000000..012d36cd2284 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (ORDER BY "x"."Timestamp"), + RANK() OVER (ORDER BY "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC), + RANK() OVER (ORDER BY "x"."Value" DESC), + RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.3).sql new file mode 100644 index 000000000000..f13b9576d459 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.3).sql new file mode 100644 index 000000000000..2b33cdbdf343 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.3).sql new file mode 100644 index 000000000000..0a009f1c6ae6 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.3).sql @@ -0,0 +1,29 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.3).sql new file mode 100644 index 000000000000..b7f9cb40efa6 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.3).sql @@ -0,0 +1,33 @@ +-- Firebird.3 Firebird3 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (ORDER BY "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.3).sql new file mode 100644 index 000000000000..2d9ad6574633 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.3).sql new file mode 100644 index 000000000000..2d9ad6574633 --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.3).sql @@ -0,0 +1,20 @@ +-- Firebird.3 Firebird3 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.3).sql b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.3).sql new file mode 100644 index 000000000000..d92108c8405f --- /dev/null +++ b/Firebird.3/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.3).sql @@ -0,0 +1,10 @@ +-- Firebird.3 Firebird3 + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.4).sql new file mode 100644 index 000000000000..0a4f53e871a2 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.4).sql @@ -0,0 +1,34 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CASE + WHEN "t"."IntValue" > 20 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN "t"."DoubleValue" > 15 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX(CASE + WHEN "t"."IntValue" < 80 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.4).sql new file mode 100644 index 000000000000..3a55071bc989 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.4).sql @@ -0,0 +1,11 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.4).sql new file mode 100644 index 000000000000..378ffa44a25c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.4).sql new file mode 100644 index 000000000000..378ffa44a25c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.4).sql new file mode 100644 index 000000000000..7acaf3ffe85d --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + AVG(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.4).sql new file mode 100644 index 000000000000..611e98d5d115 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.4).sql @@ -0,0 +1,7 @@ +-- Firebird.4 Firebird4 + +SELECT + COUNT("t"."NullableIntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.4).sql new file mode 100644 index 000000000000..3dcfd9315279 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.4).sql new file mode 100644 index 000000000000..c3c9f0232562 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.4).sql @@ -0,0 +1,7 @@ +-- Firebird.4 Firebird4 + +SELECT + COUNT("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..297466a7d963 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.4).sql @@ -0,0 +1,7 @@ +-- Firebird.4 Firebird4 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.4).sql new file mode 100644 index 000000000000..dcb193514ef7 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.4).sql new file mode 100644 index 000000000000..8633c53ad72a --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.4).sql @@ -0,0 +1,15 @@ +-- Firebird.4 Firebird4 + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.4).sql new file mode 100644 index 000000000000..e567c8034478 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.4).sql new file mode 100644 index 000000000000..162677f13b07 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..f86c29405f78 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.4).sql new file mode 100644 index 000000000000..067ccd7bc87e --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.4).sql @@ -0,0 +1,29 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.4).sql new file mode 100644 index 000000000000..7014cba9551f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (ORDER BY "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.4).sql new file mode 100644 index 000000000000..86204fa80904 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..86204fa80904 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.4).sql new file mode 100644 index 000000000000..0b174a3e63a0 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.4).sql new file mode 100644 index 000000000000..a555bb9c8db6 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.4).sql new file mode 100644 index 000000000000..c4ad96dd9bf5 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.4).sql new file mode 100644 index 000000000000..6f3cc8b9c244 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.4).sql @@ -0,0 +1,12 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.4).sql new file mode 100644 index 000000000000..024fb9c8c745 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.4).sql new file mode 100644 index 000000000000..22b75c6a434f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.4).sql new file mode 100644 index 000000000000..af15c218c3ad --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.4).sql new file mode 100644 index 000000000000..0f06a5bfe5a9 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.4).sql new file mode 100644 index 000000000000..cd0d2d2f8eb6 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..cd0d2d2f8eb6 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.4).sql new file mode 100644 index 000000000000..593217d1ee3e --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.4).sql new file mode 100644 index 000000000000..7c7d9030a8a8 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.4).sql @@ -0,0 +1,12 @@ +-- Firebird.4 Firebird4 + +SELECT + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.4).sql new file mode 100644 index 000000000000..9ac9e37bb35a --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + LEAD("t"."DoubleValue") OVER (ORDER BY "t"."Id"), + LAG("t"."DecimalValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."NullableIntValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (ORDER BY "t"."CategoryId", "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.4).sql new file mode 100644 index 000000000000..d833b55aec58 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..3a6ccab12975 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.4).sql new file mode 100644 index 000000000000..e487030f84d1 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.4).sql new file mode 100644 index 000000000000..920b49380f4a --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.4).sql new file mode 100644 index 000000000000..3a6ccab12975 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.4).sql @@ -0,0 +1,8 @@ +-- Firebird.4 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.4).sql new file mode 100644 index 000000000000..ba5a8a8f3e7c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.4).sql new file mode 100644 index 000000000000..ba5a8a8f3e7c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.4).sql new file mode 100644 index 000000000000..0a99ba9b998f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.4).sql new file mode 100644 index 000000000000..0a99ba9b998f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.4).sql new file mode 100644 index 000000000000..42c5ff9cdbb4 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.4).sql @@ -0,0 +1,14 @@ +-- Firebird.4 Firebird4 + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + DENSE_RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.4).sql new file mode 100644 index 000000000000..ce0e48e86ea2 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.4).sql @@ -0,0 +1,9 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.4).sql new file mode 100644 index 000000000000..a0a1ae0033c1 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..c4b950115cef --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.4).sql new file mode 100644 index 000000000000..837b794565aa --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.4).sql @@ -0,0 +1,29 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.4).sql new file mode 100644 index 000000000000..35f5c94a1b59 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (ORDER BY "x"."Timestamp"), + RANK() OVER (ORDER BY "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC), + RANK() OVER (ORDER BY "x"."Value" DESC), + RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.4).sql new file mode 100644 index 000000000000..dbcb2824ae1c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.4).sql new file mode 100644 index 000000000000..fd49226c1732 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.4).sql new file mode 100644 index 000000000000..e28122e238c1 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.4).sql @@ -0,0 +1,29 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.4).sql new file mode 100644 index 000000000000..f23e70418b2f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.4).sql @@ -0,0 +1,33 @@ +-- Firebird.4 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (ORDER BY "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.4).sql new file mode 100644 index 000000000000..0cb27e0d0d20 --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.4).sql @@ -0,0 +1,15 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.4).sql new file mode 100644 index 000000000000..ea18fdc3148f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.4).sql new file mode 100644 index 000000000000..ea18fdc3148f --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.4).sql @@ -0,0 +1,20 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.4).sql new file mode 100644 index 000000000000..6e33359a7c1c --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.4).sql b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.4).sql new file mode 100644 index 000000000000..1c46472f5e6a --- /dev/null +++ b/Firebird.4/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.4).sql @@ -0,0 +1,10 @@ +-- Firebird.4 Firebird4 + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.5).sql new file mode 100644 index 000000000000..8fc6a56a431d --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Firebird.5).sql @@ -0,0 +1,34 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CASE + WHEN "t"."IntValue" > 20 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN "t"."DoubleValue" > 15 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN "t"."IntValue" > 10 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX(CASE + WHEN "t"."IntValue" < 80 THEN "t"."IntValue" + ELSE NULL + END) OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.5).sql new file mode 100644 index 000000000000..a7dba80556e3 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Firebird.5).sql @@ -0,0 +1,11 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.5).sql new file mode 100644 index 000000000000..d8d8a3f6f9f6 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.5).sql new file mode 100644 index 000000000000..d8d8a3f6f9f6 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.5).sql new file mode 100644 index 000000000000..daaf6fa59ba7 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + AVG(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.5).sql new file mode 100644 index 000000000000..37053991a00d --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Firebird.5).sql @@ -0,0 +1,7 @@ +-- Firebird.5 Firebird4 + +SELECT + COUNT("t"."NullableIntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.5).sql new file mode 100644 index 000000000000..c8210dcb5018 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.5).sql new file mode 100644 index 000000000000..e9c453103b83 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Firebird.5).sql @@ -0,0 +1,7 @@ +-- Firebird.5 Firebird4 + +SELECT + COUNT("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..63909a6ac85c --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Firebird.5).sql @@ -0,0 +1,7 @@ +-- Firebird.5 Firebird4 + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.5).sql new file mode 100644 index 000000000000..e54dcba707eb --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..f64f67f929ea --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..3763eb2a7248 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..7a856b7f5d5f --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..aeed2bda247c --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (ORDER BY "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.5).sql new file mode 100644 index 000000000000..994222e4b61c --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Firebird.5).sql @@ -0,0 +1,15 @@ +-- Firebird.5 Firebird4 + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.5).sql new file mode 100644 index 000000000000..70b9ee24f0e0 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..fedb8159e9c3 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..47ced6459b59 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..d4426924b5ff --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..3608e6c7018d --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (ORDER BY "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.5).sql new file mode 100644 index 000000000000..b0b8eafcdb16 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..b0b8eafcdb16 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.5).sql new file mode 100644 index 000000000000..70b72d239bcb --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.5).sql new file mode 100644 index 000000000000..6687371b431b --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.5).sql new file mode 100644 index 000000000000..1cc67f9cc93c --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.5).sql new file mode 100644 index 000000000000..048833f6eb54 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Firebird.5).sql @@ -0,0 +1,12 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.5).sql new file mode 100644 index 000000000000..e2f49e8912a4 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.5).sql new file mode 100644 index 000000000000..62c2f7ef6bdf --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.5).sql new file mode 100644 index 000000000000..26dde7e9409c --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.5).sql new file mode 100644 index 000000000000..834e0d946283 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.5).sql new file mode 100644 index 000000000000..7368ea6afe81 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..7368ea6afe81 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.5).sql new file mode 100644 index 000000000000..ec8b2852707a --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.5).sql new file mode 100644 index 000000000000..b68c64554fc3 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Firebird.5).sql @@ -0,0 +1,12 @@ +-- Firebird.5 Firebird4 + +SELECT + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.5).sql new file mode 100644 index 000000000000..3450a6ad27c4 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + LEAD("t"."DoubleValue") OVER (ORDER BY "t"."Id"), + LAG("t"."DecimalValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."NullableIntValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (ORDER BY "t"."CategoryId", "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.5).sql new file mode 100644 index 000000000000..c54275f331a9 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..39b90ece0884 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.5).sql new file mode 100644 index 000000000000..5e61e9721c5d --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.5).sql new file mode 100644 index 000000000000..74722b5485d2 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.5).sql new file mode 100644 index 000000000000..39b90ece0884 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.5).sql new file mode 100644 index 000000000000..e4dcab0dbe39 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.5).sql new file mode 100644 index 000000000000..e4dcab0dbe39 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.5).sql new file mode 100644 index 000000000000..51b18ad640f1 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.5).sql new file mode 100644 index 000000000000..51b18ad640f1 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.5).sql new file mode 100644 index 000000000000..cce8362d441f --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Firebird.5).sql @@ -0,0 +1,14 @@ +-- Firebird.5 Firebird4 + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + DENSE_RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."IntValue"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 1, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..5d3e8e9d05fb --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..cb322fc15db9 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..32f0354c0637 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..4bedb24eaa96 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (ORDER BY "x"."Timestamp"), + NTILE(4) OVER (ORDER BY "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (ORDER BY "x"."Value" DESC), + NTILE(4) OVER (ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Firebird.5).sql new file mode 100644 index 000000000000..49afe31cfa97 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..ae538e6364e8 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Firebird.5).sql new file mode 100644 index 000000000000..ae538e6364e8 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Firebird.5).sql @@ -0,0 +1,8 @@ +-- Firebird.5 Firebird4 + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..27dbe6934d20 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..8fc9ab7be378 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..e99fa258d703 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..cb078cac227f --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (ORDER BY "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.5).sql new file mode 100644 index 000000000000..0ff5d690287d --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Firebird.5).sql @@ -0,0 +1,9 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..6ec0323b6cf4 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..a8ef737299c3 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..a766bcf7c79a --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..30bfe195a5bc --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (ORDER BY "x"."Timestamp"), + RANK() OVER (ORDER BY "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC), + RANK() OVER (ORDER BY "x"."Value" DESC), + RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.5).sql new file mode 100644 index 000000000000..be1d00fa0538 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.5).sql new file mode 100644 index 000000000000..2e46330977cf --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.5).sql new file mode 100644 index 000000000000..0938e30788ae --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Firebird.5).sql @@ -0,0 +1,29 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.5).sql new file mode 100644 index 000000000000..4a61ae98be87 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Firebird.5).sql @@ -0,0 +1,33 @@ +-- Firebird.5 Firebird4 + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (ORDER BY "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.5).sql new file mode 100644 index 000000000000..80e5c3e59a85 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Firebird.5).sql @@ -0,0 +1,15 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM("t"."IntValue") OVER (ORDER BY "t"."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.5).sql new file mode 100644 index 000000000000..8e540510157a --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.5).sql new file mode 100644 index 000000000000..8e540510157a --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Firebird.5).sql @@ -0,0 +1,20 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Int)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.5).sql new file mode 100644 index 000000000000..575babf6f032 --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.5).sql b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.5).sql new file mode 100644 index 000000000000..8116f646b92a --- /dev/null +++ b/Firebird.5/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Firebird.5).sql @@ -0,0 +1,10 @@ +-- Firebird.5 Firebird4 + +SELECT + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" "t" + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Informix.DB2).sql new file mode 100644 index 000000000000..6930b273b61c --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Informix.DB2).sql @@ -0,0 +1,34 @@ +-- Informix.DB2 Informix + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(CASE + WHEN t.IntValue > 20 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t.DoubleValue > 15 THEN t.DoubleValue + ELSE NULL + END) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t.IntValue > 10 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(CASE + WHEN t.IntValue < 80 THEN t.IntValue + ELSE NULL + END) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Informix.DB2).sql new file mode 100644 index 000000000000..d6fff6eb587d --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Informix.DB2).sql @@ -0,0 +1,11 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Informix.DB2).sql new file mode 100644 index 000000000000..277ad4bd5e61 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Informix.DB2).sql new file mode 100644 index 000000000000..277ad4bd5e61 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + AVG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Informix.DB2).sql new file mode 100644 index 000000000000..d50acedbb72e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + AVG(CASE + WHEN t.CategoryId = 1 THEN t.DoubleValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Informix.DB2).sql new file mode 100644 index 000000000000..bbe211d0ae37 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Informix.DB2).sql @@ -0,0 +1,7 @@ +-- Informix.DB2 Informix + +SELECT + COUNT(t.NullableIntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Informix.DB2).sql new file mode 100644 index 000000000000..9ef67285e656 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Informix.DB2).sql new file mode 100644 index 000000000000..83c937dc6205 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Informix.DB2).sql @@ -0,0 +1,7 @@ +-- Informix.DB2 Informix + +SELECT + COUNT(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..2289515f30cc --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,7 @@ +-- Informix.DB2 Informix + +SELECT + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Informix.DB2).sql new file mode 100644 index 000000000000..9daf7875ddf2 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + COUNT(CASE + WHEN t.IntValue > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..5f20c5ebc54b --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..5fe97fae45a4 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + CUME_DIST() OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..107f28893cc3 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + CUME_DIST() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..71de4d3d2cf4 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Informix.DB2).sql new file mode 100644 index 000000000000..0bf57f866c8b --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Informix.DB2).sql @@ -0,0 +1,15 @@ +-- Informix.DB2 Informix + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + AVG(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + COUNT(*) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Informix.DB2).sql new file mode 100644 index 000000000000..3aa05ccf7488 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..35e69128a5fd --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..567514c84726 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..6798c4dbaee5 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..cb0dc45ff988 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Informix.DB2).sql new file mode 100644 index 000000000000..16949a3f8f3e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..16949a3f8f3e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Informix.DB2).sql new file mode 100644 index 000000000000..e25a40557bce --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Informix.DB2).sql new file mode 100644 index 000000000000..e64a5fe6dc0a --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Informix.DB2).sql new file mode 100644 index 000000000000..1fd6c2e5c9d7 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Informix.DB2).sql new file mode 100644 index 000000000000..e2c9341014c5 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Informix.DB2).sql @@ -0,0 +1,12 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Informix.DB2).sql new file mode 100644 index 000000000000..1aa49e517ea8 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAG(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Informix.DB2).sql new file mode 100644 index 000000000000..7b46fd5ad7b1 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAG(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Informix.DB2).sql new file mode 100644 index 000000000000..b49d0f2abd4e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAG(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Informix.DB2).sql new file mode 100644 index 000000000000..ae8dea920068 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Informix.DB2).sql new file mode 100644 index 000000000000..fa42689a6b30 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..fa42689a6b30 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Informix.DB2).sql new file mode 100644 index 000000000000..a50fa1280d73 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Informix.DB2).sql new file mode 100644 index 000000000000..f7e59e9494f2 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Informix.DB2).sql @@ -0,0 +1,12 @@ +-- Informix.DB2 Informix + +SELECT + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LEAD(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 2, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Informix.DB2).sql new file mode 100644 index 000000000000..6ca56871b46c --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + LEAD(t.DoubleValue) OVER (ORDER BY t.Id), + LAG(t.DecimalValue) OVER (ORDER BY t.Id), + LEAD(t.NullableIntValue) OVER (ORDER BY t.Id), + LEAD(t.IntValue) OVER (ORDER BY t.CategoryId, t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Informix.DB2).sql new file mode 100644 index 000000000000..26012821ac35 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LEAD(t.IntValue) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..b23c6a7f93bf --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Informix.DB2).sql new file mode 100644 index 000000000000..507b9c81a977 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LEAD(t.IntValue, 2) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Informix.DB2).sql new file mode 100644 index 000000000000..040fc200cd73 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LEAD(t.IntValue, 2, 0) OVER (ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Informix.DB2).sql new file mode 100644 index 000000000000..b23c6a7f93bf --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Informix.DB2).sql @@ -0,0 +1,8 @@ +-- Informix.DB2 Informix + +SELECT + t.Id, + LEAD(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Informix.DB2).sql new file mode 100644 index 000000000000..50f8af1079ca --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Informix.DB2).sql new file mode 100644 index 000000000000..50f8af1079ca --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + MAX(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MAX(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Informix.DB2).sql new file mode 100644 index 000000000000..a9ee63a63f9a --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Informix.DB2).sql new file mode 100644 index 000000000000..a9ee63a63f9a --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + MIN(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.ByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + MIN(t.NullableByteValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Informix.DB2).sql new file mode 100644 index 000000000000..a95b09025a51 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Informix.DB2).sql @@ -0,0 +1,14 @@ +-- Informix.DB2 Informix + +SELECT + ROW_NUMBER() OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + DENSE_RANK() OVER (PARTITION BY t.CategoryId ORDER BY t.IntValue), + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + LAG(t.IntValue, 1, 0) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..26b14c000796 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..5f6f1b9cf389 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + NTILE(4) OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..d87164073b9e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + NTILE(4) OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + NTILE(4) OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..5c8ce3d17309 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..37f190669325 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..4f68a4c290da --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + PERCENT_RANK() OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..01b5ad679b37 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + PERCENT_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..91b349215371 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Informix.DB2).sql new file mode 100644 index 000000000000..5d1297b06042 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Informix.DB2).sql @@ -0,0 +1,9 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..bb9183858eb8 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..203cfe5508be --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..e7a8cfe7f9aa --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + RANK() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..5dc56ab161cb --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Informix.DB2).sql new file mode 100644 index 000000000000..50cf8e5b9f8f --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql new file mode 100644 index 000000000000..862cb0e324b2 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId, x.Name ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Informix.DB2).sql new file mode 100644 index 000000000000..b5255c9995cb --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Informix.DB2).sql @@ -0,0 +1,35 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 0 + ELSE 1 + END, x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x.CategoryId ORDER BY CASE + WHEN x."Timestamp" IS NULL THEN 1 + ELSE 0 + END, x."Timestamp" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Informix.DB2).sql new file mode 100644 index 000000000000..6b5a6b4d6283 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Informix.DB2).sql @@ -0,0 +1,33 @@ +-- Informix.DB2 Informix + +SELECT + x.Id, + x.Name, + x.CategoryId, + x."Value", + x."Timestamp", + x.IntValue, + x.NullableIntValue, + x.LongValue, + x.NullableLongValue, + x.DoubleValue, + x.NullableDoubleValue, + x.DecimalValue, + x.NullableDecimalValue, + x.FloatValue, + x.NullableFloatValue, + x.ShortValue, + x.NullableShortValue, + x.ByteValue, + x.NullableByteValue, + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + WindowFunctionTestEntity x +ORDER BY + x.Id + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Informix.DB2).sql new file mode 100644 index 000000000000..5d8a3045879e --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Informix.DB2).sql @@ -0,0 +1,15 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t.IntValue) OVER (ORDER BY t.Id ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Informix.DB2).sql new file mode 100644 index 000000000000..eb572e51ff23 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableShortValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ByteValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableByteValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Informix.DB2).sql new file mode 100644 index 000000000000..eb572e51ff23 --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Informix.DB2).sql @@ -0,0 +1,20 @@ +-- Informix.DB2 Informix + +SELECT + SUM(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableIntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.LongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableLongValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDoubleValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.DecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableDecimalValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.FloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableFloatValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ShortValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableShortValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.ByteValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id), + SUM(t.NullableByteValue::Int) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Informix.DB2).sql new file mode 100644 index 000000000000..7187749683ae --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + SUM(CASE + WHEN t.CategoryId = 1 THEN t.IntValue + ELSE NULL + END) OVER (PARTITION BY t.CategoryId ORDER BY t.Id) +FROM + WindowFunctionTestEntity t + diff --git a/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Informix.DB2).sql b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Informix.DB2).sql new file mode 100644 index 000000000000..9f4630258ccd --- /dev/null +++ b/Informix.DB2/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Informix.DB2).sql @@ -0,0 +1,10 @@ +-- Informix.DB2 Informix + +SELECT + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t.IntValue) OVER (PARTITION BY t.CategoryId ORDER BY t.Id ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + WindowFunctionTestEntity t + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MariaDB.11).sql new file mode 100644 index 000000000000..e9cf1e1eff33 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MariaDB.11).sql @@ -0,0 +1,34 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CASE + WHEN `t`.`IntValue` > 20 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN `t`.`DoubleValue` > 15 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(CASE + WHEN `t`.`IntValue` < 80 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MariaDB.11).sql new file mode 100644 index 000000000000..45618623343b --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MariaDB.11).sql @@ -0,0 +1,11 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MariaDB.11).sql new file mode 100644 index 000000000000..20724dd3943c --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MariaDB.11).sql new file mode 100644 index 000000000000..20724dd3943c --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MariaDB.11).sql new file mode 100644 index 000000000000..9e1e3e0251df --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + AVG(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MariaDB.11).sql new file mode 100644 index 000000000000..00777e32000f --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MariaDB.11).sql @@ -0,0 +1,7 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MariaDB.11).sql new file mode 100644 index 000000000000..157daa8665a0 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MariaDB.11).sql new file mode 100644 index 000000000000..ac918f1680a9 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MariaDB.11).sql @@ -0,0 +1,7 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..4eefb90fc829 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,7 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MariaDB.11).sql new file mode 100644 index 000000000000..4d8ed4cef06a --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..5d849518e436 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..e86a1394db81 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..5ed6c1a5a70d --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..63e634c6a3f1 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (ORDER BY `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MariaDB.11).sql new file mode 100644 index 000000000000..aaed586ef1a4 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MariaDB.11).sql @@ -0,0 +1,15 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + ROW_NUMBER() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MariaDB.11).sql new file mode 100644 index 000000000000..b0dc48523321 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..968eaa60e38e --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..0e1c6a0d8fd7 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..ae92cae8911a --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..d331488f1314 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (ORDER BY `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MariaDB.11).sql new file mode 100644 index 000000000000..b08a33fd1131 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..b08a33fd1131 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MariaDB.11).sql new file mode 100644 index 000000000000..1127224bbf08 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MariaDB.11).sql new file mode 100644 index 000000000000..f6f11d4f96c4 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MariaDB.11).sql new file mode 100644 index 000000000000..89fe5c6756c7 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MariaDB.11).sql new file mode 100644 index 000000000000..48849bf118f8 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MariaDB.11).sql @@ -0,0 +1,12 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MariaDB.11).sql new file mode 100644 index 000000000000..b3326058fb4d --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MariaDB.11).sql new file mode 100644 index 000000000000..b291ff83825b --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MariaDB.11).sql new file mode 100644 index 000000000000..f3cdf0f00466 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MariaDB.11).sql new file mode 100644 index 000000000000..084228f5231c --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..084228f5231c --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MariaDB.11).sql new file mode 100644 index 000000000000..7e3183f2dced --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MariaDB.11).sql new file mode 100644 index 000000000000..126f3277ca08 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + LEAD(`t`.`DoubleValue`) OVER (ORDER BY `t`.`Id`), + LAG(`t`.`DecimalValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`CategoryId`, `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MariaDB.11).sql new file mode 100644 index 000000000000..10ba172d3b63 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..2945df2341c1 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MariaDB.11).sql new file mode 100644 index 000000000000..6fc89b0249a2 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MariaDB.11).sql new file mode 100644 index 000000000000..2945df2341c1 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MariaDB.11).sql new file mode 100644 index 000000000000..b0adfb11aa2a --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MariaDB.11).sql new file mode 100644 index 000000000000..b0adfb11aa2a --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MariaDB.11).sql new file mode 100644 index 000000000000..6b951c7d00b0 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MariaDB.11).sql new file mode 100644 index 000000000000..6b951c7d00b0 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..778dfc4aa18a --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..9cd26c5101c3 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..3996a228b877 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..062707d57922 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (ORDER BY `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MariaDB.11).sql new file mode 100644 index 000000000000..abb6c0222564 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..67fc3ad7a4e0 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MariaDB.11).sql new file mode 100644 index 000000000000..67fc3ad7a4e0 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MariaDB.11).sql @@ -0,0 +1,8 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..986b82760091 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..e8c1bf88e8fe --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..aa07d4d82217 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..b4c28db882fb --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MariaDB.11).sql new file mode 100644 index 000000000000..93a6cbf43459 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MariaDB.11).sql @@ -0,0 +1,9 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..34f5d07bd85e --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..36b2c65e51a6 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..1cacdcb3b9e3 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..07c1f130b889 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (ORDER BY `x`.`Timestamp`), + RANK() OVER (ORDER BY `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (ORDER BY `x`.`Value` DESC), + RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MariaDB.11).sql new file mode 100644 index 000000000000..d510f768b3d5 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql new file mode 100644 index 000000000000..54b0230fe679 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MariaDB.11).sql new file mode 100644 index 000000000000..99b9ac34fd87 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MariaDB.11).sql @@ -0,0 +1,35 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MariaDB.11).sql new file mode 100644 index 000000000000..469b812dd5ed --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MariaDB.11).sql @@ -0,0 +1,33 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MariaDB.11).sql new file mode 100644 index 000000000000..48cbebf3b036 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MariaDB.11).sql @@ -0,0 +1,15 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MariaDB.11).sql new file mode 100644 index 000000000000..c10bf40674f6 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MariaDB.11).sql new file mode 100644 index 000000000000..c10bf40674f6 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MariaDB.11).sql @@ -0,0 +1,20 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MariaDB.11).sql new file mode 100644 index 000000000000..1c8f67482752 --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MariaDB.11).sql b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MariaDB.11).sql new file mode 100644 index 000000000000..46572a794f0d --- /dev/null +++ b/MariaDB.11/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MariaDB.11).sql @@ -0,0 +1,10 @@ +-- MariaDB.11 MariaDB.10.MySqlConnector MariaDB + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySql.8.0).sql new file mode 100644 index 000000000000..ec4cb969f972 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySql.8.0).sql @@ -0,0 +1,34 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CASE + WHEN `t`.`IntValue` > 20 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN `t`.`DoubleValue` > 15 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(CASE + WHEN `t`.`IntValue` < 80 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySql.8.0).sql new file mode 100644 index 000000000000..bae588df04da --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySql.8.0).sql @@ -0,0 +1,11 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySql.8.0).sql new file mode 100644 index 000000000000..8e87869e647b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySql.8.0).sql new file mode 100644 index 000000000000..8e87869e647b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySql.8.0).sql new file mode 100644 index 000000000000..bc68cddd1976 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + AVG(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySql.8.0).sql new file mode 100644 index 000000000000..8f19a86e1161 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySql.8.0).sql @@ -0,0 +1,7 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySql.8.0).sql new file mode 100644 index 000000000000..8a00bb672e11 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySql.8.0).sql new file mode 100644 index 000000000000..d86ab6d61fe9 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySql.8.0).sql @@ -0,0 +1,7 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..bbfa2f721c34 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,7 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySql.8.0).sql new file mode 100644 index 000000000000..83b9f2e13cc1 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..4fa40b44f570 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..938f0e984af2 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..c2139e93fba3 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..07df2a2cfac7 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (ORDER BY `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySql.8.0).sql new file mode 100644 index 000000000000..5702235cc29b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySql.8.0).sql @@ -0,0 +1,15 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + ROW_NUMBER() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySql.8.0).sql new file mode 100644 index 000000000000..4fda10313080 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..8a2bc9fafee7 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..7585697db480 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..b90b6f17c302 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..45d66b3b0114 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (ORDER BY `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySql.8.0).sql new file mode 100644 index 000000000000..e66142b345ae --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..e66142b345ae --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySql.8.0).sql new file mode 100644 index 000000000000..c2256e759b2e --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySql.8.0).sql new file mode 100644 index 000000000000..75a433bcfe3b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySql.8.0).sql new file mode 100644 index 000000000000..bb0448b6d321 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySql.8.0).sql new file mode 100644 index 000000000000..09ebf0842aef --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySql.8.0).sql @@ -0,0 +1,12 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySql.8.0).sql new file mode 100644 index 000000000000..04d66b129655 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySql.8.0).sql new file mode 100644 index 000000000000..3ebb24ff9295 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySql.8.0).sql new file mode 100644 index 000000000000..e7ff3ff69e52 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`, 2, 0) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySql.8.0).sql new file mode 100644 index 000000000000..40a82d246b6c --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySql.8.0).sql new file mode 100644 index 000000000000..072c3149dad0 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..072c3149dad0 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySql.8.0).sql new file mode 100644 index 000000000000..003faba4f3fc --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySql.8.0).sql new file mode 100644 index 000000000000..4bddc28871d2 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySql.8.0).sql @@ -0,0 +1,12 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`, 2, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 2, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySql.8.0).sql new file mode 100644 index 000000000000..7c681c240e0e --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + LEAD(`t`.`DoubleValue`) OVER (ORDER BY `t`.`Id`), + LAG(`t`.`DecimalValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`CategoryId`, `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySql.8.0).sql new file mode 100644 index 000000000000..c6696aeb1e6d --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..f8b64316b12b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySql.8.0).sql new file mode 100644 index 000000000000..880db7fe4711 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySql.8.0).sql new file mode 100644 index 000000000000..589a797e1ecf --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`, 2, 0) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySql.8.0).sql new file mode 100644 index 000000000000..f8b64316b12b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySql.8.0).sql new file mode 100644 index 000000000000..a4ddf20a185c --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySql.8.0).sql new file mode 100644 index 000000000000..a4ddf20a185c --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySql.8.0).sql new file mode 100644 index 000000000000..d303f8b0a770 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySql.8.0).sql new file mode 100644 index 000000000000..d303f8b0a770 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySql.8.0).sql new file mode 100644 index 000000000000..1183b85c64c9 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySql.8.0).sql @@ -0,0 +1,14 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + ROW_NUMBER() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`IntValue`), + DENSE_RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`IntValue`), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(`t`.`IntValue`, 1, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 1, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..9f57e9c2cb7c --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..7171bde64a72 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..8f6e1c4c0387 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..caaabd628750 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (ORDER BY `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySql.8.0).sql new file mode 100644 index 000000000000..cf15e06d2659 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..3d12bc910555 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySql.8.0).sql new file mode 100644 index 000000000000..3d12bc910555 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySql.8.0).sql @@ -0,0 +1,8 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..5ae1e49f03f9 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..01b5de61ad2b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..2408358cd92e --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..a0c7f4add3bf --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySql.8.0).sql new file mode 100644 index 000000000000..45432f37e023 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySql.8.0).sql @@ -0,0 +1,9 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..e188a8b953f1 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..5d8dc7eebfe0 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..6307bb1a462c --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..2ea7ae25141b --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (ORDER BY `x`.`Timestamp`), + RANK() OVER (ORDER BY `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (ORDER BY `x`.`Value` DESC), + RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySql.8.0).sql new file mode 100644 index 000000000000..811139ee262a --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql new file mode 100644 index 000000000000..8e3309cc55a4 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySql.8.0).sql new file mode 100644 index 000000000000..427e145cdc21 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySql.8.0).sql @@ -0,0 +1,35 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySql.8.0).sql new file mode 100644 index 000000000000..2a53b2cf5076 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySql.8.0).sql @@ -0,0 +1,33 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySql.8.0).sql new file mode 100644 index 000000000000..b9cd7a4b3ce9 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySql.8.0).sql @@ -0,0 +1,15 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySql.8.0).sql new file mode 100644 index 000000000000..e1160ac41242 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySql.8.0).sql new file mode 100644 index 000000000000..e1160ac41242 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySql.8.0).sql @@ -0,0 +1,20 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySql.8.0).sql new file mode 100644 index 000000000000..a7c931580b96 --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySql.8.0).sql b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySql.8.0).sql new file mode 100644 index 000000000000..c2fe4255ef7f --- /dev/null +++ b/MySql.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySql.8.0).sql @@ -0,0 +1,10 @@ +-- MySql.8.0 MySql.8.0.MySql.Data MySql80 + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..5bba089527a2 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(MySqlConnector.8.0).sql @@ -0,0 +1,34 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CASE + WHEN `t`.`IntValue` > 20 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN `t`.`DoubleValue` > 15 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN `t`.`IntValue` > 10 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(CASE + WHEN `t`.`IntValue` < 80 THEN `t`.`IntValue` + ELSE NULL + END) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..8c990c5910d9 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(MySqlConnector.8.0).sql @@ -0,0 +1,11 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..412d4eafe095 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..412d4eafe095 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + AVG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..7e7fc3bbecef --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + AVG(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`DoubleValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..d855fd234c64 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(MySqlConnector.8.0).sql @@ -0,0 +1,7 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..2e87a6414af3 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..63d1ddae5326 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(MySqlConnector.8.0).sql @@ -0,0 +1,7 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + COUNT(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..8a645e7192d6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,7 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..d6688473e4c0 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + COUNT(CASE + WHEN `t`.`IntValue` > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..cba36f51b224 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..11b97b8688a6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..957a142db0e9 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + CUME_DIST() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..091cfe2bed2b --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`), + CUME_DIST() OVER (ORDER BY `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Value` DESC), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + CUME_DIST() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..dc1ff38a3b27 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(MySqlConnector.8.0).sql @@ -0,0 +1,15 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + ROW_NUMBER() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + AVG(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + COUNT(*) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..1cf4db02b9e8 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..9c2bdb6f62bc --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..83092f0807df --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..defaa3ae7702 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + DENSE_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..b02e3473ab83 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`), + DENSE_RANK() OVER (ORDER BY `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Value` DESC), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + DENSE_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..f2c07c8598c5 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..f2c07c8598c5 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..2cd2f6bf410a --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..0a04dae6c8d9 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..9bd80fda7769 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..aba113bd939c --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(MySqlConnector.8.0).sql @@ -0,0 +1,12 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..832c86920703 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..6fb1d98b9f74 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..72bf6c390e2d --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`, 2, 0) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..24dcb7d71018 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..1c76b33ca5e6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..1c76b33ca5e6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..9be2a668b613 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..460f6515e309 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(MySqlConnector.8.0).sql @@ -0,0 +1,12 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`, 2, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 2, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..e4b54b07610d --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + LEAD(`t`.`DoubleValue`) OVER (ORDER BY `t`.`Id`), + LAG(`t`.`DecimalValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`NullableIntValue`) OVER (ORDER BY `t`.`Id`), + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`CategoryId`, `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..ecc8d017898c --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..5615612241ad --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..8a5d59b9fcfc --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`, 2) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..e51155abf1f7 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`, 2, 0) OVER (ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..5615612241ad --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + LEAD(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..99ea27e7d928 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..99ea27e7d928 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + MAX(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MAX(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..191e77463cc3 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..191e77463cc3 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + MIN(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`ByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + MIN(`t`.`NullableByteValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..ca1c555673b6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(MySqlConnector.8.0).sql @@ -0,0 +1,14 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + ROW_NUMBER() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`IntValue`), + DENSE_RANK() OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`IntValue`), + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(`t`.`IntValue`, 1, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + LAG(`t`.`IntValue`, 1, 0) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..6609e731b1a6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..ccdb799d77b1 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..897824f33fd5 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + NTILE(4) OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..5883c94350e8 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + NTILE(4) OVER (ORDER BY `x`.`Timestamp`), + NTILE(4) OVER (ORDER BY `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC), + NTILE(4) OVER (ORDER BY `x`.`Value` DESC), + NTILE(4) OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + NTILE(4) OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..ac34857f80b7 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..fc0cc9877004 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..fc0cc9877004 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(MySqlConnector.8.0).sql @@ -0,0 +1,8 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `t`.`Id`, + NTH_VALUE(`t`.`IntValue`, 2) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..28fe98c441fa --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..74e37c831a0b --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..7bb227a43ebf --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + PERCENT_RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..73c0b0c04ae7 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`), + PERCENT_RANK() OVER (ORDER BY `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Value` DESC), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + PERCENT_RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..32fdaa02022d --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(MySqlConnector.8.0).sql @@ -0,0 +1,9 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..5993c076056d --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..26c9f4c18c17 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..6f227ea1a1b5 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + RANK() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..6f1a8c3a9ec8 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + RANK() OVER (ORDER BY `x`.`Timestamp`), + RANK() OVER (ORDER BY `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC), + RANK() OVER (ORDER BY `x`.`Value` DESC), + RANK() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + RANK() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..8f7fe15a781f --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..6a869197ff1a --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId`, `x`.`Name` ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..324b10995267 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(MySqlConnector.8.0).sql @@ -0,0 +1,35 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 0 + ELSE 1 + END, `x`.`Timestamp`), + ROW_NUMBER() OVER (PARTITION BY `x`.`CategoryId` ORDER BY CASE + WHEN `x`.`Timestamp` IS NULL THEN 1 + ELSE 0 + END, `x`.`Timestamp` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..faeaf939c800 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(MySqlConnector.8.0).sql @@ -0,0 +1,33 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + `x`.`Id`, + `x`.`Name`, + `x`.`CategoryId`, + `x`.`Value`, + `x`.`Timestamp`, + `x`.`IntValue`, + `x`.`NullableIntValue`, + `x`.`LongValue`, + `x`.`NullableLongValue`, + `x`.`DoubleValue`, + `x`.`NullableDoubleValue`, + `x`.`DecimalValue`, + `x`.`NullableDecimalValue`, + `x`.`FloatValue`, + `x`.`NullableFloatValue`, + `x`.`ShortValue`, + `x`.`NullableShortValue`, + `x`.`ByteValue`, + `x`.`NullableByteValue`, + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`), + ROW_NUMBER() OVER (ORDER BY `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Value` DESC), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp`, `x`.`Value`), + ROW_NUMBER() OVER (ORDER BY `x`.`Timestamp` DESC, `x`.`Value` DESC) +FROM + `WindowFunctionTestEntity` `x` +ORDER BY + `x`.`Id` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..8858455ca5db --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(MySqlConnector.8.0).sql @@ -0,0 +1,15 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(`t`.`IntValue`) OVER (ORDER BY `t`.`Id` ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..9431ba6062d4 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..9431ba6062d4 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(MySqlConnector.8.0).sql @@ -0,0 +1,20 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableIntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`LongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableLongValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDoubleValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`DecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableDecimalValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`FloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`NullableFloatValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(`t`.`ShortValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableShortValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`ByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`), + SUM(CAST(`t`.`NullableByteValue` AS SIGNED)) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..a7610c127ee2 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + SUM(CASE + WHEN `t`.`CategoryId` = 1 THEN `t`.`IntValue` + ELSE NULL + END) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id`) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySqlConnector.8.0).sql b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySqlConnector.8.0).sql new file mode 100644 index 000000000000..7837d63dbcd6 --- /dev/null +++ b/MySqlConnector.8.0/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(MySqlConnector.8.0).sql @@ -0,0 +1,10 @@ +-- MySqlConnector.8.0 MySql.8.0.MySqlConnector MySql80 + +SELECT + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(`t`.`IntValue`) OVER (PARTITION BY `t`.`CategoryId` ORDER BY `t`.`Id` ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + `WindowFunctionTestEntity` `t` + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.11.Managed).sql new file mode 100644 index 000000000000..b60fdf99d52d --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.11.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f3869859018e --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.11.Managed).sql new file mode 100644 index 000000000000..936a12961978 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..936a12961978 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.11.Managed).sql new file mode 100644 index 000000000000..29824c7889d8 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.11.Managed).sql new file mode 100644 index 000000000000..59adc781be45 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.11.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.11.Managed).sql new file mode 100644 index 000000000000..c41dd097bac7 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.11.Managed).sql new file mode 100644 index 000000000000..15abb7ffa100 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.11.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..1c9d54920697 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.11.Managed).sql new file mode 100644 index 000000000000..55e46e21e1b1 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..443fed8ead98 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..bef23113a7c7 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..afb0c6056f46 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..6312a6af4653 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.11.Managed).sql new file mode 100644 index 000000000000..cb25c29e61b9 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.11.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..32970ea1e10d --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..6e2307fced5a --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..e28cf0e1c283 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..ccb08bc5deea --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..4f5f8534fb57 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.11.Managed).sql new file mode 100644 index 000000000000..0244a54d30d5 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..0244a54d30d5 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.11.Managed).sql new file mode 100644 index 000000000000..29e2d640574c --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.11.Managed).sql new file mode 100644 index 000000000000..5a8ec083fef8 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f23d85a43310 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f0c23e650af6 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.11.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.11.Managed).sql new file mode 100644 index 000000000000..59df0a99cf4e --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.11.Managed).sql new file mode 100644 index 000000000000..63cb0cb2a014 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.11.Managed).sql new file mode 100644 index 000000000000..ddf99815ea72 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.11.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..9470f9a76ae1 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.11.Managed).sql new file mode 100644 index 000000000000..18b6ae329f61 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.11.Managed).sql new file mode 100644 index 000000000000..d188c2ae8d3a --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.11.Managed).sql new file mode 100644 index 000000000000..2d6bf64dafb2 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..7bdad4ad1e42 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.11.Managed).sql new file mode 100644 index 000000000000..a2a5e85a7515 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..a2a5e85a7515 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.11.Managed).sql new file mode 100644 index 000000000000..9d73c256e2f8 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.11.Managed).sql new file mode 100644 index 000000000000..527fad05021c --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.11.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.11.Managed).sql new file mode 100644 index 000000000000..9422f7aeda58 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.11.Managed).sql new file mode 100644 index 000000000000..a75fd14bc564 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..c6d0df9c28cd --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.11.Managed).sql new file mode 100644 index 000000000000..1c3f2f70f97b --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.11.Managed).sql new file mode 100644 index 000000000000..8f0063f3e711 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..c6d0df9c28cd --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.11.Managed).sql new file mode 100644 index 000000000000..1601523f8a8e --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..1601523f8a8e --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.11.Managed).sql new file mode 100644 index 000000000000..fd03e1166537 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..fd03e1166537 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f78d1bac9e03 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.11.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..982694b8a965 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..9f3da712a219 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..36ea47aa7926 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..ced287e5c1c2 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.11.Managed).sql new file mode 100644 index 000000000000..8017b2ddae6d --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..2c029b526c78 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.11.Managed).sql new file mode 100644 index 000000000000..2c029b526c78 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.11.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..8f3e74916b47 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..6c780e9ee754 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..46e330e23d4a --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..a16f5d8f01a7 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.11.Managed).sql new file mode 100644 index 000000000000..320a2e7cc76d --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.11.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.11.Managed Oracle11 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f159ed82d971 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.11.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.11.Managed).sql new file mode 100644 index 000000000000..404568837228 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.11.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.11.Managed).sql new file mode 100644 index 000000000000..eabd7860ec77 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.11.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.11.Managed).sql new file mode 100644 index 000000000000..84245ea0daed --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.11.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..47e5cfbbda23 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..377be553fb9b --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..cfd7dd45f50f --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..e86a1802f805 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.11.Managed).sql new file mode 100644 index 000000000000..b5c9e6c8512d --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..f23925e35af8 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.11.Managed).sql new file mode 100644 index 000000000000..22ee6fa9f87a --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.11.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.11.Managed).sql new file mode 100644 index 000000000000..b788e26fe508 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.11.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.11.Managed).sql new file mode 100644 index 000000000000..11ba1ddf3698 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.11.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.11.Managed).sql new file mode 100644 index 000000000000..672ec7e4ef53 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.11.Managed).sql new file mode 100644 index 000000000000..672ec7e4ef53 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.11.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.11.Managed).sql new file mode 100644 index 000000000000..3df85b4b86ef --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.11.Managed).sql b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.11.Managed).sql new file mode 100644 index 000000000000..db508857ac86 --- /dev/null +++ b/Oracle.11.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.11.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.11.Managed Oracle11 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9968d704bab9 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.12.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9686c5394361 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.12.Managed).sql new file mode 100644 index 000000000000..93968fa31fb2 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..93968fa31fb2 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9c1b885ab47d --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.12.Managed).sql new file mode 100644 index 000000000000..de1a9a778e51 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.12.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.12.Managed).sql new file mode 100644 index 000000000000..3a1960b946e8 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.12.Managed).sql new file mode 100644 index 000000000000..852dbe831f6b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.12.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..a555dc04026e --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.12.Managed).sql new file mode 100644 index 000000000000..ab0c0e49fb8b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..ec31652e8f61 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..a2ab655a10fe --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..1ea4f59aff22 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..87da917bb571 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.12.Managed).sql new file mode 100644 index 000000000000..e1106ac6791b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.12.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..92553801f0fb --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..437c5f5a491b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..bfda8388c034 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..6430227578c4 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..96e485625a2f --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.12.Managed).sql new file mode 100644 index 000000000000..4c3d112b66d4 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..4c3d112b66d4 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.12.Managed).sql new file mode 100644 index 000000000000..090b52869fe7 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.12.Managed).sql new file mode 100644 index 000000000000..0eeb022a2bd7 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.12.Managed).sql new file mode 100644 index 000000000000..51669d414aef --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.12.Managed).sql new file mode 100644 index 000000000000..b1c80dba7c1f --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.12.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9eda4ae36350 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.12.Managed).sql new file mode 100644 index 000000000000..63282de0d700 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.12.Managed).sql new file mode 100644 index 000000000000..e5af219af47a --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.12.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..101da2afda4f --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.12.Managed).sql new file mode 100644 index 000000000000..7d61c6a0f5a3 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.12.Managed).sql new file mode 100644 index 000000000000..ba49c2653707 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.12.Managed).sql new file mode 100644 index 000000000000..0ef97a411629 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..5dc446b16fbc --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.12.Managed).sql new file mode 100644 index 000000000000..4e2e17ebbd91 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..4e2e17ebbd91 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.12.Managed).sql new file mode 100644 index 000000000000..3bfde23569c4 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.12.Managed).sql new file mode 100644 index 000000000000..f321a89d0aff --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.12.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9a847d60cabd --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.12.Managed).sql new file mode 100644 index 000000000000..8331fa113350 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d6794063e096 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.12.Managed).sql new file mode 100644 index 000000000000..fbd6d12a62fc --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.12.Managed).sql new file mode 100644 index 000000000000..7bb4fd3cf851 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d6794063e096 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.12.Managed).sql new file mode 100644 index 000000000000..859bf793dc0b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..859bf793dc0b --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.12.Managed).sql new file mode 100644 index 000000000000..3cc245a5c71e --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..3cc245a5c71e --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.12.Managed).sql new file mode 100644 index 000000000000..dd4365dc7433 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.12.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..a54aef795ad5 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..e26ebc124db1 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..959636aeac68 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..09fd23223139 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.12.Managed).sql new file mode 100644 index 000000000000..23e9f081c940 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..894d44ce7b4a --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.12.Managed).sql new file mode 100644 index 000000000000..894d44ce7b4a --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.12.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..3b5a708daaa9 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d94bbc6a1157 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d11f1316b21c --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..a05823953aec --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9f95c8af602a --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.12.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d1ea30f18026 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.12.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.12.Managed).sql new file mode 100644 index 000000000000..d78cbc5a9e75 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.12.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.12.Managed).sql new file mode 100644 index 000000000000..730d8a2106e6 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.12.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.12.Managed).sql new file mode 100644 index 000000000000..ed086583d020 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.12.Managed).sql new file mode 100644 index 000000000000..eb3eadb7b5b7 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.12.Managed).sql @@ -0,0 +1,25 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + g_2."Key_1", + t1.PD +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") as PD + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + CROSS APPLY ( + SELECT + g_2.PD + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + FETCH NEXT 1 ROWS ONLY + ) t1 + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.12.Managed).sql new file mode 100644 index 000000000000..16fb2e86f700 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.12.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.12.Managed).sql new file mode 100644 index 000000000000..bb9dcc967646 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.12.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..76e86def5f26 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..395d527052e1 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..b4727c46add7 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..37c77d8aa613 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.12.Managed).sql new file mode 100644 index 000000000000..9805e70ec081 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..4afa9ea2e08a --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.12.Managed).sql new file mode 100644 index 000000000000..084c21abf952 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.12.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.12.Managed).sql new file mode 100644 index 000000000000..417baf08ff6d --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.12.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.12.Managed).sql new file mode 100644 index 000000000000..5a3fdddab6ea --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.12.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.12.Managed).sql new file mode 100644 index 000000000000..280a4c3a7c72 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.12.Managed).sql new file mode 100644 index 000000000000..280a4c3a7c72 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.12.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.12.Managed).sql new file mode 100644 index 000000000000..140211813148 --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.12.Managed).sql b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.12.Managed).sql new file mode 100644 index 000000000000..2ae9068c446d --- /dev/null +++ b/Oracle.12.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.12.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.12.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8cae6b15c68d --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.18.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.18.Managed).sql new file mode 100644 index 000000000000..27593974da25 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.18.Managed).sql new file mode 100644 index 000000000000..bf2fc243aecd --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..bf2fc243aecd --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.18.Managed).sql new file mode 100644 index 000000000000..688ae0bd6831 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.18.Managed).sql new file mode 100644 index 000000000000..c24f2be28dd0 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.18.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1755f2d6b89a --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.18.Managed).sql new file mode 100644 index 000000000000..edbf210fd297 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.18.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..d8549511803b --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.18.Managed).sql new file mode 100644 index 000000000000..f0bdf9e35e21 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..87477753a7c1 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1e4677035f40 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..50367a2cc0d8 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..f6244998e8d0 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.18.Managed).sql new file mode 100644 index 000000000000..848d59c57ac4 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.18.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..b75e80be756c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..9357e93e1f01 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..baecb2993be2 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..ea46df8ad4dd --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..00d5c2235b4e --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1d00f079adc7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1d00f079adc7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.18.Managed).sql new file mode 100644 index 000000000000..86e01317dd32 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.18.Managed).sql new file mode 100644 index 000000000000..712314e8c3d7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.18.Managed).sql new file mode 100644 index 000000000000..a0183224a090 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.18.Managed).sql new file mode 100644 index 000000000000..82dd35b6334c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.18.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.18.Managed).sql new file mode 100644 index 000000000000..ed6d7902e206 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.18.Managed).sql new file mode 100644 index 000000000000..5bf66feabf7e --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.18.Managed).sql new file mode 100644 index 000000000000..33d6c7164095 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.18.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..f64506fe0e32 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.18.Managed).sql new file mode 100644 index 000000000000..4cfb3c573112 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.18.Managed).sql new file mode 100644 index 000000000000..56d660aad999 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.18.Managed).sql new file mode 100644 index 000000000000..96a6056cf887 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..114e128df153 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1c10340a1cd6 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..1c10340a1cd6 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8d2606ca96ef --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.18.Managed).sql new file mode 100644 index 000000000000..86fd4ec344f9 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.18.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.18.Managed).sql new file mode 100644 index 000000000000..ec1cd7507561 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.18.Managed).sql new file mode 100644 index 000000000000..7da5ea7132e7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..29bf04bfa0bb --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.18.Managed).sql new file mode 100644 index 000000000000..5dcf22c80dee --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.18.Managed).sql new file mode 100644 index 000000000000..deb29eccb540 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..29bf04bfa0bb --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.18.Managed).sql new file mode 100644 index 000000000000..40f7ccc3963a --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..40f7ccc3963a --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.18.Managed).sql new file mode 100644 index 000000000000..aece2a7a07f0 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..aece2a7a07f0 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8c91aff87dd9 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.18.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..e487d4db795c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..ce179a6837d6 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..4909e27756f7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..b54b7f165f22 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.18.Managed).sql new file mode 100644 index 000000000000..a3a8e35ed6f1 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8df1ad71ff55 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8df1ad71ff55 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.18.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..a848e066a7b8 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..ca2aae339d94 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..94e6c22f97ff --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..78116f91ad02 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.18.Managed).sql new file mode 100644 index 000000000000..e012511d1ec7 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.18.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.18.Managed).sql new file mode 100644 index 000000000000..4a7edc1edeb0 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.18.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.18.Managed).sql new file mode 100644 index 000000000000..f4b1220d271c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.18.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.18.Managed).sql new file mode 100644 index 000000000000..a3fb68dd8ef6 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.18.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.18.Managed).sql new file mode 100644 index 000000000000..4af5c52bfac2 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.18.Managed).sql new file mode 100644 index 000000000000..78c0561f0e38 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.18.Managed).sql @@ -0,0 +1,25 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + g_2."Key_1", + t1.PD +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") as PD + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + CROSS APPLY ( + SELECT + g_2.PD + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + FETCH NEXT 1 ROWS ONLY + ) t1 + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.18.Managed).sql new file mode 100644 index 000000000000..8fcac41f802d --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.18.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.18.Managed).sql new file mode 100644 index 000000000000..eba76cdf14ff --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.18.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..a5594f4d8de5 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..85b7a4baab6d --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..d8af2e524b43 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..320dcb11847a --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.18.Managed).sql new file mode 100644 index 000000000000..bb028b7c9c11 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..77e838bc678c --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.18.Managed).sql new file mode 100644 index 000000000000..6ca53eb4cdff --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.18.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.18.Managed).sql new file mode 100644 index 000000000000..3ff9606f33e9 --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.18.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.18.Managed).sql new file mode 100644 index 000000000000..7cac5ab22ead --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.18.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.18.Managed).sql new file mode 100644 index 000000000000..389fa99725cf --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.18.Managed).sql new file mode 100644 index 000000000000..389fa99725cf --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.18.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.18.Managed).sql new file mode 100644 index 000000000000..7c8b6aab4f4a --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.18.Managed).sql b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.18.Managed).sql new file mode 100644 index 000000000000..f6a5d7593f6f --- /dev/null +++ b/Oracle.18.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.18.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.18.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.19.Managed).sql new file mode 100644 index 000000000000..b5f624d8abce --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.19.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.19.Managed).sql new file mode 100644 index 000000000000..baf5b4f11e7b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.19.Managed).sql new file mode 100644 index 000000000000..cbd2d4549c8f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..cbd2d4549c8f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.19.Managed).sql new file mode 100644 index 000000000000..37619b3760c0 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.19.Managed).sql new file mode 100644 index 000000000000..ad93e762bab0 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.19.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.19.Managed).sql new file mode 100644 index 000000000000..19918e71d87d --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.19.Managed).sql new file mode 100644 index 000000000000..90ca51bd04ed --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.19.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..abbb9e89e64d --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.19.Managed).sql new file mode 100644 index 000000000000..8f3ca7f9ba56 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f998c64d7300 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f2c9d61ddd70 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..1a07015d3d67 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..bb6bad199d3f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.19.Managed).sql new file mode 100644 index 000000000000..031f06cfe52b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.19.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f769390ea4b1 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..dc3d57d907a5 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..00d3a0af459b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..63d279065ed9 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..82eed07cf603 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.19.Managed).sql new file mode 100644 index 000000000000..7382345bc256 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..7382345bc256 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.19.Managed).sql new file mode 100644 index 000000000000..ee8a7a192090 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.19.Managed).sql new file mode 100644 index 000000000000..b975aea1514f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.19.Managed).sql new file mode 100644 index 000000000000..e9faf1ae7ea4 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.19.Managed).sql new file mode 100644 index 000000000000..1c0555092041 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.19.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.19.Managed).sql new file mode 100644 index 000000000000..a59b1eb8c606 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.19.Managed).sql new file mode 100644 index 000000000000..79b3d1eb902f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.19.Managed).sql new file mode 100644 index 000000000000..0db6617e22b6 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.19.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..13e224afbb86 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.19.Managed).sql new file mode 100644 index 000000000000..dd2332323682 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.19.Managed).sql new file mode 100644 index 000000000000..b77fb9201902 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.19.Managed).sql new file mode 100644 index 000000000000..15c34e1f7e11 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..16549fadca93 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.19.Managed).sql new file mode 100644 index 000000000000..cb9da11f7982 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..cb9da11f7982 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.19.Managed).sql new file mode 100644 index 000000000000..42bd5bf2d3bd --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.19.Managed).sql new file mode 100644 index 000000000000..029adad7b284 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.19.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.19.Managed).sql new file mode 100644 index 000000000000..8e67822d7136 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.19.Managed).sql new file mode 100644 index 000000000000..68081b561682 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..fde6f56e15b1 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.19.Managed).sql new file mode 100644 index 000000000000..185fe87d8821 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.19.Managed).sql new file mode 100644 index 000000000000..df103915320c --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..fde6f56e15b1 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.19.Managed).sql new file mode 100644 index 000000000000..d04a9b91ae6b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..d04a9b91ae6b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.19.Managed).sql new file mode 100644 index 000000000000..efb1a71d4863 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..efb1a71d4863 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.19.Managed).sql new file mode 100644 index 000000000000..1f9b5a2256d2 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.19.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..b34329f956fe --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..ba81b5c59a5d --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..af0af6ba5485 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..108cba996873 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f66a04140b8f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..d375bd2fe48b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.19.Managed).sql new file mode 100644 index 000000000000..d375bd2fe48b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.19.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..6529315de8da --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..218d9661816a --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..8dca659de9d1 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..d807ab1363b6 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.19.Managed).sql new file mode 100644 index 000000000000..cf9c18e12b02 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.19.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.19.Managed).sql new file mode 100644 index 000000000000..93bde493bd34 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.19.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.19.Managed).sql new file mode 100644 index 000000000000..1a59455e9a70 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.19.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.19.Managed).sql new file mode 100644 index 000000000000..5963a1226669 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.19.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.19.Managed).sql new file mode 100644 index 000000000000..ab08575c9016 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.19.Managed).sql new file mode 100644 index 000000000000..fa82014f8522 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.19.Managed).sql @@ -0,0 +1,25 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + g_2."Key_1", + t1.PD +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") as PD + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + CROSS APPLY ( + SELECT + g_2.PD + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + FETCH NEXT 1 ROWS ONLY + ) t1 + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.19.Managed).sql new file mode 100644 index 000000000000..897383fe0c7d --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.19.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.19.Managed).sql new file mode 100644 index 000000000000..0d1c0c1a715c --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.19.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..8f754ef38d27 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..0115fb34ce86 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..8324084f7010 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..e59d689c227f --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f4983f15a3b4 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..eee277d52457 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.19.Managed).sql new file mode 100644 index 000000000000..7ff4be09596b --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.19.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.19.Managed).sql new file mode 100644 index 000000000000..736a540c10e9 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.19.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.19.Managed).sql new file mode 100644 index 000000000000..441762445a31 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.19.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f9bde64b03af --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.19.Managed).sql new file mode 100644 index 000000000000..f9bde64b03af --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.19.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.19.Managed).sql new file mode 100644 index 000000000000..ed327c999653 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.19.Managed).sql b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.19.Managed).sql new file mode 100644 index 000000000000..5b4a64cc1562 --- /dev/null +++ b/Oracle.19.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.19.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.19.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.21.Managed).sql new file mode 100644 index 000000000000..265ef8d747b2 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.21.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.21.Managed).sql new file mode 100644 index 000000000000..cbf9142d1146 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.21.Managed).sql new file mode 100644 index 000000000000..f9ec03031b15 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..f9ec03031b15 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.21.Managed).sql new file mode 100644 index 000000000000..72ab5927f4bb --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.21.Managed).sql new file mode 100644 index 000000000000..dafc13e626bd --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.21.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.21.Managed).sql new file mode 100644 index 000000000000..da480398f0a1 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.21.Managed).sql new file mode 100644 index 000000000000..cfeceaed3096 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.21.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..d9bd1878c935 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.21.Managed).sql new file mode 100644 index 000000000000..63c6d853d67d --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..4f4f23cece77 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..d1007078d443 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..e9088a301720 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a88bce83a821 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.21.Managed).sql new file mode 100644 index 000000000000..735f185ef485 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.21.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..16d1933ab471 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..baf8b360dfcd --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..9a7942c8cadc --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..2b96b1693fae --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..beb33b989a63 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.21.Managed).sql new file mode 100644 index 000000000000..b8979977230f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..b8979977230f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.21.Managed).sql new file mode 100644 index 000000000000..290b9c4ddf8c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.21.Managed).sql new file mode 100644 index 000000000000..420c7d524e97 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.21.Managed).sql new file mode 100644 index 000000000000..25f648a0e691 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.21.Managed).sql new file mode 100644 index 000000000000..7542406635ab --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.21.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.21.Managed).sql new file mode 100644 index 000000000000..29b0cf01d549 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.21.Managed).sql new file mode 100644 index 000000000000..92f8d6bcdc62 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.21.Managed).sql new file mode 100644 index 000000000000..fe6e246d3333 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.21.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ce1b8f336937 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.21.Managed).sql new file mode 100644 index 000000000000..254d9ab379f9 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.21.Managed).sql new file mode 100644 index 000000000000..457a82d778e5 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a125e19531c5 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..191dbf444ef4 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.21.Managed).sql new file mode 100644 index 000000000000..6dd7ad07d44f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..6dd7ad07d44f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.21.Managed).sql new file mode 100644 index 000000000000..d7faf40aa40e --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.21.Managed).sql new file mode 100644 index 000000000000..187709e4d745 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.21.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.21.Managed).sql new file mode 100644 index 000000000000..fb1ae5bd9dc8 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.21.Managed).sql new file mode 100644 index 000000000000..b1136ce11c59 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..f4a13c738236 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.21.Managed).sql new file mode 100644 index 000000000000..605ecd3e9a01 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.21.Managed).sql new file mode 100644 index 000000000000..35b70af8c8d8 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..f4a13c738236 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ae9805a401c8 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ae9805a401c8 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.21.Managed).sql new file mode 100644 index 000000000000..779e59877b1d --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..779e59877b1d --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.21.Managed).sql new file mode 100644 index 000000000000..cda9f5468768 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.21.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a41cc2b72164 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..09a913ef88b6 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ccd18f188220 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..03ae793233e9 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.21.Managed).sql new file mode 100644 index 000000000000..c3a6db0e995e --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..6110cc808722 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.21.Managed).sql new file mode 100644 index 000000000000..6110cc808722 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.21.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..cb3eb021468c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ef3ec2da4310 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..397be64e816f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..122a8acd502b --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.21.Managed).sql new file mode 100644 index 000000000000..fb59d0d6835a --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.21.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.21.Managed).sql new file mode 100644 index 000000000000..344f5538aceb --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.21.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.21.Managed).sql new file mode 100644 index 000000000000..5cc9a8eab100 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.21.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.21.Managed).sql new file mode 100644 index 000000000000..8ca522dced4d --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.21.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a25884f9db79 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.21.Managed).sql new file mode 100644 index 000000000000..e7d3f2bcb22d --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.21.Managed).sql @@ -0,0 +1,25 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + g_2."Key_1", + t1.PD +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") as PD + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + CROSS APPLY ( + SELECT + g_2.PD + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + FETCH NEXT 1 ROWS ONLY + ) t1 + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.21.Managed).sql new file mode 100644 index 000000000000..566aa80939ff --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.21.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.21.Managed).sql new file mode 100644 index 000000000000..e3e572fad38b --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.21.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..dee227ed3663 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ee1af1b31da1 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..02070118f7da --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..876ab0b8058e --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a0abe514822c --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..6a62f3175969 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.21.Managed).sql new file mode 100644 index 000000000000..df9ddfac4017 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.21.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.21.Managed).sql new file mode 100644 index 000000000000..e79553f5a005 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.21.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.21.Managed).sql new file mode 100644 index 000000000000..7369ef9d18f5 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.21.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.21.Managed).sql new file mode 100644 index 000000000000..039ca98233bf --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.21.Managed).sql new file mode 100644 index 000000000000..039ca98233bf --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.21.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.21.Managed).sql new file mode 100644 index 000000000000..a760da859988 --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.21.Managed).sql b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.21.Managed).sql new file mode 100644 index 000000000000..ba28990de02f --- /dev/null +++ b/Oracle.21.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.21.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.21.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.23.Managed).sql new file mode 100644 index 000000000000..a3e785df9bcb --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(Oracle.23.Managed).sql @@ -0,0 +1,34 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CASE + WHEN t."IntValue" > 20 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN t."DoubleValue" > 15D THEN t."DoubleValue" + ELSE NULL + END) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN t."IntValue" > 10 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(CASE + WHEN t."IntValue" < 80 THEN t."IntValue" + ELSE NULL + END) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e13f2e13a8b9 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6f34f27fe95a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6f34f27fe95a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.23.Managed).sql new file mode 100644 index 000000000000..df9e7294877a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + AVG(CASE + WHEN t."CategoryId" = 1 THEN t."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.23.Managed).sql new file mode 100644 index 000000000000..190d0b2911c0 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(Oracle.23.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.23.Managed).sql new file mode 100644 index 000000000000..07aa6769f7bb --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.23.Managed).sql new file mode 100644 index 000000000000..7ee467f4909e --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(Oracle.23.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e0d07e71b5c1 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.23.Managed).sql new file mode 100644 index 000000000000..69af75915bb0 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + COUNT(CASE + WHEN t."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..306afc604594 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..4655646fddb4 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..7fccfc31061a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..16b5f1e571ef --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.23.Managed).sql new file mode 100644 index 000000000000..7abd77d74c28 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(Oracle.23.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..907a99664f7e --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..37b4a5c018f8 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..d3f58c7ddd88 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..07105fdeb76f --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..aa88302eb3a5 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.23.Managed).sql new file mode 100644 index 000000000000..f40b9d58f1e8 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..f40b9d58f1e8 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.23.Managed).sql new file mode 100644 index 000000000000..42082a41f8c1 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.23.Managed).sql new file mode 100644 index 000000000000..142f230f6727 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e49a36797ca2 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.23.Managed).sql new file mode 100644 index 000000000000..941a048e9f99 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(Oracle.23.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.23.Managed).sql new file mode 100644 index 000000000000..4f817c1c5aa2 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepAllAggregates(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + AVG(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.23.Managed).sql new file mode 100644 index 000000000000..627809d92460 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepFirstBasic(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue") OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.23.Managed).sql new file mode 100644 index 000000000000..8709dceda4e7 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithMultipleOrderBy(Oracle.23.Managed).sql @@ -0,0 +1,7 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue", t."Id" DESC) OVER (PARTITION BY t."CategoryId") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..284bc0361a49 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.KeepWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") KEEP (DENSE_RANK FIRST ORDER BY t."DoubleValue"), + MAX(t."IntValue") KEEP (DENSE_RANK LAST ORDER BY t."DoubleValue" DESC) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.23.Managed).sql new file mode 100644 index 000000000000..3dc01265e78b --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.23.Managed).sql new file mode 100644 index 000000000000..8d499e54acad --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e5abf5b6f880 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6e905dbedd01 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.23.Managed).sql new file mode 100644 index 000000000000..bc79f1699ae3 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..bc79f1699ae3 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.23.Managed).sql new file mode 100644 index 000000000000..56c134957d7f --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.23.Managed).sql new file mode 100644 index 000000000000..b5b0519f4568 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(Oracle.23.Managed).sql @@ -0,0 +1,12 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.23.Managed).sql new file mode 100644 index 000000000000..ea43284c694a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.23.Managed).sql new file mode 100644 index 000000000000..c4889d73ab45 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..2f3b95ba02dc --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.23.Managed).sql new file mode 100644 index 000000000000..087e57f15e84 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.23.Managed).sql new file mode 100644 index 000000000000..5be31762ac9e --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..2f3b95ba02dc --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.23.Managed).sql new file mode 100644 index 000000000000..94988454f538 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..94988454f538 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.23.Managed).sql new file mode 100644 index 000000000000..4a542e3838d5 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..4a542e3838d5 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.23.Managed).sql new file mode 100644 index 000000000000..cc71a2ee39f7 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(Oracle.23.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..b1162d323d07 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..698dceb6fae9 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..68b24ba7f529 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..3622f2347d7a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6a47f2a4645a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..f717dd0ade3e --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.23.Managed).sql new file mode 100644 index 000000000000..f717dd0ade3e --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(Oracle.23.Managed).sql @@ -0,0 +1,8 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..1091bb499559 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..a456e088c016 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e013c3fd5369 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6fd9817ff737 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.23.Managed).sql new file mode 100644 index 000000000000..6d10a8498e5d --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(Oracle.23.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.23.Managed).sql new file mode 100644 index 000000000000..d39a3532ec01 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(Oracle.23.Managed).sql @@ -0,0 +1,13 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.23.Managed).sql new file mode 100644 index 000000000000..3c01fce17c6d --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(Oracle.23.Managed).sql @@ -0,0 +1,11 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.23.Managed).sql new file mode 100644 index 000000000000..fd5e5e43cd5a --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(Oracle.23.Managed).sql @@ -0,0 +1,14 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.23.Managed).sql new file mode 100644 index 000000000000..c6f96d1e86bb --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.23.Managed).sql new file mode 100644 index 000000000000..ed8bfc3fc08c --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(Oracle.23.Managed).sql @@ -0,0 +1,25 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + g_2."Key_1", + t1.PD +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5D) WITHIN GROUP (ORDER BY g_1."IntValue") as PD + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + CROSS APPLY ( + SELECT + g_2.PD + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + FETCH NEXT 1 ROWS ONLY + ) t1 + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.23.Managed).sql new file mode 100644 index 000000000000..44ab64641c93 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(Oracle.23.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5D) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.23.Managed).sql new file mode 100644 index 000000000000..4af4170c40f6 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(Oracle.23.Managed).sql @@ -0,0 +1,9 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..a0ee6ec3a3df --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..1572581bd677 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..dd6ff746aade --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..8cf4a1c2c615 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.23.Managed).sql new file mode 100644 index 000000000000..5baebe41259b --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e332d5d449c0 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.23.Managed).sql new file mode 100644 index 000000000000..75e6dc9112bd --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(Oracle.23.Managed).sql @@ -0,0 +1,29 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.23.Managed).sql new file mode 100644 index 000000000000..f8a00cb46e62 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(Oracle.23.Managed).sql @@ -0,0 +1,33 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.23.Managed).sql new file mode 100644 index 000000000000..e4fdc35cec5c --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(Oracle.23.Managed).sql @@ -0,0 +1,15 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.23.Managed).sql new file mode 100644 index 000000000000..dac58a62c797 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.23.Managed).sql new file mode 100644 index 000000000000..dac58a62c797 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(Oracle.23.Managed).sql @@ -0,0 +1,20 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableShortValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."ByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(CAST(t."NullableByteValue" AS Int)) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.23.Managed).sql new file mode 100644 index 000000000000..2a8c684afbd2 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + SUM(CASE + WHEN t."CategoryId" = 1 THEN t."IntValue" + ELSE NULL + END) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.23.Managed).sql b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.23.Managed).sql new file mode 100644 index 000000000000..85a1155dd0a8 --- /dev/null +++ b/Oracle.23.Managed/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(Oracle.23.Managed).sql @@ -0,0 +1,10 @@ +-- Oracle.23.Managed Oracle.Managed Oracle12 + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.13).sql new file mode 100644 index 000000000000..f1fba11c8730 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.13).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.13).sql new file mode 100644 index 000000000000..69a9d338b1fc --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.13).sql new file mode 100644 index 000000000000..2597fdff536b --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.13).sql new file mode 100644 index 000000000000..e4d2817f10d7 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..e4d2817f10d7 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.13).sql new file mode 100644 index 000000000000..371a7ea03db0 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.13).sql new file mode 100644 index 000000000000..37c8bd3879b1 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.13).sql new file mode 100644 index 000000000000..c0049f62544d --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.13).sql new file mode 100644 index 000000000000..a1fba03bc373 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..7ac6b14f1f50 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.13).sql new file mode 100644 index 000000000000..c95765fccaae --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..2efa8d926a6c --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..76df4f95c293 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..b29e5191e943 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..b77e20e9aeda --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.13).sql new file mode 100644 index 000000000000..4b7f73052997 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.13).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.13).sql new file mode 100644 index 000000000000..d1121939b01d --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..ad2aa8140170 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..2c00a5b755ec --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..56f5a8831909 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..1e8f2fcae647 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.13).sql new file mode 100644 index 000000000000..9ac1a5387aaa --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..9ac1a5387aaa --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.13).sql new file mode 100644 index 000000000000..118e4e8cbc79 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.13).sql new file mode 100644 index 000000000000..3f200d93b48b --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.13).sql new file mode 100644 index 000000000000..48876bd29d42 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.13).sql new file mode 100644 index 000000000000..15e69eb6dbf9 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.13).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.13).sql new file mode 100644 index 000000000000..af22dc05ab47 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.13).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.13).sql new file mode 100644 index 000000000000..8f2575b1c977 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.13).sql new file mode 100644 index 000000000000..f33074a44bf8 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.13).sql new file mode 100644 index 000000000000..3154f79a7421 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.13).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.13).sql new file mode 100644 index 000000000000..069f14c2d4b4 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.13).sql new file mode 100644 index 000000000000..a7eadf908f35 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.13).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.13).sql new file mode 100644 index 000000000000..f726b6dd92f9 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.13).sql new file mode 100644 index 000000000000..9628374f240b --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.13).sql new file mode 100644 index 000000000000..6d3cf2063a9a --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.13).sql new file mode 100644 index 000000000000..1041c26e13c8 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.13).sql new file mode 100644 index 000000000000..55337e3a6bf6 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.13).sql new file mode 100644 index 000000000000..5def9a215799 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..2e865e5985e7 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.13).sql new file mode 100644 index 000000000000..aa3f129ef789 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..aa3f129ef789 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.13).sql new file mode 100644 index 000000000000..26eb9c77d422 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.13).sql new file mode 100644 index 000000000000..09884c03f02f --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.13).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.13).sql new file mode 100644 index 000000000000..9fc4f93a5993 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.13).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.13).sql new file mode 100644 index 000000000000..7354bac31027 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..6d57952ffc64 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.13).sql new file mode 100644 index 000000000000..6c4407aa37b1 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.13).sql new file mode 100644 index 000000000000..da3e7d9dd2bf --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..6d57952ffc64 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.13).sql new file mode 100644 index 000000000000..16beef7e7f8f --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..16beef7e7f8f --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.13).sql new file mode 100644 index 000000000000..e85452dfe269 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..e85452dfe269 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.13).sql new file mode 100644 index 000000000000..81c557c2d614 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.13).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..cecaab04533a --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..48566d5767ef --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..bbbe2b96cbc5 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..79477b9d53d0 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.13).sql new file mode 100644 index 000000000000..7e65a4615ac1 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..b556025e75bb --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.13).sql new file mode 100644 index 000000000000..b556025e75bb --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..0318557c8c01 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..ee4df64d25cc --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..b3901142ade7 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..5d8a98ff6a40 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.13).sql new file mode 100644 index 000000000000..fb89a22bc7e9 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.13).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.13).sql new file mode 100644 index 000000000000..0aa817324d78 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.13).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.13).sql new file mode 100644 index 000000000000..ba68a9bb5329 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.13).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.13).sql new file mode 100644 index 000000000000..09920151e452 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.13).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.13).sql new file mode 100644 index 000000000000..44253c449fbe --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.13).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.13).sql new file mode 100644 index 000000000000..ac8eaed403b3 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.13).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.13).sql new file mode 100644 index 000000000000..170f2233c413 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.13).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.13).sql new file mode 100644 index 000000000000..b48210813265 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.13).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..02cdc0bd1857 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..c749571fc759 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..2c0dc978b42f --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..4546bcf02a18 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.13).sql new file mode 100644 index 000000000000..cd87c32a2752 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..1a8f840806f7 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.13).sql new file mode 100644 index 000000000000..52998a7307db --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.13).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.13).sql new file mode 100644 index 000000000000..2b0d11065379 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.13).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.13).sql new file mode 100644 index 000000000000..cc19f4552d13 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.13).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.13).sql new file mode 100644 index 000000000000..7d866f579fdc --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.13).sql new file mode 100644 index 000000000000..7d866f579fdc --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.13).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.13).sql new file mode 100644 index 000000000000..ffe6137b81b4 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.13).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.13).sql new file mode 100644 index 000000000000..8feb6221dca6 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.13).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.13).sql b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.13).sql new file mode 100644 index 000000000000..a48b24df3f97 --- /dev/null +++ b/PostgreSQL.13/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.13).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.13 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.14).sql new file mode 100644 index 000000000000..0f3bbad71a60 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.14).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.14).sql new file mode 100644 index 000000000000..1f57beb7a254 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.14).sql new file mode 100644 index 000000000000..3004c85968e1 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.14).sql new file mode 100644 index 000000000000..fae262ff1695 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..fae262ff1695 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.14).sql new file mode 100644 index 000000000000..15ebfcca0ac6 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.14).sql new file mode 100644 index 000000000000..80be604e7ea2 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.14).sql new file mode 100644 index 000000000000..c4da4da351ab --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.14).sql new file mode 100644 index 000000000000..8e8cd75ff1a3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..47926a3a0dad --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.14).sql new file mode 100644 index 000000000000..4f78e6bb2957 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..13fa1db02d5c --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..504934799ba0 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..a3137695bdd5 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..2c32ad273823 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.14).sql new file mode 100644 index 000000000000..a73a02695121 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.14).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.14).sql new file mode 100644 index 000000000000..727353333d88 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..8fb0c0ec9bd3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..5e047509f7a3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..35feded024f8 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..73e3a5a43b4b --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.14).sql new file mode 100644 index 000000000000..71deede1eb90 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..71deede1eb90 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.14).sql new file mode 100644 index 000000000000..fbf5f24bb0ac --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.14).sql new file mode 100644 index 000000000000..462db7344066 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.14).sql new file mode 100644 index 000000000000..8cb65a291b87 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.14).sql new file mode 100644 index 000000000000..119cf150f7dc --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.14).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.14).sql new file mode 100644 index 000000000000..dde2e2ec314c --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.14).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.14).sql new file mode 100644 index 000000000000..7ff47a8c1c5d --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.14).sql new file mode 100644 index 000000000000..e27633465da3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.14).sql new file mode 100644 index 000000000000..6fd61f380c06 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.14).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.14).sql new file mode 100644 index 000000000000..5aec7f11d894 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.14).sql new file mode 100644 index 000000000000..3cfcb08dd679 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.14).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.14).sql new file mode 100644 index 000000000000..0eca65503852 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.14).sql new file mode 100644 index 000000000000..18625c7fad97 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.14).sql new file mode 100644 index 000000000000..db3be717bf43 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.14).sql new file mode 100644 index 000000000000..f316858d0166 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.14).sql new file mode 100644 index 000000000000..cab39099070b --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.14).sql new file mode 100644 index 000000000000..4241f722f132 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..9e455f67a364 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.14).sql new file mode 100644 index 000000000000..aa042fdcb8ef --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..aa042fdcb8ef --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.14).sql new file mode 100644 index 000000000000..3f7fd72f6f78 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.14).sql new file mode 100644 index 000000000000..95933450e9d4 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.14).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.14).sql new file mode 100644 index 000000000000..ecffe0cf0162 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.14).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.14).sql new file mode 100644 index 000000000000..7556383af053 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..76ee90a7d95b --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.14).sql new file mode 100644 index 000000000000..30ea21450c38 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.14).sql new file mode 100644 index 000000000000..045332fd9249 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..76ee90a7d95b --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.14).sql new file mode 100644 index 000000000000..c6716d742e0e --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..c6716d742e0e --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.14).sql new file mode 100644 index 000000000000..aa5bac9d027a --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..aa5bac9d027a --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.14).sql new file mode 100644 index 000000000000..30afbbf977f9 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.14).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..a6065d78b52e --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..74b0544ac011 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..3b6fd05b3fa3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..44241cbfa78d --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.14).sql new file mode 100644 index 000000000000..a7e0bef5a813 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..f21ee4098c9f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.14).sql new file mode 100644 index 000000000000..f21ee4098c9f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..704d4e84d481 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..3d4804dff092 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..559cd64d49f5 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..722c278c5e5f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.14).sql new file mode 100644 index 000000000000..790cc39847b4 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.14).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.14).sql new file mode 100644 index 000000000000..eea625afa400 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.14).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.14).sql new file mode 100644 index 000000000000..8230a9e4a16f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.14).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.14).sql new file mode 100644 index 000000000000..368c53673cc9 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.14).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.14).sql new file mode 100644 index 000000000000..24ac93dd666a --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.14).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.14).sql new file mode 100644 index 000000000000..38df34e95494 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.14).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.14).sql new file mode 100644 index 000000000000..fa6624c6f7a2 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.14).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.14).sql new file mode 100644 index 000000000000..521cdb175db6 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.14).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..77c0369f6940 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..71066de17222 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..f91c5d862e98 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..f7bcd096a7cd --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.14).sql new file mode 100644 index 000000000000..0f6bbdabd918 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..db79a78ecc99 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.14).sql new file mode 100644 index 000000000000..44f55e128c26 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.14).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.14).sql new file mode 100644 index 000000000000..2bb8ee17a6c5 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.14).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.14).sql new file mode 100644 index 000000000000..441e14c730b3 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.14).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.14).sql new file mode 100644 index 000000000000..b911ac115e42 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.14).sql new file mode 100644 index 000000000000..b911ac115e42 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.14).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.14).sql new file mode 100644 index 000000000000..171c28d13354 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.14).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.14).sql new file mode 100644 index 000000000000..791587f0bad5 --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.14).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.14).sql b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.14).sql new file mode 100644 index 000000000000..bed862cb872f --- /dev/null +++ b/PostgreSQL.14/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.14).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.14 PostgreSQL.13 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.15).sql new file mode 100644 index 000000000000..76c8844e868d --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.15).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.15).sql new file mode 100644 index 000000000000..1266bff10e1e --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.15).sql new file mode 100644 index 000000000000..3904346e32c9 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.15).sql new file mode 100644 index 000000000000..ea763a5923a8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..ea763a5923a8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.15).sql new file mode 100644 index 000000000000..69e364f7d598 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.15).sql new file mode 100644 index 000000000000..cbe82afe4043 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.15).sql new file mode 100644 index 000000000000..c5b38473ab1f --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.15).sql new file mode 100644 index 000000000000..a232138b7ad8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..7d2b34f5a457 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.15).sql new file mode 100644 index 000000000000..71f978f4cbfe --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..a4497428e7f8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..47d29ae29e4f --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..993c87f5b9db --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..cbb7babba70c --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.15).sql new file mode 100644 index 000000000000..97a4e61547a7 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.15).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.15).sql new file mode 100644 index 000000000000..2d3171862be7 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..d10d3dbd4a6d --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..28fa3b22ed1b --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..b83c55e45b52 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..bfcfe68ff284 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.15).sql new file mode 100644 index 000000000000..5a72222096b3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..5a72222096b3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.15).sql new file mode 100644 index 000000000000..b3d53ab43eb3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.15).sql new file mode 100644 index 000000000000..1b0a075198df --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.15).sql new file mode 100644 index 000000000000..45e25c32e844 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.15).sql new file mode 100644 index 000000000000..bbee666138cf --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.15).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.15).sql new file mode 100644 index 000000000000..a10dd303af1e --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.15).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.15).sql new file mode 100644 index 000000000000..1bd85dedd0d8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.15).sql new file mode 100644 index 000000000000..e90e88983fa8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.15).sql new file mode 100644 index 000000000000..b1605f9042af --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.15).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.15).sql new file mode 100644 index 000000000000..5240b77ce9fb --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.15).sql new file mode 100644 index 000000000000..e68b4f1f9e83 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.15).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.15).sql new file mode 100644 index 000000000000..2048bacc891c --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.15).sql new file mode 100644 index 000000000000..ad5edc3bad8b --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.15).sql new file mode 100644 index 000000000000..44057a744848 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.15).sql new file mode 100644 index 000000000000..ff77db2e30fa --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.15).sql new file mode 100644 index 000000000000..bb6c4b5a108b --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.15).sql new file mode 100644 index 000000000000..71587d6e8769 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..f195a6ee2a03 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.15).sql new file mode 100644 index 000000000000..da7179c63fe2 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..da7179c63fe2 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.15).sql new file mode 100644 index 000000000000..ccc97778ef4a --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.15).sql new file mode 100644 index 000000000000..2acfb149f711 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.15).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.15).sql new file mode 100644 index 000000000000..e73e09258f05 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.15).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.15).sql new file mode 100644 index 000000000000..af06fcb4bd9d --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..17da3b509742 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.15).sql new file mode 100644 index 000000000000..cc4a0189de17 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.15).sql new file mode 100644 index 000000000000..e67fa6f08ef3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..17da3b509742 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.15).sql new file mode 100644 index 000000000000..1d8749f20ecf --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..1d8749f20ecf --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.15).sql new file mode 100644 index 000000000000..0140387a779a --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..0140387a779a --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.15).sql new file mode 100644 index 000000000000..4438c5e6c92b --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.15).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..0b5d8f11d499 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..97cef674f9a6 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..3d60a74b155f --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..5bec11b56d2b --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.15).sql new file mode 100644 index 000000000000..61d48fa7bd30 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..da3b1f2d9432 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.15).sql new file mode 100644 index 000000000000..da3b1f2d9432 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..b6724a4aaadf --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..28f8d399e7b3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..6089e5b981be --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..907c661fef1e --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.15).sql new file mode 100644 index 000000000000..6f941a6a5cad --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.15).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.15).sql new file mode 100644 index 000000000000..a155956be5dc --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.15).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.15).sql new file mode 100644 index 000000000000..697a2610e4ae --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.15).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.15).sql new file mode 100644 index 000000000000..921f0dcebc51 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.15).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.15).sql new file mode 100644 index 000000000000..5d1c6dfedf9f --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.15).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.15).sql new file mode 100644 index 000000000000..a61da377264e --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.15).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.15).sql new file mode 100644 index 000000000000..472ca678f4e8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.15).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.15).sql new file mode 100644 index 000000000000..72ce8ade9434 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.15).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..aae3bbec2bb4 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..36234fd9e8c3 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..b78be5a14794 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..38561b6f8a10 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.15).sql new file mode 100644 index 000000000000..1185e037e4f8 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..6491ccef3ff6 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.15).sql new file mode 100644 index 000000000000..a4a4a51f3853 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.15).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.15).sql new file mode 100644 index 000000000000..60ed894c2cad --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.15).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.15).sql new file mode 100644 index 000000000000..f85b582cd673 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.15).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.15).sql new file mode 100644 index 000000000000..8df3a513ee9c --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.15).sql new file mode 100644 index 000000000000..8df3a513ee9c --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.15).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.15).sql new file mode 100644 index 000000000000..ac719b400bff --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.15).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.15).sql new file mode 100644 index 000000000000..9a3529da7263 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.15).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.15).sql b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.15).sql new file mode 100644 index 000000000000..f8d097cee5f9 --- /dev/null +++ b/PostgreSQL.15/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.15).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.16).sql new file mode 100644 index 000000000000..689ac0eefb06 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.16).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.16).sql new file mode 100644 index 000000000000..01d514f02367 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.16).sql new file mode 100644 index 000000000000..634f8fb9b93f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.16).sql new file mode 100644 index 000000000000..fc135e96c50f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..fc135e96c50f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.16).sql new file mode 100644 index 000000000000..e43978d9ef21 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.16).sql new file mode 100644 index 000000000000..1a1cadba8e67 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.16).sql new file mode 100644 index 000000000000..7571943a3ae8 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.16).sql new file mode 100644 index 000000000000..fbf80a31c888 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..6992eb5728ea --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.16).sql new file mode 100644 index 000000000000..5d4b35964b5c --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..98bb5caf7fa9 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..7a7b6e982289 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..6386a8793661 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..fe62bc87447b --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.16).sql new file mode 100644 index 000000000000..ae85f1f56468 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.16).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.16).sql new file mode 100644 index 000000000000..64da2b55f430 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..8f3211dfd546 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..8f48194e93b2 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..4ca3bb2c44c2 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..a7d579913872 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.16).sql new file mode 100644 index 000000000000..fd70938f86b1 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..fd70938f86b1 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.16).sql new file mode 100644 index 000000000000..dab5cb971311 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.16).sql new file mode 100644 index 000000000000..1794b0b2f59b --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.16).sql new file mode 100644 index 000000000000..58a2a2507517 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.16).sql new file mode 100644 index 000000000000..f8eec6593863 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.16).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.16).sql new file mode 100644 index 000000000000..d1e50742d63c --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.16).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.16).sql new file mode 100644 index 000000000000..0e05fcdacd0a --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.16).sql new file mode 100644 index 000000000000..e7757d900331 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.16).sql new file mode 100644 index 000000000000..34afcd2c2a8c --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.16).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.16).sql new file mode 100644 index 000000000000..610ec95731f6 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.16).sql new file mode 100644 index 000000000000..5757b9093567 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.16).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.16).sql new file mode 100644 index 000000000000..1d12f13461e6 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.16).sql new file mode 100644 index 000000000000..c7f8ee97b7b4 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.16).sql new file mode 100644 index 000000000000..7c2bbc75d88a --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.16).sql new file mode 100644 index 000000000000..dec17788de9e --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.16).sql new file mode 100644 index 000000000000..c99f5823c20f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.16).sql new file mode 100644 index 000000000000..95c20824efa8 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..4e5d05f006cc --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.16).sql new file mode 100644 index 000000000000..0796c49f6a72 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..0796c49f6a72 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.16).sql new file mode 100644 index 000000000000..37418ede0258 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.16).sql new file mode 100644 index 000000000000..7214539ace59 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.16).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.16).sql new file mode 100644 index 000000000000..e9596d884332 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.16).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.16).sql new file mode 100644 index 000000000000..248ad5bb72d0 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..8a980a23b29b --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.16).sql new file mode 100644 index 000000000000..fd4679dc24a3 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.16).sql new file mode 100644 index 000000000000..43a1bd3d32d0 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..8a980a23b29b --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.16).sql new file mode 100644 index 000000000000..2fd34e11f7ec --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..2fd34e11f7ec --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.16).sql new file mode 100644 index 000000000000..3c0e55924fe3 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..3c0e55924fe3 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.16).sql new file mode 100644 index 000000000000..9c4449461198 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.16).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..e9b14943389a --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..10b60072121c --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..81738d992856 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..bc1425df0177 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.16).sql new file mode 100644 index 000000000000..d93d26d311c9 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..641fe2771f4f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.16).sql new file mode 100644 index 000000000000..641fe2771f4f --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..9d55cc119f6c --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..9112792d0ae3 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..fec08f53ea07 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..35544642eb59 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.16).sql new file mode 100644 index 000000000000..7a0b375ccccc --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.16).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.16).sql new file mode 100644 index 000000000000..842147500731 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.16).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.16).sql new file mode 100644 index 000000000000..978ec15d66df --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.16).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.16).sql new file mode 100644 index 000000000000..db929dff940d --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.16).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.16).sql new file mode 100644 index 000000000000..28ea91be187e --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.16).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.16).sql new file mode 100644 index 000000000000..26839dfc93d5 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.16).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.16).sql new file mode 100644 index 000000000000..13bfbf95ef40 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.16).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.16).sql new file mode 100644 index 000000000000..0566f0a92ba5 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.16).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..ffb39d8d9f55 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..ccd880267fd3 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..0d91464ba226 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..470156e72c80 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.16).sql new file mode 100644 index 000000000000..c97e3aeca75b --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..b8b1d6064668 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.16).sql new file mode 100644 index 000000000000..e43a307294ab --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.16).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.16).sql new file mode 100644 index 000000000000..8d3cbdc15502 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.16).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.16).sql new file mode 100644 index 000000000000..1c8fed5d1ced --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.16).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.16).sql new file mode 100644 index 000000000000..e276f30bc046 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.16).sql new file mode 100644 index 000000000000..e276f30bc046 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.16).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.16).sql new file mode 100644 index 000000000000..5e9aaed058c8 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.16).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.16).sql new file mode 100644 index 000000000000..46df0405e407 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.16).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.16).sql b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.16).sql new file mode 100644 index 000000000000..7d6eb7c89bb8 --- /dev/null +++ b/PostgreSQL.16/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.16).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.16 PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.17).sql new file mode 100644 index 000000000000..8c179591039c --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.17).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.17).sql new file mode 100644 index 000000000000..0c82d614d310 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.17).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.17).sql new file mode 100644 index 000000000000..ab04fb8b8f0a --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.17).sql new file mode 100644 index 000000000000..04e2e0dbfcf2 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..04e2e0dbfcf2 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.17).sql new file mode 100644 index 000000000000..503ba7b716ad --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.17).sql new file mode 100644 index 000000000000..5eaa1e48d748 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.17).sql new file mode 100644 index 000000000000..b771f3841302 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.17).sql new file mode 100644 index 000000000000..269aee9e2ff8 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..e80459d8314e --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.17).sql new file mode 100644 index 000000000000..99649fc2127b --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..719741de3e51 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..83bf3abeba17 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..8a19015c8ee3 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..dc28781ec510 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.17).sql new file mode 100644 index 000000000000..949862e0f3d6 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.17).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.17).sql new file mode 100644 index 000000000000..547e52361d1f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..2ae7ef850a80 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..b3ef6328415e --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..25447f3625d0 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..736d936aa1e2 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.17).sql new file mode 100644 index 000000000000..c76ba4ceb555 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..c76ba4ceb555 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.17).sql new file mode 100644 index 000000000000..2b076f79f488 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.17).sql new file mode 100644 index 000000000000..a4cab97ac142 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.17).sql new file mode 100644 index 000000000000..660104d3d48d --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.17).sql new file mode 100644 index 000000000000..08903625ed17 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.17).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.17).sql new file mode 100644 index 000000000000..11743216463d --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.17).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.17).sql new file mode 100644 index 000000000000..f830c6692b8d --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.17).sql new file mode 100644 index 000000000000..e988681115e3 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.17).sql new file mode 100644 index 000000000000..bbe3293c31ce --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.17).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.17).sql new file mode 100644 index 000000000000..f3bc78e57164 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.17).sql new file mode 100644 index 000000000000..98969d4587f4 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.17).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.17).sql new file mode 100644 index 000000000000..5a597a75c9a3 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.17).sql new file mode 100644 index 000000000000..e486bc28b7cd --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.17).sql new file mode 100644 index 000000000000..409a6eb6f726 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.17).sql new file mode 100644 index 000000000000..793b9219f1a1 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.17).sql new file mode 100644 index 000000000000..36566fc709e7 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.17).sql new file mode 100644 index 000000000000..b39f96642605 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..20ebeeb3bb3f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.17).sql new file mode 100644 index 000000000000..a0d2a663e34f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..a0d2a663e34f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.17).sql new file mode 100644 index 000000000000..a5089071e096 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.17).sql new file mode 100644 index 000000000000..7bcea7d2ce46 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.17).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.17).sql new file mode 100644 index 000000000000..35a7892297ac --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.17).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.17).sql new file mode 100644 index 000000000000..f75308ce229b --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..5ca052f21ff1 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.17).sql new file mode 100644 index 000000000000..ef61be16482b --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.17).sql new file mode 100644 index 000000000000..61e042e354e7 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..5ca052f21ff1 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.17).sql new file mode 100644 index 000000000000..bcbb34a0d0cd --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..bcbb34a0d0cd --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.17).sql new file mode 100644 index 000000000000..b5bdb43156c9 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..b5bdb43156c9 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.17).sql new file mode 100644 index 000000000000..599cdf944993 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.17).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..d52f6aa60b14 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..8770f27dbe26 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..175fd79a5d30 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..c5c95f27e2a1 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.17).sql new file mode 100644 index 000000000000..67a95613557d --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..b3f4d34ecb02 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.17).sql new file mode 100644 index 000000000000..b3f4d34ecb02 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..bcdda6cf886b --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..5b46ea192ac0 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..059b90945982 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..187b1b661976 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.17).sql new file mode 100644 index 000000000000..da515d3cf505 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.17).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.17).sql new file mode 100644 index 000000000000..0cff701e3c54 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.17).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.17).sql new file mode 100644 index 000000000000..3286e02fbb5a --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.17).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.17).sql new file mode 100644 index 000000000000..8c2b8aed4679 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.17).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.17).sql new file mode 100644 index 000000000000..cd74771f7fb4 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.17).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.17).sql new file mode 100644 index 000000000000..4bb8ad81302f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.17).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.17).sql new file mode 100644 index 000000000000..a29144cf0ba5 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.17).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.17).sql new file mode 100644 index 000000000000..854149a44572 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.17).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..d084fc2e65f5 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..7df0da02e710 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..03fe653ccb4f --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..dde665ba30c5 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.17).sql new file mode 100644 index 000000000000..fb5e5800c0a3 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..52b15e1f2355 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.17).sql new file mode 100644 index 000000000000..f3c813d0787e --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.17).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.17).sql new file mode 100644 index 000000000000..2698e894bd8c --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.17).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.17).sql new file mode 100644 index 000000000000..3bffb04e78c8 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.17).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.17).sql new file mode 100644 index 000000000000..3957e64dbf58 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.17).sql new file mode 100644 index 000000000000..3957e64dbf58 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.17).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.17).sql new file mode 100644 index 000000000000..867108fac20e --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.17).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.17).sql new file mode 100644 index 000000000000..e43c3a23d484 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.17).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.17).sql b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.17).sql new file mode 100644 index 000000000000..595080d376f1 --- /dev/null +++ b/PostgreSQL.17/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.17).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.17 PostgreSQL.15 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.18).sql new file mode 100644 index 000000000000..d079a5844ca3 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(PostgreSQL.18).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 20) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(t."DoubleValue") FILTER (WHERE t."DoubleValue" > 15) OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(t."IntValue") FILTER (WHERE t."IntValue" > 10) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") FILTER (WHERE t."IntValue" < 80) OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.18).sql new file mode 100644 index 000000000000..e765c66b9126 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(PostgreSQL.18).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.18).sql new file mode 100644 index 000000000000..a20931e60793 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.18).sql new file mode 100644 index 000000000000..bac5344f2ea4 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..bac5344f2ea4 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + AVG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.18).sql new file mode 100644 index 000000000000..2a4b717ed086 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + AVG(t."DoubleValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.18).sql new file mode 100644 index 000000000000..384f79d8da72 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.18).sql new file mode 100644 index 000000000000..bb5cac0be385 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.18).sql new file mode 100644 index 000000000000..1fb0e6ac24d8 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + COUNT(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..63bd926cdd19 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.18).sql new file mode 100644 index 000000000000..4c3aceca1881 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + COUNT(*) FILTER (WHERE t."IntValue" > 20) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..d49f78290469 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..c14c2a031624 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..0efe66ea98a3 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + CUME_DIST() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..914f6069e554 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + CUME_DIST() OVER (ORDER BY x."Timestamp"), + CUME_DIST() OVER (ORDER BY x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY x."Value" DESC), + CUME_DIST() OVER (ORDER BY x."Timestamp", x."Value"), + CUME_DIST() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.18).sql new file mode 100644 index 000000000000..2979dbd4f6cc --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(PostgreSQL.18).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + AVG(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + COUNT(*) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.18).sql new file mode 100644 index 000000000000..db5c18b4b8ca --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..4e14c82adbec --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..68d9ef9a10bd --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..b237f8c73374 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + DENSE_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..ec3c742c3e9d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + DENSE_RANK() OVER (ORDER BY x."Timestamp"), + DENSE_RANK() OVER (ORDER BY x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY x."Value" DESC), + DENSE_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + DENSE_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.18).sql new file mode 100644 index 000000000000..c8f44e6c1297 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..c8f44e6c1297 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.18).sql new file mode 100644 index 000000000000..f958b80fcaa2 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.18).sql new file mode 100644 index 000000000000..d99d02055c65 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.18).sql new file mode 100644 index 000000000000..bf4bd9562471 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.18).sql new file mode 100644 index 000000000000..88216f1faaa2 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(PostgreSQL.18).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.18).sql new file mode 100644 index 000000000000..0cf905b7eee8 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(PostgreSQL.18).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.18).sql new file mode 100644 index 000000000000..06d75ef7d7d7 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.18).sql new file mode 100644 index 000000000000..6bc18ffc9131 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.18).sql new file mode 100644 index 000000000000..75937e11b3b2 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(PostgreSQL.18).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.18).sql new file mode 100644 index 000000000000..fb444d272a28 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.18).sql new file mode 100644 index 000000000000..c68b707f4842 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(PostgreSQL.18).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.18).sql new file mode 100644 index 000000000000..863448fc1161 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.18).sql new file mode 100644 index 000000000000..f18b6c8d81e2 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.18).sql new file mode 100644 index 000000000000..074b3c55208a --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.18).sql new file mode 100644 index 000000000000..50c1136f7623 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.18).sql new file mode 100644 index 000000000000..12ff0750f81c --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.18).sql new file mode 100644 index 000000000000..0ea8abddba11 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..9a0ed51da8c3 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.18).sql new file mode 100644 index 000000000000..6a6f3fdfb12b --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..6a6f3fdfb12b --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.18).sql new file mode 100644 index 000000000000..51d7cb94897d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.18).sql new file mode 100644 index 000000000000..73f09189f24d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(PostgreSQL.18).sql @@ -0,0 +1,12 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LEAD(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 2, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.18).sql new file mode 100644 index 000000000000..dbba7671595f --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(PostgreSQL.18).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + LEAD(t."DoubleValue") OVER (ORDER BY t."Id"), + LAG(t."DecimalValue") OVER (ORDER BY t."Id"), + LEAD(t."NullableIntValue") OVER (ORDER BY t."Id"), + LEAD(t."IntValue") OVER (ORDER BY t."CategoryId", t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.18).sql new file mode 100644 index 000000000000..8ca1f24dcb6e --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..e0a447840339 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.18).sql new file mode 100644 index 000000000000..d005cde594c5 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.18).sql new file mode 100644 index 000000000000..df382b58e7a1 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue", 2, 0) OVER (ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..e0a447840339 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + LEAD(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.18).sql new file mode 100644 index 000000000000..822f8b82149a --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..822f8b82149a --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + MAX(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MAX(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.18).sql new file mode 100644 index 000000000000..e3f2e59353d7 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..e3f2e59353d7 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + MIN(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."ByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + MIN(t."NullableByteValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.18).sql new file mode 100644 index 000000000000..d35acb4724fa --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(PostgreSQL.18).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + ROW_NUMBER() OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + DENSE_RANK() OVER (PARTITION BY t."CategoryId" ORDER BY t."IntValue"), + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + LAG(t."IntValue", 1, 0) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..1d922fece554 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..b19f5a7e6271 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..ac6aa5855ce2 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + NTILE(4) OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..b6b931fa67fc --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + NTILE(4) OVER (ORDER BY x."Timestamp"), + NTILE(4) OVER (ORDER BY x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC), + NTILE(4) OVER (ORDER BY x."Value" DESC), + NTILE(4) OVER (ORDER BY x."Timestamp", x."Value"), + NTILE(4) OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.18).sql new file mode 100644 index 000000000000..6a23d3128560 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..a45e46eefe0b --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.18).sql new file mode 100644 index 000000000000..a45e46eefe0b --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."Id", + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..aeb542d16abc --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..696a7b95bae4 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..711ce896ea7d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + PERCENT_RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..3ff36427d656 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY x."Timestamp"), + PERCENT_RANK() OVER (ORDER BY x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY x."Value" DESC), + PERCENT_RANK() OVER (ORDER BY x."Timestamp", x."Value"), + PERCENT_RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.18).sql new file mode 100644 index 000000000000..54c0b2c157c1 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileCont(PostgreSQL.18).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.18 PostgreSQL + +SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY t1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.18).sql new file mode 100644 index 000000000000..1e121db74bef --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGrouping(PostgreSQL.18).sql @@ -0,0 +1,13 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."DecimalValue"), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.18).sql new file mode 100644 index 000000000000..e83e2e0244b6 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileContGroupingProjection(PostgreSQL.18).sql @@ -0,0 +1,11 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC), + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY g_1."IntValue" DESC) +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.18).sql new file mode 100644 index 000000000000..7612013d5714 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDisc(PostgreSQL.18).sql @@ -0,0 +1,14 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + +-- PostgreSQL.18 PostgreSQL + +SELECT + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY t1."IntValue") +FROM + "WindowFunctionTestEntity" t1 + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.18).sql new file mode 100644 index 000000000000..24ec50cf8551 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGrouping(PostgreSQL.18).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + g_1."CategoryId", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") +FROM + "WindowFunctionTestEntity" g_1 +GROUP BY + g_1."CategoryId" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.18).sql new file mode 100644 index 000000000000..64ab74a10e59 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileDiscGroupingProjection(PostgreSQL.18).sql @@ -0,0 +1,25 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + g_2."Key_1", + t1."PD" +FROM + ( + SELECT + g_1."CategoryId" as "Key_1", + PERCENTILE_DISC(0.5) WITHIN GROUP (ORDER BY g_1."IntValue") as "PD" + FROM + "WindowFunctionTestEntity" g_1 + GROUP BY + g_1."CategoryId" + ) g_2 + INNER JOIN LATERAL ( + SELECT + g_2."PD" + FROM + "WindowFunctionTestEntity" t + WHERE + g_2."Key_1" = t."CategoryId" + LIMIT 1 + ) t1 ON 1=1 + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.18).sql new file mode 100644 index 000000000000..a304461b7853 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentileSubquery(PostgreSQL.18).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + t."CategoryId", + ( + SELECT + PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY x."DecimalValue") + FROM + "WindowFunctionTestEntity" x + WHERE + x."Id" > t."Id" AND x."DecimalValue" > 1 + ) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.18).sql new file mode 100644 index 000000000000..3953319d8757 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(PostgreSQL.18).sql @@ -0,0 +1,9 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..4264d65de696 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..72fee352cae8 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + RANK() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..7f627430858f --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + RANK() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..0636b222c031 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + RANK() OVER (ORDER BY x."Timestamp"), + RANK() OVER (ORDER BY x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC), + RANK() OVER (ORDER BY x."Value" DESC), + RANK() OVER (ORDER BY x."Timestamp", x."Value"), + RANK() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.18).sql new file mode 100644 index 000000000000..fb2c0ad38b86 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..f81c8b4fe82d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId", x."Name" ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.18).sql new file mode 100644 index 000000000000..7ce41289814f --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(PostgreSQL.18).sql @@ -0,0 +1,29 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" NULLS FIRST), + ROW_NUMBER() OVER (PARTITION BY x."CategoryId" ORDER BY x."Timestamp" DESC NULLS LAST) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.18).sql new file mode 100644 index 000000000000..38416b4926b3 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(PostgreSQL.18).sql @@ -0,0 +1,33 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + x."Id", + x."Name", + x."CategoryId", + x."Value", + x."Timestamp", + x."IntValue", + x."NullableIntValue", + x."LongValue", + x."NullableLongValue", + x."DoubleValue", + x."NullableDoubleValue", + x."DecimalValue", + x."NullableDecimalValue", + x."FloatValue", + x."NullableFloatValue", + x."ShortValue", + x."NullableShortValue", + x."ByteValue", + x."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY x."Timestamp"), + ROW_NUMBER() OVER (ORDER BY x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY x."Value" DESC), + ROW_NUMBER() OVER (ORDER BY x."Timestamp", x."Value"), + ROW_NUMBER() OVER (ORDER BY x."Timestamp" DESC, x."Value" DESC) +FROM + "WindowFunctionTestEntity" x +ORDER BY + x."Id" + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.18).sql new file mode 100644 index 000000000000..8cec0fd872f7 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(PostgreSQL.18).sql @@ -0,0 +1,15 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM(t."IntValue") OVER (ORDER BY t."Id" ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.18).sql new file mode 100644 index 000000000000..3bb8795b5732 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.18).sql new file mode 100644 index 000000000000..3bb8795b5732 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(PostgreSQL.18).sql @@ -0,0 +1,20 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableIntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."LongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableLongValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDoubleValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."DecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableDecimalValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."FloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableFloatValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ShortValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableShortValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."ByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id"), + SUM(t."NullableByteValue"::Int) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.18).sql new file mode 100644 index 000000000000..c986447c30f1 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(PostgreSQL.18).sql @@ -0,0 +1,7 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + SUM(t."IntValue") FILTER (WHERE t."CategoryId" = 1) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id") +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.18).sql new file mode 100644 index 000000000000..76d096c37d00 --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(PostgreSQL.18).sql @@ -0,0 +1,8 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + NTH_VALUE(t."IntValue", 2) OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + "WindowFunctionTestEntity" t + diff --git a/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.18).sql b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.18).sql new file mode 100644 index 000000000000..cfbbf8f18c5d --- /dev/null +++ b/PostgreSQL.18/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(PostgreSQL.18).sql @@ -0,0 +1,10 @@ +-- PostgreSQL.18 PostgreSQL + +SELECT + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE(t."IntValue") OVER (PARTITION BY t."CategoryId" ORDER BY t."Id" ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + "WindowFunctionTestEntity" t + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..6822f467dbb2 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPM).sql @@ -0,0 +1,34 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CASE + WHEN [t].[IntValue] > 20 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN [t].[DoubleValue] > 15 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(CASE + WHEN [t].[IntValue] < 80 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..39ea5bb978a7 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPM).sql @@ -0,0 +1,11 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..a321bcd3cea7 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..9d5c37a5f4b6 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..9d5c37a5f4b6 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..3a633c694f58 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + AVG(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..850f7c6b5454 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..763a44272833 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..a719a9983bfa --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..ae2a6fc79322 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..121e08d1bebd --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b01e6820c92a --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..d412736fc4da --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..1c71ca0b49fe --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..f1d21ed698f3 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..8e174eb7209d --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPM).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..48db67ef6658 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b6fc9db58435 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..e18db21fc95d --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..ff5a9efcdb4e --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..0b333e09b8a7 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b36557a5f77c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b36557a5f77c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..60d2f9ffa85d --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..deaacb08d8c2 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..0a3bc5f26275 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..1d25a0abd146 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..99cd492a965e --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPM).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..2386e77e6556 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..d90cca38072e --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..26139576c98f --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..7fa613e85d8b --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..4a2ac3a42d90 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPM).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..4cf346c476b2 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..3cd915682528 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..5e4b094facb7 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPM).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..ef58411b53c5 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..f75234a0f8cc --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..2c493efba55c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..db437fa1fed7 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..8647e16c914c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..8647e16c914c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..9cc3a2d08f43 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..2863cc1cd962 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPM).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..c5c014eaaf1f --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..a4f33da12c46 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..de903bed2115 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..f6d201c90438 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..826ff89ab7fa --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..de903bed2115 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..5b9c1620055c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..5b9c1620055c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..232b53596d77 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..232b53596d77 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..00c63cc4600a --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPM).sql @@ -0,0 +1,14 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..8e75699ff7cf --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b79ab90c81b4 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..40e7ee689031 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..7514a9abb4af --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..d4cb0d1cac12 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..5cc4199c29d4 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..5cc4199c29d4 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..295b48349b9f --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..6e44bf3be86a --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..409a2df40757 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..ad9e6963e14c --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..3fec7371ec14 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPM).sql @@ -0,0 +1,9 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..ddb960d8a0f0 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..285c2aed8010 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..2959426e57e0 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..e2632db48bfc --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..b80209ecb172 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..3af801c2735f --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..1f1933e44628 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPM).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..f0fa9cab2e8a --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPM).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..33cfcfa20554 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPM).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..582f21bf54ff --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..582f21bf54ff --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPM).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..37c2bcb22363 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..2ae46d3069af --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPM).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPM).sql b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPM).sql new file mode 100644 index 000000000000..a707618f3907 --- /dev/null +++ b/SQLite.Classic.MPM/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPM).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPM SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..3c4a51a47f5e --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic.MPU).sql @@ -0,0 +1,34 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CASE + WHEN [t].[IntValue] > 20 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN [t].[DoubleValue] > 15 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(CASE + WHEN [t].[IntValue] < 80 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..bad0883154c5 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic.MPU).sql @@ -0,0 +1,11 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..eddc9eafc0db --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ea5138c8a02d --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ea5138c8a02d --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..826dc3e5cf1a --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + AVG(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..1b261c0c09ee --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..bbe99b737202 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..d6409da16691 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..db6f2e9c18e7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..eae2f800e472 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..91f3f6f0af73 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..aca68ee0612f --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a1d0ada5fe77 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..fed2f7ab708b --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..7b02d0f96dc5 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic.MPU).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..c113006b5781 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..e301e06b91e9 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..aec797786b28 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..052c09b18868 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..e56bf1124914 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..c70e746293db --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..c70e746293db --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..63d058140126 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a3f378dc6d60 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..eaa646e89d3f --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..afb546efdcbe --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..31a47cda7cdb --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic.MPU).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a16cd5be69f9 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..baa111afe231 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..0898f3577371 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..5b073dad865a --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..d589930c601f --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic.MPU).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..2e6277e8b3c6 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..032856f32ef3 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..52a42ed9cb7c --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic.MPU).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ddeeaf4cd0f0 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..4ea561151818 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..e4e64c0e0771 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ea00eefebf17 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..d8b88151442a --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..d8b88151442a --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..b554b183e5f9 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..6eb36f377e39 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic.MPU).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..bddc95c0c630 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..416e02391102 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..fe60df22373c --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..5fce89938523 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..da5d4a7d1aa7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..fe60df22373c --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f7608c9df9e4 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f7608c9df9e4 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f71edc9dbe01 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f71edc9dbe01 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ebfc2d3de96c --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic.MPU).sql @@ -0,0 +1,14 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..0ae8d0a30e04 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..80444e10b017 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..bf81196a47f7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..2233be9e71f7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..3e69d17fc177 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..60631460d2c7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..60631460d2c7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..dafe242c3040 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..0d1986520ee3 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f920ee25f62e --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a7cb8a999ee7 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..35dd3d9f93d6 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic.MPU).sql @@ -0,0 +1,9 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..286877fd27da --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..aea83ccd04f0 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..dea05d030b03 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..47efc01ec315 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..c1ebe3c00dac --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..f0e78a808ace --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..2f70ca9dc2aa --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic.MPU).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..c0da987cbf03 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic.MPU).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..88daac93fc24 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic.MPU).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a005928235cd --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..a005928235cd --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic.MPU).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..7806f42d260c --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..ff6786855b04 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic.MPU).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPU).sql b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPU).sql new file mode 100644 index 000000000000..5d8cbea26e19 --- /dev/null +++ b/SQLite.Classic.MPU/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic.MPU).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic.MPU SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic).sql new file mode 100644 index 000000000000..6e49433d0c80 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.Classic).sql @@ -0,0 +1,34 @@ +-- SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CASE + WHEN [t].[IntValue] > 20 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN [t].[DoubleValue] > 15 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(CASE + WHEN [t].[IntValue] < 80 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic).sql new file mode 100644 index 000000000000..4cdfb294c16e --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.Classic).sql @@ -0,0 +1,11 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic).sql new file mode 100644 index 000000000000..1785e75dc446 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic).sql new file mode 100644 index 000000000000..eebca0310d43 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..eebca0310d43 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic).sql new file mode 100644 index 000000000000..24d82f2b3780 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + AVG(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic).sql new file mode 100644 index 000000000000..045f05638897 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic).sql new file mode 100644 index 000000000000..ee7aae935cbc --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic).sql new file mode 100644 index 000000000000..c5f6b3ad64af --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..28b2a94fba01 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic).sql new file mode 100644 index 000000000000..a1c9d2087892 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..5e2bb72e98d0 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..ba29c88eca5a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..d7b4ea7a58e0 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..c41cccd1afe6 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic).sql new file mode 100644 index 000000000000..f1b80f5d565d --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.Classic).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic).sql new file mode 100644 index 000000000000..3480aa8728da --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..8f7022e1521f --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..2318ca2adf35 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..3b8e9f00a770 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..c6997d32ed1e --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic).sql new file mode 100644 index 000000000000..e48ee66676b9 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..e48ee66676b9 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic).sql new file mode 100644 index 000000000000..fa21030ae284 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic).sql new file mode 100644 index 000000000000..14a7c8d68c36 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic).sql new file mode 100644 index 000000000000..df8b296ad1ed --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic).sql new file mode 100644 index 000000000000..281b16e720f1 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic).sql new file mode 100644 index 000000000000..e215c19c461a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.Classic).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic).sql new file mode 100644 index 000000000000..83e397cbc257 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic).sql new file mode 100644 index 000000000000..676f67df683a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic).sql new file mode 100644 index 000000000000..d27860d365fb --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic).sql new file mode 100644 index 000000000000..f9fbb0a3e94b --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic).sql new file mode 100644 index 000000000000..952692d01bcc --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.Classic).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic).sql new file mode 100644 index 000000000000..fe4426bf2d9e --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic).sql new file mode 100644 index 000000000000..a8c45ebef87f --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic).sql new file mode 100644 index 000000000000..6abae30eab77 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.Classic).sql @@ -0,0 +1,7 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic).sql new file mode 100644 index 000000000000..6048cd00abcd --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic).sql new file mode 100644 index 000000000000..d4a7486eb23a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic).sql new file mode 100644 index 000000000000..10e47c1d76aa --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..47f8ef86bb24 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic).sql new file mode 100644 index 000000000000..20b678036d89 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..20b678036d89 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic).sql new file mode 100644 index 000000000000..002d3ce904c7 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic).sql new file mode 100644 index 000000000000..ea352a0d6c36 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.Classic).sql @@ -0,0 +1,12 @@ +-- SQLite.Classic SQLite + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic).sql new file mode 100644 index 000000000000..edd85e348aaf --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic).sql new file mode 100644 index 000000000000..05a797d9f688 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..29c994626b0a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic).sql new file mode 100644 index 000000000000..71186d3df127 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic).sql new file mode 100644 index 000000000000..e4dfcea888b0 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..29c994626b0a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic).sql new file mode 100644 index 000000000000..28509ffedb14 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..28509ffedb14 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic).sql new file mode 100644 index 000000000000..1eef83665c9f --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..1eef83665c9f --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic).sql new file mode 100644 index 000000000000..6249e043a25a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.Classic).sql @@ -0,0 +1,14 @@ +-- SQLite.Classic SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..fd02cb224ed4 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..29d32dd446cd --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..523e5b418b97 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..8705007e74f6 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic).sql new file mode 100644 index 000000000000..f7d9b3a60b49 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..9434ecd822ea --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic).sql new file mode 100644 index 000000000000..9434ecd822ea --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..43c9a2d6488a --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..edeec0ddcdca --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..a5a2ea6c1548 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..ef4f0d20032d --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic).sql new file mode 100644 index 000000000000..1b37078b7785 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.Classic).sql @@ -0,0 +1,9 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..77030fe31ea2 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..e0621b601b9f --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..294a8c7d4ce3 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..ac61796cb1da --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic).sql new file mode 100644 index 000000000000..2c6e7bff93f9 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..637e12607c23 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic).sql new file mode 100644 index 000000000000..0cb61cc459e6 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.Classic).sql @@ -0,0 +1,35 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic).sql new file mode 100644 index 000000000000..17498a136bb7 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.Classic).sql @@ -0,0 +1,33 @@ +-- SQLite.Classic SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic).sql new file mode 100644 index 000000000000..4f2e2e8b1f89 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.Classic).sql @@ -0,0 +1,15 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic).sql new file mode 100644 index 000000000000..feeeb969c7cd --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic).sql new file mode 100644 index 000000000000..feeeb969c7cd --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.Classic).sql @@ -0,0 +1,20 @@ +-- SQLite.Classic SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic).sql new file mode 100644 index 000000000000..46272cc486cf --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic).sql new file mode 100644 index 000000000000..0a5f85810be7 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.Classic).sql @@ -0,0 +1,8 @@ +-- SQLite.Classic SQLite + +SELECT + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic).sql b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic).sql new file mode 100644 index 000000000000..d68f7ac80fe4 --- /dev/null +++ b/SQLite.Classic/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.Classic).sql @@ -0,0 +1,10 @@ +-- SQLite.Classic SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.MS).sql new file mode 100644 index 000000000000..88a4fa24f4ab --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SQLite.MS).sql @@ -0,0 +1,34 @@ +-- SQLite.MS SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CASE + WHEN [t].[IntValue] > 20 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(CASE + WHEN [t].[DoubleValue] > 15 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(CASE + WHEN [t].[IntValue] > 10 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(CASE + WHEN [t].[IntValue] < 80 THEN [t].[IntValue] + ELSE NULL + END) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.MS).sql new file mode 100644 index 000000000000..e7f9bde47bc6 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SQLite.MS).sql @@ -0,0 +1,11 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.MS).sql new file mode 100644 index 000000000000..e2ce7fea5b5e --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrameExclude(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.MS).sql new file mode 100644 index 000000000000..e86c9eb1389c --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.MS).sql new file mode 100644 index 000000000000..e86c9eb1389c --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.MS).sql new file mode 100644 index 000000000000..e5473c4290af --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + AVG(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[DoubleValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.MS).sql new file mode 100644 index 000000000000..3ce1f8bdfa3f --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.MS).sql new file mode 100644 index 000000000000..85323fb2c056 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.MS).sql new file mode 100644 index 000000000000..f4a2adfeb02d --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..ce9c2c24c774 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.MS).sql new file mode 100644 index 000000000000..7e9a28064360 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + COUNT(CASE + WHEN [t].[IntValue] > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..071460a1ac49 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..2654a5a49fc9 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..84c1affa09b9 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..1323424c4bcf --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.MS).sql new file mode 100644 index 000000000000..b6f5066f70d8 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SQLite.MS).sql @@ -0,0 +1,15 @@ +-- SQLite.MS SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.MS).sql new file mode 100644 index 000000000000..eab21cf9bc69 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..b739c300ca38 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..6fa480652497 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..924926777998 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..a894192ce484 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.MS).sql new file mode 100644 index 000000000000..d103e98a54c0 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..d103e98a54c0 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.MS).sql new file mode 100644 index 000000000000..9d787f2ed35c --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.MS).sql new file mode 100644 index 000000000000..bb15dfc99f36 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionGroups(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.MS).sql new file mode 100644 index 000000000000..687904f6d606 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRange(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.MS).sql new file mode 100644 index 000000000000..c0bed80dbb69 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameExclusionRows(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.MS).sql new file mode 100644 index 000000000000..d74bbf2e4921 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroups(SQLite.MS).sql @@ -0,0 +1,12 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.MS).sql new file mode 100644 index 000000000000..fcf1ace07db1 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameGroupsExclude(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] GROUPS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.MS).sql new file mode 100644 index 000000000000..4068831f1d42 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeExclude(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.MS).sql new file mode 100644 index 000000000000..76c08dd86cf3 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.MS).sql new file mode 100644 index 000000000000..e843867ea86a --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeValue(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.MS).sql new file mode 100644 index 000000000000..7186fa30c685 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SQLite.MS).sql @@ -0,0 +1,12 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.MS).sql new file mode 100644 index 000000000000..106014dbf041 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeCurrentRow(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.MS).sql new file mode 100644 index 000000000000..d21ec3ffae54 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeGroup(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE GROUP) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.MS).sql new file mode 100644 index 000000000000..6384c283234f --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRowsExcludeTies(SQLite.MS).sql @@ -0,0 +1,7 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE TIES) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.MS).sql new file mode 100644 index 000000000000..3f7899cdd0ce --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.MS).sql new file mode 100644 index 000000000000..4968d165da8c --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.MS).sql new file mode 100644 index 000000000000..037a88f77ba9 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.MS).sql new file mode 100644 index 000000000000..72795f0ffae6 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.MS).sql new file mode 100644 index 000000000000..b98d782ba065 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..b98d782ba065 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.MS).sql new file mode 100644 index 000000000000..3057806461c7 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.MS).sql new file mode 100644 index 000000000000..fc95c3354fd8 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SQLite.MS).sql @@ -0,0 +1,12 @@ +-- SQLite.MS SQLite + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.MS).sql new file mode 100644 index 000000000000..0e55d5bd54b5 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.MS).sql new file mode 100644 index 000000000000..0623707f95a3 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..32768bcf36ad --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.MS).sql new file mode 100644 index 000000000000..b7f6804587b7 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.MS).sql new file mode 100644 index 000000000000..ed6b84e1780e --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.MS).sql new file mode 100644 index 000000000000..32768bcf36ad --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.MS).sql new file mode 100644 index 000000000000..1ad0aeed4fcf --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.MS).sql new file mode 100644 index 000000000000..1ad0aeed4fcf --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.MS).sql new file mode 100644 index 000000000000..2cfd4b3f80a6 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.MS).sql new file mode 100644 index 000000000000..2cfd4b3f80a6 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.MS).sql new file mode 100644 index 000000000000..f2574b15444a --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SQLite.MS).sql @@ -0,0 +1,14 @@ +-- SQLite.MS SQLite + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..dcb150b246e4 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..62fc002ec9a6 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..88d3b7e0e479 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..d1f59d92da08 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.MS).sql new file mode 100644 index 000000000000..8234a9da2250 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..0f7b712d5649 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.MS).sql new file mode 100644 index 000000000000..0f7b712d5649 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueWithFrame(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + [t].[Id], + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..b8564512b204 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..1242b4b202d8 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..8c38c8875f5a --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..988dccd0c611 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.MS).sql new file mode 100644 index 000000000000..d1b2c0d2d8c5 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SQLite.MS).sql @@ -0,0 +1,9 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..c8deeebfb0bb --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..2f2c7be24548 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..830a2456fc1f --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..d7315bdc43e7 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.MS).sql new file mode 100644 index 000000000000..2d246598badb --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql new file mode 100644 index 000000000000..6624f063405e --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.MS).sql new file mode 100644 index 000000000000..0972501b9969 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SQLite.MS).sql @@ -0,0 +1,35 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.MS).sql new file mode 100644 index 000000000000..ed8355548ec3 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SQLite.MS).sql @@ -0,0 +1,33 @@ +-- SQLite.MS SQLite + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.MS).sql new file mode 100644 index 000000000000..e0d2274cbd07 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SQLite.MS).sql @@ -0,0 +1,15 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.MS).sql new file mode 100644 index 000000000000..92fd1fa47a31 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.MS).sql new file mode 100644 index 000000000000..92fd1fa47a31 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SQLite.MS).sql @@ -0,0 +1,20 @@ +-- SQLite.MS SQLite + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS INTEGER)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.MS).sql new file mode 100644 index 000000000000..78caa6b03a0a --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + SUM(CASE + WHEN [t].[CategoryId] = 1 THEN [t].[IntValue] + ELSE NULL + END) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.MS).sql new file mode 100644 index 000000000000..923d00ae47ad --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrameExclude(SQLite.MS).sql @@ -0,0 +1,8 @@ +-- SQLite.MS SQLite + +SELECT + NTH_VALUE([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING EXCLUDE CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.MS).sql b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.MS).sql new file mode 100644 index 000000000000..a40b856218f0 --- /dev/null +++ b/SQLite.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SQLite.MS).sql @@ -0,0 +1,10 @@ +-- SQLite.MS SQLite + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SapHana.Odbc).sql new file mode 100644 index 000000000000..a7183f45ae5a --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..a7183f45ae5a --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + AVG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SapHana.Odbc).sql new file mode 100644 index 000000000000..52d9e0d88b00 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SapHana.Odbc).sql @@ -0,0 +1,10 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + AVG(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."DoubleValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SapHana.Odbc).sql new file mode 100644 index 000000000000..2bdea3fee5f8 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SapHana.Odbc).sql new file mode 100644 index 000000000000..dfd39f775035 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SapHana.Odbc).sql @@ -0,0 +1,7 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + COUNT("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..c35b16e3d8cc --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,7 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SapHana.Odbc).sql new file mode 100644 index 000000000000..ed47c996901c --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SapHana.Odbc).sql @@ -0,0 +1,10 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + COUNT(CASE + WHEN "t"."IntValue" > 20 THEN 1 + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..e9b6a41a7540 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..1b00fc8ff282 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..f47d1a621a85 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + CUME_DIST() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..75db7afc2f8d --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + CUME_DIST() OVER (ORDER BY "x"."Timestamp"), + CUME_DIST() OVER (ORDER BY "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC), + CUME_DIST() OVER (ORDER BY "x"."Value" DESC), + CUME_DIST() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + CUME_DIST() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SapHana.Odbc).sql new file mode 100644 index 000000000000..2c24adda0635 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SapHana.Odbc).sql @@ -0,0 +1,15 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + ROW_NUMBER() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + RANK() OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + AVG("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + COUNT(*) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..34dc1d00e640 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..7e015ca2afa1 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..dcd4d465c5fa --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + DENSE_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..1964e8cf14cb --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + DENSE_RANK() OVER (ORDER BY "x"."Timestamp"), + DENSE_RANK() OVER (ORDER BY "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Value" DESC), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + DENSE_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SapHana.Odbc).sql new file mode 100644 index 000000000000..c9ca2fd021b8 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..c9ca2fd021b8 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + FIRST_VALUE("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SapHana.Odbc).sql new file mode 100644 index 000000000000..be503d768262 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SapHana.Odbc).sql new file mode 100644 index 000000000000..1a73f3caf270 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LAG("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SapHana.Odbc).sql new file mode 100644 index 000000000000..4fe1ffb3c6dc --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LAG("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..b1a24ae53a81 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SapHana.Odbc).sql new file mode 100644 index 000000000000..62a296357db9 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SapHana.Odbc).sql @@ -0,0 +1,12 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LEAD("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + LAG("t"."IntValue", 2, 0) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SapHana.Odbc).sql new file mode 100644 index 000000000000..77e74ebbda23 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SapHana.Odbc).sql @@ -0,0 +1,10 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + LEAD("t"."DoubleValue") OVER (ORDER BY "t"."Id"), + LAG("t"."DecimalValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."NullableIntValue") OVER (ORDER BY "t"."Id"), + LEAD("t"."IntValue") OVER (ORDER BY "t"."CategoryId", "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SapHana.Odbc).sql new file mode 100644 index 000000000000..ebe7c4d03ab1 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..90e9dcb800bd --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SapHana.Odbc).sql new file mode 100644 index 000000000000..3e73426068a9 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SapHana.Odbc).sql new file mode 100644 index 000000000000..4ef62f7bcffb --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LEAD("t"."IntValue", 2, 0) OVER (ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..90e9dcb800bd --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + LEAD("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SapHana.Odbc).sql new file mode 100644 index 000000000000..2868487892a1 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..2868487892a1 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + MAX("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MAX("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SapHana.Odbc).sql new file mode 100644 index 000000000000..baa5a718e6a9 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..baa5a718e6a9 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + MIN("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."ByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + MIN("t"."NullableByteValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..1cceff30d777 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..f0ddcb3f0c3c --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..79f3145c8c68 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + NTILE(4) OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..34c594387f99 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + NTILE(4) OVER (ORDER BY "x"."Timestamp"), + NTILE(4) OVER (ORDER BY "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC), + NTILE(4) OVER (ORDER BY "x"."Value" DESC), + NTILE(4) OVER (ORDER BY "x"."Timestamp", "x"."Value"), + NTILE(4) OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SapHana.Odbc).sql new file mode 100644 index 000000000000..80011247f68b --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NthValueBasic(SapHana.Odbc).sql @@ -0,0 +1,8 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "t"."Id", + NTH_VALUE("t"."IntValue", 2) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..3c8e71a23e2e --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..171504abc374 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..27e99a1c5abb --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + PERCENT_RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..657b18328dae --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp"), + PERCENT_RANK() OVER (ORDER BY "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Value" DESC), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + PERCENT_RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..d9c66e69969f --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..de484326ab04 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..005b298512a0 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + RANK() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..a6f8fd9481e2 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + RANK() OVER (ORDER BY "x"."Timestamp"), + RANK() OVER (ORDER BY "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC), + RANK() OVER (ORDER BY "x"."Value" DESC), + RANK() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + RANK() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SapHana.Odbc).sql new file mode 100644 index 000000000000..b99c0d0cbc1b --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..fd6f0f9ce744 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId", "x"."Name" ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SapHana.Odbc).sql new file mode 100644 index 000000000000..5a1aa99461af --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SapHana.Odbc).sql @@ -0,0 +1,35 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 0 + ELSE 1 + END, "x"."Timestamp"), + ROW_NUMBER() OVER (PARTITION BY "x"."CategoryId" ORDER BY CASE + WHEN "x"."Timestamp" IS NULL THEN 1 + ELSE 0 + END, "x"."Timestamp" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SapHana.Odbc).sql new file mode 100644 index 000000000000..23703df66816 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SapHana.Odbc).sql @@ -0,0 +1,33 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + "x"."Id", + "x"."Name", + "x"."CategoryId", + "x"."Value", + "x"."Timestamp", + "x"."IntValue", + "x"."NullableIntValue", + "x"."LongValue", + "x"."NullableLongValue", + "x"."DoubleValue", + "x"."NullableDoubleValue", + "x"."DecimalValue", + "x"."NullableDecimalValue", + "x"."FloatValue", + "x"."NullableFloatValue", + "x"."ShortValue", + "x"."NullableShortValue", + "x"."ByteValue", + "x"."NullableByteValue", + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp"), + ROW_NUMBER() OVER (ORDER BY "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Value" DESC), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp", "x"."Value"), + ROW_NUMBER() OVER (ORDER BY "x"."Timestamp" DESC, "x"."Value" DESC) +FROM + "WindowFunctionTestEntity" "x" +ORDER BY + "x"."Id" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SapHana.Odbc).sql new file mode 100644 index 000000000000..3f006e0357ac --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SapHana.Odbc).sql new file mode 100644 index 000000000000..3f006e0357ac --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SapHana.Odbc).sql @@ -0,0 +1,20 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + SUM("t"."IntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableIntValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."LongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableLongValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDoubleValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."DecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableDecimalValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."FloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."NullableFloatValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM("t"."ShortValue") OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableShortValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."ByteValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id"), + SUM(CAST("t"."NullableByteValue" AS Integer)) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SapHana.Odbc).sql b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SapHana.Odbc).sql new file mode 100644 index 000000000000..345fe2765889 --- /dev/null +++ b/SapHana.Odbc/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SapHana.Odbc).sql @@ -0,0 +1,10 @@ +-- SapHana.Odbc SapHanaOdbc + +SELECT + SUM(CASE + WHEN "t"."CategoryId" = 1 THEN "t"."IntValue" + ELSE NULL + END) OVER (PARTITION BY "t"."CategoryId" ORDER BY "t"."Id") +FROM + "WindowFunctionTestEntity" "t" + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..bb03a254c516 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..9ec49be76dfc --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..8916375b9481 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..4fffdc159482 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..e0751d0a6e6a --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..fd50bf59c9a7 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..a549ee41cc15 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..9fe6727c868f --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..7206243b95df --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..3737889d8f85 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..d9ef790921fb --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..43e6ec1e6835 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..f122d39b845b --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..7dc3847195c4 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..3a8ec30ac7cf --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005.MS).sql b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005.MS).sql new file mode 100644 index 000000000000..d8f3f6c44042 --- /dev/null +++ b/SqlServer.2005.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005.MS SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005).sql new file mode 100644 index 000000000000..75dfa22ad9b3 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql new file mode 100644 index 000000000000..f3fe2808cb1c --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005).sql new file mode 100644 index 000000000000..e4bddfdcd26c --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2005).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005).sql new file mode 100644 index 000000000000..d474272ae75b --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005).sql new file mode 100644 index 000000000000..80ba74a089bf --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql new file mode 100644 index 000000000000..ea5555ab776e --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005).sql new file mode 100644 index 000000000000..388884429769 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2005).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005).sql new file mode 100644 index 000000000000..028566c6bb19 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005).sql new file mode 100644 index 000000000000..7547266f076e --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql new file mode 100644 index 000000000000..685a1fbc3690 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005).sql new file mode 100644 index 000000000000..45999c749e1c --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2005).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005).sql new file mode 100644 index 000000000000..3a4b9a58ed48 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005).sql new file mode 100644 index 000000000000..388ae47156bb --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql new file mode 100644 index 000000000000..3c257861ddaa --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005).sql new file mode 100644 index 000000000000..60b01cb77efc --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2005).sql @@ -0,0 +1,35 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005).sql b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005).sql new file mode 100644 index 000000000000..14fc58ba26b6 --- /dev/null +++ b/SqlServer.2005/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2005).sql @@ -0,0 +1,33 @@ +-- SqlServer.2005 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..65d68bcadbf6 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..4458033fbaf2 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..dfb7e8738a1e --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..409965a8a10a --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..c9976bf02796 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..df7b0204a7c1 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..3c76049459d7 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..9a8f565c6b47 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..b6ef9d0f24c4 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..1c74ce3ff46d --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..b258193b165a --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..de722c5f9b4d --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..59e7c2861e27 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..df103c501824 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..5fef7a37df25 --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008.MS).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008.MS).sql b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008.MS).sql new file mode 100644 index 000000000000..85c62d48487c --- /dev/null +++ b/SqlServer.2008.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008.MS SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008).sql new file mode 100644 index 000000000000..f5d90779853b --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql new file mode 100644 index 000000000000..b9a54e25bd10 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008).sql new file mode 100644 index 000000000000..4c7180045761 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2008).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008).sql new file mode 100644 index 000000000000..01321f13a34e --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008).sql new file mode 100644 index 000000000000..c16ecdb92f8d --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql new file mode 100644 index 000000000000..f9df80e7f382 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008).sql new file mode 100644 index 000000000000..16e879f95702 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2008).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008).sql new file mode 100644 index 000000000000..3fb6359364e0 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008).sql new file mode 100644 index 000000000000..0b3b4cc23df0 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql new file mode 100644 index 000000000000..466a61d1f3fa --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008).sql new file mode 100644 index 000000000000..4b74dafdfb1b --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2008).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008).sql new file mode 100644 index 000000000000..37466403cf49 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008).sql new file mode 100644 index 000000000000..b1df0596dd5d --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql new file mode 100644 index 000000000000..929a95e2041d --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008).sql new file mode 100644 index 000000000000..0d691f080a96 --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2008).sql @@ -0,0 +1,35 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 0 + ELSE 1 + END, [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY CASE + WHEN [x].[Timestamp] IS NULL THEN 1 + ELSE 0 + END, [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008).sql b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008).sql new file mode 100644 index 000000000000..4a614b8b93cc --- /dev/null +++ b/SqlServer.2008/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2008).sql @@ -0,0 +1,33 @@ +-- SqlServer.2008 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..e7459c3b7ec2 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..9e96d11f51ca --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..0fccb93aed5d --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..0fccb93aed5d --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..9f0dbcfc6ab7 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..bc6ae49afa4e --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..c861f323e5a1 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..921b62fa56d8 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..0717cdb2ab56 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..236de0f7cae1 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..aa9ef66a5816 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..62ec5e43534b --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..f7b0c4bf8918 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..2e8fca2ee28b --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..a673587ffffe --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..8a9bec6e2791 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..bfb0ea55df84 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..3de808fcefa8 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..24ab8c8b0587 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..f61b60856631 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4e8bb6b9d5ed --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4e8bb6b9d5ed --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..5b0e4585600c --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..87104e6a52cf --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..cdf39d45fc97 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..c621b7b33a9a --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..47f48633a0a5 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..1ac49eea7129 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..0ba84e437703 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..ee66f559832f --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..ee66f559832f --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..f7ee595b033d --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..827be4c59599 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..e0da6bc7e1b5 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..64a87bffebb0 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..a2b1367bddf9 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..b009a74b20ae --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4dc3a05e5fee --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..a2b1367bddf9 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..b388e7748fd0 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..b388e7748fd0 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..1bdbfcffab3e --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..1bdbfcffab3e --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4af01a976c74 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..680787dfaddf --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..1f2723d8ef26 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..2f76fbb2f7af --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..59deb1f8b0f2 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..25a89e98152f --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..3b9d60b88526 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..31275d662bc8 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..1da6798fc47c --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..7311761bd36f --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4e9f028e9e66 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..9099cf49652c --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..2358aea9d588 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..fae265445dcb --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..54b92b75f7ac --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..998f577fbf19 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..77bee0a86894 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..4ffd28a0f268 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..2426d844e197 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..b4bb1173e6ea --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..b4bb1173e6ea --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..71a42bba3205 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012.MS).sql b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012.MS).sql new file mode 100644 index 000000000000..d2186939c069 --- /dev/null +++ b/SqlServer.2012.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012.MS SqlServer.2012 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012).sql new file mode 100644 index 000000000000..ef26e761ccc6 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2012).sql @@ -0,0 +1,13 @@ +-- SqlServer.2012 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012).sql new file mode 100644 index 000000000000..b06793f34e81 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2012).sql @@ -0,0 +1,11 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012).sql new file mode 100644 index 000000000000..17506bc63d0d --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..17506bc63d0d --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012).sql new file mode 100644 index 000000000000..64bb3093ec51 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012).sql new file mode 100644 index 000000000000..916064a070cc --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012).sql new file mode 100644 index 000000000000..66d7dd3a58c7 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012).sql new file mode 100644 index 000000000000..29ca9aeed7ac --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..7c6e44c868c6 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012).sql new file mode 100644 index 000000000000..30c655cf9910 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..f36f26cbcad9 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..7de1ea4d814a --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..0eeb4e1268d8 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..35f307c64a68 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012).sql new file mode 100644 index 000000000000..17797fe5337a --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2012).sql @@ -0,0 +1,15 @@ +-- SqlServer.2012 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012).sql new file mode 100644 index 000000000000..5032ef9b94ec --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..60ffccf17fef --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..4cbd856ea8c5 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..d29cdead530e --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..9da570f79907 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012).sql new file mode 100644 index 000000000000..2fd7b67c2b9c --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..2fd7b67c2b9c --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012).sql new file mode 100644 index 000000000000..80dc2e639dd5 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012).sql new file mode 100644 index 000000000000..eadc354abb22 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2012).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012).sql new file mode 100644 index 000000000000..217eb026d8dc --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2012).sql @@ -0,0 +1,12 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012).sql new file mode 100644 index 000000000000..639e1696492e --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012).sql new file mode 100644 index 000000000000..c342e712c3c8 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012).sql new file mode 100644 index 000000000000..3a92cf4f33ec --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..5cbef0c2ae2d --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012).sql new file mode 100644 index 000000000000..895277bf47c4 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..895277bf47c4 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012).sql new file mode 100644 index 000000000000..0569f2db7e21 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012).sql new file mode 100644 index 000000000000..d54b1100be58 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2012).sql @@ -0,0 +1,12 @@ +-- SqlServer.2012 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012).sql new file mode 100644 index 000000000000..fba4a24de6de --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2012).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012).sql new file mode 100644 index 000000000000..ed59dee17362 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..c599cd639156 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012).sql new file mode 100644 index 000000000000..f933e2134202 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012).sql new file mode 100644 index 000000000000..361010d48cc5 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..c599cd639156 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2012).sql @@ -0,0 +1,8 @@ +-- SqlServer.2012 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012).sql new file mode 100644 index 000000000000..da6ffd1445c0 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..da6ffd1445c0 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012).sql new file mode 100644 index 000000000000..3d9f340a10a4 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..3d9f340a10a4 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012).sql new file mode 100644 index 000000000000..44f03df7a6bf --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2012).sql @@ -0,0 +1,14 @@ +-- SqlServer.2012 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..894e98c82aba --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..0d4cc1b3e147 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..e9b251344d87 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..50c99a8af72e --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..91d452e67aab --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..ca3a7e33a7cf --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..8e9395c7ba7b --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..95394d98df30 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012).sql new file mode 100644 index 000000000000..4c3a478a0384 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2012).sql @@ -0,0 +1,9 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..5f3a4df078da --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..3a6dca954535 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..8225cf8724a0 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..e6720fde8245 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012).sql new file mode 100644 index 000000000000..46b957f29420 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..7de2e01a1cad --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012).sql new file mode 100644 index 000000000000..807954253546 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2012).sql @@ -0,0 +1,29 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012).sql new file mode 100644 index 000000000000..864472c0d3e5 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2012).sql @@ -0,0 +1,33 @@ +-- SqlServer.2012 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012).sql new file mode 100644 index 000000000000..b3c66210d809 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2012).sql @@ -0,0 +1,15 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012).sql new file mode 100644 index 000000000000..d97a40a57a1e --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012).sql new file mode 100644 index 000000000000..d97a40a57a1e --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2012).sql @@ -0,0 +1,20 @@ +-- SqlServer.2012 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012).sql new file mode 100644 index 000000000000..be291d810786 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2012).sql @@ -0,0 +1,7 @@ +-- SqlServer.2012 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012).sql b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012).sql new file mode 100644 index 000000000000..9c39d2835ff3 --- /dev/null +++ b/SqlServer.2012/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2012).sql @@ -0,0 +1,10 @@ +-- SqlServer.2012 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b83599d32571 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..d5b4278469ca --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c1fe9611d161 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c1fe9611d161 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..98c982843ce1 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f752d47bffae --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..23996f98432b --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..917dc500b6b9 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c94531b01489 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f88e9a257dda --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..abedc1dfe3e9 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..ef7676450c7d --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..4851a13a5731 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b31ccf66debd --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..53f38c4d7362 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..592f78ccb427 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c884a6ac323b --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..9ade8e5cae5c --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..6018a4f792f9 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b66fa7fef816 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..1e4abeb67c80 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..1e4abeb67c80 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..3f610385d88f --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f3ace647d8d1 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..9feb76967333 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..e2f963e220dc --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..df6dcfd66406 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..e395bb647851 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b2fb516dc18f --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..97b5a9b9c8d6 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..97b5a9b9c8d6 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..8f1442399a33 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..895df64ded2c --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..88ac9e1e0ee6 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..7c858fd3e44e --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..9e192f3e9f4b --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..9e88862534da --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c62b53313b78 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..9e192f3e9f4b --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..423606c7d6ed --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..423606c7d6ed --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..953d8ea7c6df --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..953d8ea7c6df --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..c513040c2c58 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..72a8a0f03cdd --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..eb2282a63b31 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..984541f48b4d --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..a92b4e5f8ddf --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b97d16594752 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..4fe521b7028c --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..0dd36d4a4ef4 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..22ddbe1562fa --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..b4327bc72ed1 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f47013f90267 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..658f63e2cc78 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..ca37b5c8293d --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f4cdeef06879 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..34b563d4c158 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..175c39ffea23 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..4643b3ba1aa1 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..32d3ad536ced --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..f58cf3f4d732 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..47ced9749c00 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..47ced9749c00 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..a7810d5946b0 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014.MS).sql b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014.MS).sql new file mode 100644 index 000000000000..6fb7a21f7a54 --- /dev/null +++ b/SqlServer.2014.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014.MS SqlServer.2014 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014).sql new file mode 100644 index 000000000000..07572d60b705 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2014).sql @@ -0,0 +1,13 @@ +-- SqlServer.2014 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014).sql new file mode 100644 index 000000000000..4cf27871a440 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2014).sql @@ -0,0 +1,11 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014).sql new file mode 100644 index 000000000000..1f14ba90e983 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..1f14ba90e983 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014).sql new file mode 100644 index 000000000000..e5b5db4fce89 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014).sql new file mode 100644 index 000000000000..31f6720cc3cb --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014).sql new file mode 100644 index 000000000000..873acf636f7e --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014).sql new file mode 100644 index 000000000000..496f07f6ec99 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..b41e611f15e7 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014).sql new file mode 100644 index 000000000000..3a7ee3679411 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..3716b716fcd4 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..17235a4777ff --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..9dc4729e6b78 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..35a96d37ee09 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014).sql new file mode 100644 index 000000000000..cd2d68876f34 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2014).sql @@ -0,0 +1,15 @@ +-- SqlServer.2014 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014).sql new file mode 100644 index 000000000000..fe6699d0a8b4 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..ed0588059312 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..0a5c60e30540 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..249be41cfc4f --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..91ed6ac6ea80 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014).sql new file mode 100644 index 000000000000..9883674f6a0b --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..9883674f6a0b --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014).sql new file mode 100644 index 000000000000..f5017a73d3f1 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014).sql new file mode 100644 index 000000000000..e589792d12e4 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2014).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014).sql new file mode 100644 index 000000000000..764e4e1831b9 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2014).sql @@ -0,0 +1,12 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014).sql new file mode 100644 index 000000000000..11eeee64405a --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014).sql new file mode 100644 index 000000000000..44fd8aa5a0dc --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014).sql new file mode 100644 index 000000000000..ad7c96bd1316 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..ad3a0d09c73a --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014).sql new file mode 100644 index 000000000000..abcb3806b604 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..abcb3806b604 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014).sql new file mode 100644 index 000000000000..c7f92f92371f --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014).sql new file mode 100644 index 000000000000..0c302ec24df2 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2014).sql @@ -0,0 +1,12 @@ +-- SqlServer.2014 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014).sql new file mode 100644 index 000000000000..dc32901d5acf --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2014).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014).sql new file mode 100644 index 000000000000..dfdfd98e492e --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..b3d1bef1b827 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014).sql new file mode 100644 index 000000000000..ed3f59ce7a62 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014).sql new file mode 100644 index 000000000000..f1d66ad26fe3 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..b3d1bef1b827 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2014).sql @@ -0,0 +1,8 @@ +-- SqlServer.2014 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014).sql new file mode 100644 index 000000000000..f3b92a5a07bd --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..f3b92a5a07bd --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014).sql new file mode 100644 index 000000000000..2093cab83b73 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..2093cab83b73 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014).sql new file mode 100644 index 000000000000..76c35c03fab4 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2014).sql @@ -0,0 +1,14 @@ +-- SqlServer.2014 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..2ce87baffc1e --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..671f11b042e0 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..bc447bb328a7 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..6635d5f41474 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..6efd5fd5ea49 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..e093efcf6e36 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..5644f8bb3b81 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..ac6076dc78bf --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014).sql new file mode 100644 index 000000000000..649327960c9b --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2014).sql @@ -0,0 +1,9 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..a0dd588ea24c --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..09203bae6618 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..350f55417950 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..8962f0e5dce6 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014).sql new file mode 100644 index 000000000000..52b9b200af25 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..1abe67e0fc42 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014).sql new file mode 100644 index 000000000000..241d1f4f64cf --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2014).sql @@ -0,0 +1,29 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014).sql new file mode 100644 index 000000000000..29135a3c26c9 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2014).sql @@ -0,0 +1,33 @@ +-- SqlServer.2014 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014).sql new file mode 100644 index 000000000000..360f7cf3060b --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2014).sql @@ -0,0 +1,15 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014).sql new file mode 100644 index 000000000000..ee496e4c18b2 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014).sql new file mode 100644 index 000000000000..ee496e4c18b2 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2014).sql @@ -0,0 +1,20 @@ +-- SqlServer.2014 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014).sql new file mode 100644 index 000000000000..698bac83b53c --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2014).sql @@ -0,0 +1,7 @@ +-- SqlServer.2014 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014).sql b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014).sql new file mode 100644 index 000000000000..a3ab78a735a0 --- /dev/null +++ b/SqlServer.2014/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2014).sql @@ -0,0 +1,10 @@ +-- SqlServer.2014 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..abe7afc1cd1c --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..74a9b18a59ce --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..bc4d2cd27866 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..bc4d2cd27866 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..0e72864e47b9 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..e380eb7c0a3c --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3a7ff6291fbf --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..946a2c98c0e1 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..51437526c94b --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..f039be53ffd0 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..e2622081beae --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..6eea93bb0f68 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..993e94c0b0c2 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..772682edef8b --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..69843e18865d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..563bd5ac4318 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..6b456621a624 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..f0d57d3be3bf --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3405efe3b8b0 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..73011f085314 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3fb407402b62 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3fb407402b62 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..8c4f376790b1 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..274b513d3dcc --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..9f2c6d395715 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..a3c978e6b4d8 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..53c88ceeaf9b --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..37457fd795a5 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..2c0b60b88154 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3aa735d0a101 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3aa735d0a101 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..6aeb96b70c81 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..07aea2547123 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..1e38846ccea1 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..8a986f10ab85 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3d32220f1254 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..bb3708113c89 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..0b9d9ca3244d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3d32220f1254 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..8a1ca813cec5 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..8a1ca813cec5 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..492a7f57bb69 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..492a7f57bb69 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..2f246dce3931 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..b0d3af3145e4 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..b891503929af --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..bc8715d3f014 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..f8a97b5be686 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..5238cb725397 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..45c928fb44b7 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..a175fc50966c --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..cb526e3a7c37 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..64dfbcca96c6 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..d219df4decb5 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..5c765d33c21a --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..36a09b4efd6d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..b722115cb9fc --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..c512c651570f --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..f23bc77fb7a4 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..f45e102529b6 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..66a88ac6abf3 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..570dbb0dcd0a --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..a1ccf9c9f79d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..a1ccf9c9f79d --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..3b07d9a09dea --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016.MS).sql b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016.MS).sql new file mode 100644 index 000000000000..05c3bb66e639 --- /dev/null +++ b/SqlServer.2016.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016.MS SqlServer.2016 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016).sql new file mode 100644 index 000000000000..336ecb6c158b --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2016).sql @@ -0,0 +1,13 @@ +-- SqlServer.2016 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016).sql new file mode 100644 index 000000000000..c66f141a2c2c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2016).sql @@ -0,0 +1,11 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016).sql new file mode 100644 index 000000000000..f30401b14648 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..f30401b14648 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016).sql new file mode 100644 index 000000000000..9d6c024d008d --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016).sql new file mode 100644 index 000000000000..e81097d457e9 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016).sql new file mode 100644 index 000000000000..ad930ff1e29b --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016).sql new file mode 100644 index 000000000000..02609cce4182 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..fa993c2bc4cb --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016).sql new file mode 100644 index 000000000000..645ca7fe4e1c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..80e399dd3674 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..4adff0c78704 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..9d68271b2160 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..a2d50b6d5a8c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016).sql new file mode 100644 index 000000000000..07f50d9710d9 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2016).sql @@ -0,0 +1,15 @@ +-- SqlServer.2016 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016).sql new file mode 100644 index 000000000000..6a34fb545a7a --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..89c1ba2ed787 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..89dafaacc3a0 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..329d554b0484 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..7af2478151b1 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016).sql new file mode 100644 index 000000000000..6b28b58cefa6 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..6b28b58cefa6 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016).sql new file mode 100644 index 000000000000..d2e0a7dc56c5 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016).sql new file mode 100644 index 000000000000..4e0220f12886 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2016).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016).sql new file mode 100644 index 000000000000..965ecee703d6 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2016).sql @@ -0,0 +1,12 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016).sql new file mode 100644 index 000000000000..5648220560dc --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016).sql new file mode 100644 index 000000000000..c3f84bc95328 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016).sql new file mode 100644 index 000000000000..4a0f5d468b5b --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..8998741c4c2a --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016).sql new file mode 100644 index 000000000000..75c60c1794b3 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..75c60c1794b3 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016).sql new file mode 100644 index 000000000000..58ed0d524159 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016).sql new file mode 100644 index 000000000000..8c36aea2c9c6 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2016).sql @@ -0,0 +1,12 @@ +-- SqlServer.2016 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016).sql new file mode 100644 index 000000000000..9ff273f8a6d5 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2016).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016).sql new file mode 100644 index 000000000000..01f1155dd8b2 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..fe23c9be3a0c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016).sql new file mode 100644 index 000000000000..5ce5b1af6254 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016).sql new file mode 100644 index 000000000000..f8a69a2b7581 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..fe23c9be3a0c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2016).sql @@ -0,0 +1,8 @@ +-- SqlServer.2016 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016).sql new file mode 100644 index 000000000000..d847f6202267 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..d847f6202267 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016).sql new file mode 100644 index 000000000000..8dbcc5d67adb --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..8dbcc5d67adb --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016).sql new file mode 100644 index 000000000000..87567a914bb0 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2016).sql @@ -0,0 +1,14 @@ +-- SqlServer.2016 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..56ce5583e561 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..b028c47d23e3 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..9891e92b54a4 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..725c753a715c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..f35f6cad6079 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..f9cc1243ef9a --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..dd1f9788753b --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..c6b42f1bab91 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016).sql new file mode 100644 index 000000000000..5a6c72dace4c --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2016).sql @@ -0,0 +1,9 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..cedbe9a4e5c9 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..06f5c63d0435 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..30a6fdf7e3e4 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..9af31d47ac7d --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016).sql new file mode 100644 index 000000000000..effee45104a2 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..b1750c6d3f8f --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016).sql new file mode 100644 index 000000000000..666bd0218e5e --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2016).sql @@ -0,0 +1,29 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016).sql new file mode 100644 index 000000000000..7aa2fc98f026 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2016).sql @@ -0,0 +1,33 @@ +-- SqlServer.2016 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016).sql new file mode 100644 index 000000000000..17d30427fa1e --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2016).sql @@ -0,0 +1,15 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016).sql new file mode 100644 index 000000000000..67fa8255fa73 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016).sql new file mode 100644 index 000000000000..67fa8255fa73 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2016).sql @@ -0,0 +1,20 @@ +-- SqlServer.2016 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016).sql new file mode 100644 index 000000000000..9647a7852f83 --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2016).sql @@ -0,0 +1,7 @@ +-- SqlServer.2016 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016).sql b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016).sql new file mode 100644 index 000000000000..eb1d7de390cf --- /dev/null +++ b/SqlServer.2016/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2016).sql @@ -0,0 +1,10 @@ +-- SqlServer.2016 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..18142094f178 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..a4015bac3b26 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..51c3b952dff4 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..51c3b952dff4 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..897af6c0031d --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..3e44e42f1ad3 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..db18fdb199e1 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..9508fd33b915 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..e4ab4cf4a17c --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..20aa8eadef18 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..c162cb24fcf7 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..1e2242ef98a1 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..fdf590e9f7dd --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..7c3873112a99 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..f557d8944908 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..fad3a9d416aa --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..64d38e84d1d3 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..c54d30cdbed6 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..9ce1ddfc6837 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..8274b9c7d853 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..5c947c76a539 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..5c947c76a539 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..77c5680538e9 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..d93e2c469e09 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..dac058393bbc --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..f7a809d084c8 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..a80118505ff9 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..031e7b7d2d10 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..3d03e2d183f0 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..213c54c6f739 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..213c54c6f739 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..79e3c12d3900 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..58db919256f8 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..946258df6703 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..2ff44860b929 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..244937f8555f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..4e2ab276ee62 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..01ff0b4f5a71 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..244937f8555f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..94878823d44f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..94878823d44f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..775cc1d5a292 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..775cc1d5a292 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..325564ca9a6f --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..fe2ed9717454 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..9e52a919d10d --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..340c326f8ca8 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..8a4154f39648 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..ae147d22d895 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..66c580e08084 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..d93f8788fd11 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..22f58b9cc932 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..88ca9d3ec401 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..b3b62b87c60b --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..8667c2351de2 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..28e88dcdb91c --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..29d2bd1eca35 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..24d877c4f7af --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..0f42a7736f5b --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..13785b4c06a3 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..16fac4539d09 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..25af6a5eaa37 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..1932df554a33 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..1932df554a33 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..b5c43d155701 --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017.MS).sql b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017.MS).sql new file mode 100644 index 000000000000..db5312991f1a --- /dev/null +++ b/SqlServer.2017.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017.MS SqlServer.2017 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017).sql new file mode 100644 index 000000000000..992cc2a01288 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2017).sql @@ -0,0 +1,13 @@ +-- SqlServer.2017 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017).sql new file mode 100644 index 000000000000..3a93084cbe6b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2017).sql @@ -0,0 +1,11 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017).sql new file mode 100644 index 000000000000..a378791c2f62 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..a378791c2f62 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017).sql new file mode 100644 index 000000000000..313f479d2549 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017).sql new file mode 100644 index 000000000000..391239e61bde --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017).sql new file mode 100644 index 000000000000..97c517e9c3c8 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017).sql new file mode 100644 index 000000000000..e491ee2f399f --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..574194e86779 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017).sql new file mode 100644 index 000000000000..3ba7b2fef17d --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..fe1fc37de9ce --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..1f7a365fc450 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..cf08e1418770 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..6713c2ed4704 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017).sql new file mode 100644 index 000000000000..b05638d93cba --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2017).sql @@ -0,0 +1,15 @@ +-- SqlServer.2017 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017).sql new file mode 100644 index 000000000000..b971998c095f --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..cb44c4f65175 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..1e776aa24c17 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..d4cc86eb889b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..e1ca7c4ffe7f --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017).sql new file mode 100644 index 000000000000..b77218d7ad0b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..b77218d7ad0b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017).sql new file mode 100644 index 000000000000..dc271ccd88b9 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017).sql new file mode 100644 index 000000000000..20dab42f4f87 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2017).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017).sql new file mode 100644 index 000000000000..9c2bb8a956f6 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2017).sql @@ -0,0 +1,12 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017).sql new file mode 100644 index 000000000000..56d75b7ed21e --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017).sql new file mode 100644 index 000000000000..ea68b38078b3 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017).sql new file mode 100644 index 000000000000..0c1063ee8485 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..498e598190ac --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017).sql new file mode 100644 index 000000000000..4624dc84f81b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..4624dc84f81b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017).sql new file mode 100644 index 000000000000..efac7f41344b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017).sql new file mode 100644 index 000000000000..09e76bf14e2a --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2017).sql @@ -0,0 +1,12 @@ +-- SqlServer.2017 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017).sql new file mode 100644 index 000000000000..483c3f5da7e2 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2017).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017).sql new file mode 100644 index 000000000000..bb15487982b7 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..3640be047c03 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017).sql new file mode 100644 index 000000000000..db77f7300124 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017).sql new file mode 100644 index 000000000000..0c03b87bdbe8 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..3640be047c03 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2017).sql @@ -0,0 +1,8 @@ +-- SqlServer.2017 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017).sql new file mode 100644 index 000000000000..43a009cf6dda --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..43a009cf6dda --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017).sql new file mode 100644 index 000000000000..a08e4e0ffd57 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..a08e4e0ffd57 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017).sql new file mode 100644 index 000000000000..65239e31a5db --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2017).sql @@ -0,0 +1,14 @@ +-- SqlServer.2017 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..1efd1dd70ed1 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..4f64faf665ce --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..9cc021e8a878 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..6c206456784f --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..029866f36eb4 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..3d9cb0dda55e --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..a069ddfc818d --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..3fa15c459c7c --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017).sql new file mode 100644 index 000000000000..c6120034f9bf --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2017).sql @@ -0,0 +1,9 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..a5f0ee446f2c --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..50bb8ef3dba5 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..a59fcd841694 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..8e43671b7c7d --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017).sql new file mode 100644 index 000000000000..c7a84316bcc7 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..d6dab110c87b --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017).sql new file mode 100644 index 000000000000..a9cb8ab15375 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2017).sql @@ -0,0 +1,29 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017).sql new file mode 100644 index 000000000000..4968c47ebd6c --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2017).sql @@ -0,0 +1,33 @@ +-- SqlServer.2017 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017).sql new file mode 100644 index 000000000000..0216d1e7f2b6 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2017).sql @@ -0,0 +1,15 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017).sql new file mode 100644 index 000000000000..9d9b40a06091 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017).sql new file mode 100644 index 000000000000..9d9b40a06091 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2017).sql @@ -0,0 +1,20 @@ +-- SqlServer.2017 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017).sql new file mode 100644 index 000000000000..50227ed940b9 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2017).sql @@ -0,0 +1,7 @@ +-- SqlServer.2017 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017).sql b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017).sql new file mode 100644 index 000000000000..f26a708b5f74 --- /dev/null +++ b/SqlServer.2017/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2017).sql @@ -0,0 +1,10 @@ +-- SqlServer.2017 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..e703192e1040 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..36112f232fa1 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..098774ae9bbc --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..098774ae9bbc --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..1656484f83eb --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..1cc04b440f86 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..b22eb5a62f2c --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..a36d578746f3 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..a961613c4e09 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..92f0f7604d04 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..ccdfee85be01 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..3ac946651946 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..4e4afd918f28 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..4dbd99a2c1ac --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..4804948114b3 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..d85fbc5ee653 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..aed6bab06be1 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..6e764102845c --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..3d64c5859d8c --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..4dc0ccf2fbed --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..fed4a4676608 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..fed4a4676608 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..1866ef36e41f --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..9f6b2345c7b3 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..9d534a7682df --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..99280fdb8717 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..930d8a56c8b4 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..5159ad9d5ecf --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..744168deee43 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..6f252101d4a1 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..6f252101d4a1 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..d5ba16928b38 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..4cf6f663c9de --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..91fab39b7a55 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..a0c6a517007d --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..45e03644c193 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..9ce4011cc82b --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..c875125eacdd --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..45e03644c193 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..5a0cfecb68db --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..5a0cfecb68db --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..5200c941ad0b --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..5200c941ad0b --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..fb5198add8bb --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..40886ab00bda --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..e321530facc7 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..f7224c60423d --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..9d6ec671b3c6 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..fca2335c0656 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..67be74936b35 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..11586f1445a4 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..dd6abc7f5152 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..ef36a8544b92 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..a7d694cc5b1a --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..fc413b6b9ee7 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..acf18fd257b4 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..32c5d32b1734 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..9de62e2775e3 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..536b633c0c4f --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..594832ae0896 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..594677aedebf --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..a95f4eaa8239 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..56c3157068b8 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..56c3157068b8 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..beca61315866 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019.MS).sql b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019.MS).sql new file mode 100644 index 000000000000..12611b015744 --- /dev/null +++ b/SqlServer.2019.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019).sql new file mode 100644 index 000000000000..8cd346000140 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2019).sql @@ -0,0 +1,13 @@ +-- SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019).sql new file mode 100644 index 000000000000..58b0dcd48a39 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2019).sql @@ -0,0 +1,11 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019).sql new file mode 100644 index 000000000000..9a45432f51f2 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..9a45432f51f2 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019).sql new file mode 100644 index 000000000000..b0f3b0078b39 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019).sql new file mode 100644 index 000000000000..71c57235d658 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019).sql new file mode 100644 index 000000000000..71e947862489 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019).sql new file mode 100644 index 000000000000..bf63d56ac90a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..7f62a86423e2 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019).sql new file mode 100644 index 000000000000..6be4aaeb928d --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..9347c88ef202 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..7469f853c69a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..00bc9520e9c3 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..3ba25ecc78ca --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019).sql new file mode 100644 index 000000000000..e6aff6d187e4 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2019).sql @@ -0,0 +1,15 @@ +-- SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019).sql new file mode 100644 index 000000000000..671fbc3d8e2e --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..1b00283ef1db --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..80b974d39bf9 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..358c7d711fc1 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..e16afd670dbf --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019).sql new file mode 100644 index 000000000000..de5b786dec69 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..de5b786dec69 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019).sql new file mode 100644 index 000000000000..5d83e111211c --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019).sql new file mode 100644 index 000000000000..412dc97160e6 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2019).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019).sql new file mode 100644 index 000000000000..4c0e3f9a89d6 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2019).sql @@ -0,0 +1,12 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019).sql new file mode 100644 index 000000000000..fcf6406a222d --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019).sql new file mode 100644 index 000000000000..c9c0895be76b --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019).sql new file mode 100644 index 000000000000..ab9f44b62e89 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..33d3bb73ac01 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019).sql new file mode 100644 index 000000000000..c7af21d308cc --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..c7af21d308cc --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019).sql new file mode 100644 index 000000000000..90fef4a4191a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019).sql new file mode 100644 index 000000000000..a57bf6a4836a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2019).sql @@ -0,0 +1,12 @@ +-- SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019).sql new file mode 100644 index 000000000000..7a42f69e3d10 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2019).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019).sql new file mode 100644 index 000000000000..3a608e9982df --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..ec3d16878e3b --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019).sql new file mode 100644 index 000000000000..76d0b5e6b95b --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019).sql new file mode 100644 index 000000000000..3b2e9ce81574 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..ec3d16878e3b --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2019).sql @@ -0,0 +1,8 @@ +-- SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019).sql new file mode 100644 index 000000000000..d44b1f47aaf9 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..d44b1f47aaf9 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019).sql new file mode 100644 index 000000000000..3edc95fe5eb8 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..3edc95fe5eb8 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019).sql new file mode 100644 index 000000000000..1fdf6c351f0d --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2019).sql @@ -0,0 +1,14 @@ +-- SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..1402d4ced159 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..6dd94a92d8b4 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..81bc4c747491 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..532c65da38cc --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..2b7b63adc242 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..1745fd044d1a --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..ade30a041b5f --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..1562b2b70a84 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019).sql new file mode 100644 index 000000000000..3cd2876e8c15 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2019).sql @@ -0,0 +1,9 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..2cb83582cb09 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..643e7c13c77b --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..1facee0311dd --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..434db9d67ec6 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019).sql new file mode 100644 index 000000000000..19f891d41c63 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..053869e42c92 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019).sql new file mode 100644 index 000000000000..053129584dd5 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2019).sql @@ -0,0 +1,29 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019).sql new file mode 100644 index 000000000000..9916319b3275 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2019).sql @@ -0,0 +1,33 @@ +-- SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019).sql new file mode 100644 index 000000000000..ed28ac70fc58 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2019).sql @@ -0,0 +1,15 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019).sql new file mode 100644 index 000000000000..8a0040a95162 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019).sql new file mode 100644 index 000000000000..8a0040a95162 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2019).sql @@ -0,0 +1,20 @@ +-- SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019).sql new file mode 100644 index 000000000000..59425132e1c2 --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2019).sql @@ -0,0 +1,7 @@ +-- SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019).sql b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019).sql new file mode 100644 index 000000000000..a434c8b6b3be --- /dev/null +++ b/SqlServer.2019/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2019).sql @@ -0,0 +1,10 @@ +-- SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..fa61eb38de70 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ab4d596cf8f6 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f0b8f2ee9574 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f0b8f2ee9574 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..e5c9576d6117 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..d120672c65fb --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..3f192dc7ba6b --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..d453a7b02afd --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..02d36b2323bf --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..d361e6c04678 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..230cd0ab358e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..af1ebf6e356e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..fa639c31e922 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f9b423a25468 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..94cfd8a396b6 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..c63158123926 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..14d56d052280 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f4e16563259e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..1016bb745623 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f8da8a79de5e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..41ba135e3eca --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..41ba135e3eca --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..9fd73626930c --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..28da5b42f167 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..e8ff5f8edaa4 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..04820520da45 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a51b2bca9e73 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..542fe6eb1700 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..950606051fae --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..6c764a12c3ab --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..6c764a12c3ab --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ae2e3c4a02cc --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..7c17dd1d3afd --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..f7e3a94880dd --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..7072291b2af3 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2a47ba9f441f --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..66fbded74263 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..dcd5457c4642 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2a47ba9f441f --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a36adaf2112f --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a36adaf2112f --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ba7313253792 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ba7313253792 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..4e85ffedffd9 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..51d0a2158c38 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..bebfcbd7a631 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a5d95786f99b --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..c61fa7b0753e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..35f8e0d87476 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..d1fbc5b48cd0 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..96ae5cd06b98 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..e65962549e91 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..a2f31e0d1672 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..8db9e803267e --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..c31bc692e92a --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..95f01a3d93d5 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..de990777b5e1 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..40b2c19f0fa2 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..8350a50084e8 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..55bb27c3e12a --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ed9ebcdcef13 --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..2a4a713fd2fa --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..33230eb5c29b --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..33230eb5c29b --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..1fd0d6c273ad --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022.MS).sql b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022.MS).sql new file mode 100644 index 000000000000..ecf7e5e1229c --- /dev/null +++ b/SqlServer.2022.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022.MS SqlServer.2022 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022).sql new file mode 100644 index 000000000000..833e11501191 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2022).sql @@ -0,0 +1,13 @@ +-- SqlServer.2022 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022).sql new file mode 100644 index 000000000000..17a0f0d67013 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2022).sql @@ -0,0 +1,11 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022).sql new file mode 100644 index 000000000000..41ca9f8cf837 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..41ca9f8cf837 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022).sql new file mode 100644 index 000000000000..6ffe232c2f8a --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022).sql new file mode 100644 index 000000000000..72d7f1e206c6 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022).sql new file mode 100644 index 000000000000..333f84e7c46c --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022).sql new file mode 100644 index 000000000000..0cf8aad5320f --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..f6452ae45026 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022).sql new file mode 100644 index 000000000000..515205431b7b --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..38a7d0b25394 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..2ca2160a724f --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..59d3add38214 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..df853b741a30 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022).sql new file mode 100644 index 000000000000..60891ffca983 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2022).sql @@ -0,0 +1,15 @@ +-- SqlServer.2022 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022).sql new file mode 100644 index 000000000000..8280a3fc3bf6 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..add8fe28c32e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..6f7f41f260b3 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..c14b03c29de1 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..a3a5acbb000e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022).sql new file mode 100644 index 000000000000..13ddbc0467f7 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..13ddbc0467f7 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022).sql new file mode 100644 index 000000000000..0d4cfe5d633e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022).sql new file mode 100644 index 000000000000..9e205c1d5798 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2022).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022).sql new file mode 100644 index 000000000000..7b66a753ce01 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2022).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022).sql new file mode 100644 index 000000000000..bf1c1055d838 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022).sql new file mode 100644 index 000000000000..09f8ad789c38 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022).sql new file mode 100644 index 000000000000..2643e11d4f60 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..20ab7a95baf6 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022).sql new file mode 100644 index 000000000000..6bdc210a25dc --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..6bdc210a25dc --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022).sql new file mode 100644 index 000000000000..e4e1011d7a00 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022).sql new file mode 100644 index 000000000000..e9745914ad2d --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2022).sql @@ -0,0 +1,12 @@ +-- SqlServer.2022 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022).sql new file mode 100644 index 000000000000..39ecf7329df7 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2022).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022).sql new file mode 100644 index 000000000000..01d9ab9ccf39 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..63256107af42 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022).sql new file mode 100644 index 000000000000..edf4d69ada05 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022).sql new file mode 100644 index 000000000000..3b09167f73e3 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..63256107af42 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2022).sql @@ -0,0 +1,8 @@ +-- SqlServer.2022 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022).sql new file mode 100644 index 000000000000..c08fb6716fbd --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..c08fb6716fbd --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022).sql new file mode 100644 index 000000000000..5a91e712e09c --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..5a91e712e09c --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022).sql new file mode 100644 index 000000000000..cf4f72ca2a55 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2022).sql @@ -0,0 +1,14 @@ +-- SqlServer.2022 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..e3224285bc41 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..a214653fdedf --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..b8ed8a3c27ab --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..61ae30cbbba5 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..a59acbbccc3e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..72d0f35b351e --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..e82639dcb03b --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..4c7dd563c952 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022).sql new file mode 100644 index 000000000000..5b4e0dbab611 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2022).sql @@ -0,0 +1,9 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..0067b6a2a2dd --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..a2aa029460e6 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..07f92f4b59f9 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..4bfa160136de --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022).sql new file mode 100644 index 000000000000..f66840d583e8 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..f93db90626f5 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022).sql new file mode 100644 index 000000000000..704f488015d7 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2022).sql @@ -0,0 +1,29 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022).sql new file mode 100644 index 000000000000..3c5cade28280 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2022).sql @@ -0,0 +1,33 @@ +-- SqlServer.2022 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022).sql new file mode 100644 index 000000000000..0af9182296b5 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2022).sql @@ -0,0 +1,15 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022).sql new file mode 100644 index 000000000000..3d895d4f68f3 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022).sql new file mode 100644 index 000000000000..3d895d4f68f3 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2022).sql @@ -0,0 +1,20 @@ +-- SqlServer.2022 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022).sql new file mode 100644 index 000000000000..5309ca3b0319 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2022).sql @@ -0,0 +1,7 @@ +-- SqlServer.2022 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022).sql b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022).sql new file mode 100644 index 000000000000..6aa1cb86e3f0 --- /dev/null +++ b/SqlServer.2022/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2022).sql @@ -0,0 +1,10 @@ +-- SqlServer.2022 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..2ad9aee02dbb --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..73c1c62d40aa --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..fcccf27c6ec6 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..fcccf27c6ec6 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..295d5fe1ca0c --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..3de5e40d65eb --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..650abfa5bb9b --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..347437445a26 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..a8435a625f1d --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..cdd345c662a8 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..63a1e054f84f --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..0869fd065568 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..81244077b416 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..c0e07912fc1b --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..7c27e9e7402a --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..c580d059e507 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..3830a619ddc6 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..7163f2be6be0 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..677490986ee9 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..d906cabcec3e --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..fb68e65c95dd --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..fb68e65c95dd --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..4854ad9d4a6a --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..df694f66ea62 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..da8f6f4366d1 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..1b44d00f06aa --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..b0fd548d4ebc --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e8be2a339613 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..4f5a88a39028 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e514ce228f67 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e514ce228f67 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ec6e2a3cb2c2 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..48c9afa3ad1c --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..622f50bb5396 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..9f4444d0885a --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ecbb9a0ab120 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..b31b01faac4b --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..b0353a564f6d --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ecbb9a0ab120 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..0d4552f4386e --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..0d4552f4386e --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..b29cdb66bbfa --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..b29cdb66bbfa --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..c20a83f470bd --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ced482b4d33e --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..eaa9c8a5060c --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..4386005616a5 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..8a23e3f90809 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..100202bc9d45 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..033930a3f63c --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..1a35272c901d --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..c5f82273ee23 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e4f00d8e1f21 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..f56bb6091805 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..1e79ba07d424 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..c871644ae0e8 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ac171ba3c452 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..a67451596f55 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e384b8e1841a --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..892bc29c00a6 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..64b2887a46ae --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..440539238443 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ae9a8bfea31f --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..ae9a8bfea31f --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..d1feb01bb3c1 --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025.MS).sql b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025.MS).sql new file mode 100644 index 000000000000..e9fbcdfbf0ec --- /dev/null +++ b/SqlServer.2025.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025.MS SqlServer.2025 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025).sql new file mode 100644 index 000000000000..4dacf9fd0cb4 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.2025).sql @@ -0,0 +1,13 @@ +-- SqlServer.2025 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025).sql new file mode 100644 index 000000000000..9846e4cd506a --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.2025).sql @@ -0,0 +1,11 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025).sql new file mode 100644 index 000000000000..9c98145a868c --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..9c98145a868c --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025).sql new file mode 100644 index 000000000000..7701413aedbf --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025).sql new file mode 100644 index 000000000000..3f06768f0f36 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025).sql new file mode 100644 index 000000000000..709e90b8dbeb --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025).sql new file mode 100644 index 000000000000..5a2a181dcb9a --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..0b9c2dbeecf1 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025).sql new file mode 100644 index 000000000000..97285c1b89b6 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..f8ae15ffad2f --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..f142b27fe113 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..88a2e075f9b0 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..7cfcf7e652b4 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025).sql new file mode 100644 index 000000000000..b68dd3cedcbe --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.2025).sql @@ -0,0 +1,15 @@ +-- SqlServer.2025 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025).sql new file mode 100644 index 000000000000..34a7ea643201 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..5b31371f7a92 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..91350bbeb84b --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..d5ad90057d50 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..018f34280dd8 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025).sql new file mode 100644 index 000000000000..b5b28f8a08c3 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..b5b28f8a08c3 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025).sql new file mode 100644 index 000000000000..66b2373a0390 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025).sql new file mode 100644 index 000000000000..7d3bb7832c8e --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.2025).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025).sql new file mode 100644 index 000000000000..2eb8700d7f0f --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.2025).sql @@ -0,0 +1,12 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025).sql new file mode 100644 index 000000000000..b76986219f40 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025).sql new file mode 100644 index 000000000000..3d000f33ead9 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025).sql new file mode 100644 index 000000000000..e33e1c036c13 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..e6cf3f270f72 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025).sql new file mode 100644 index 000000000000..dab985c09805 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..dab985c09805 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025).sql new file mode 100644 index 000000000000..19a0ecdf143a --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025).sql new file mode 100644 index 000000000000..5fe2e00665b6 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.2025).sql @@ -0,0 +1,12 @@ +-- SqlServer.2025 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025).sql new file mode 100644 index 000000000000..467cd74b28fa --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.2025).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025).sql new file mode 100644 index 000000000000..e67cfe10a3b4 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..cae6e62ae821 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025).sql new file mode 100644 index 000000000000..64638f67265b --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025).sql new file mode 100644 index 000000000000..4378f0eebb36 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..cae6e62ae821 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.2025).sql @@ -0,0 +1,8 @@ +-- SqlServer.2025 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025).sql new file mode 100644 index 000000000000..0ab7afd498ed --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..0ab7afd498ed --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025).sql new file mode 100644 index 000000000000..a664174ce9ff --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..a664174ce9ff --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025).sql new file mode 100644 index 000000000000..e181694a960b --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.2025).sql @@ -0,0 +1,14 @@ +-- SqlServer.2025 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..e0404d8be4b1 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..13109aa3a7a4 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..e7b9558cadb8 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..5e8db6d23d0b --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..3d237ac4c05c --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..533d0a16ed7e --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..b9e32201db06 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..ffce1e8b5cac --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025).sql new file mode 100644 index 000000000000..a8108258f23b --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.2025).sql @@ -0,0 +1,9 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..fe7cc2a73d2d --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..62ae75969a26 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..d3859b0977b8 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..226ce210b69e --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025).sql new file mode 100644 index 000000000000..d3d0502119b3 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..586eea5212d8 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025).sql new file mode 100644 index 000000000000..955d665b9000 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.2025).sql @@ -0,0 +1,29 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025).sql new file mode 100644 index 000000000000..68b5e1d0b226 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.2025).sql @@ -0,0 +1,33 @@ +-- SqlServer.2025 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025).sql new file mode 100644 index 000000000000..cc76e9f3ac93 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.2025).sql @@ -0,0 +1,15 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025).sql new file mode 100644 index 000000000000..187cc961a801 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025).sql new file mode 100644 index 000000000000..187cc961a801 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.2025).sql @@ -0,0 +1,20 @@ +-- SqlServer.2025 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025).sql new file mode 100644 index 000000000000..ee802161d646 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.2025).sql @@ -0,0 +1,7 @@ +-- SqlServer.2025 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025).sql b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025).sql new file mode 100644 index 000000000000..0df32584ec83 --- /dev/null +++ b/SqlServer.2025/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.2025).sql @@ -0,0 +1,10 @@ +-- SqlServer.2025 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..8ab10e288d8f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..cbbeb942428f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..51d27dbb00fb --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..51d27dbb00fb --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..b087b1394107 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..8d7934d08b32 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..ff721b6b42e6 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..a0decdbb0c3e --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..53fbaa2427eb --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..63db55200648 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..c42188bfde8f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..f814fb5f915c --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..49de171dfb5f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..1db6aa8e5db8 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..4110baa7b806 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..0eb6289b7354 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..75e60ad1f638 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..d348eabd8196 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..b304635a7f4a --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..4acb2b543959 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..f00f0dbc3799 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..f00f0dbc3799 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..4ad967a2c9ed --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..2caa7f6f14a3 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..0836faf08897 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..fb80aa9df4ba --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..e6a6268f64bf --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..60a7d675cb53 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..541fedf7a992 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..2ee8b3074723 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..2ee8b3074723 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..66ace011cf5a --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..abaf13cb547c --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..b15ceca77b36 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..140788ff5b90 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..9e57fa58c9d9 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..c6c4af10900d --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..7d77742d1893 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..9e57fa58c9d9 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..a6b187ce641d --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..a6b187ce641d --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..81d4f811a996 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..81d4f811a996 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..0388aa3d3f60 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..88a160f1417a --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..ac56edff39f0 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..4d537c7dc2ae --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..2cce45c7aeb8 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..97c7fbbd992b --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..bd521d3b97ac --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..daaac5b89156 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..0c26169fcbe3 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..ec6fd067399d --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..75e30a30581f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..ace5ea1f9397 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..59f0c644df15 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..890ca7689e9e --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..6f48389ae1f5 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..5d8feb07ed6f --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..c66c2d97cff1 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..114ff16a5b2b --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..643fdca47dc1 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..c26668408170 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..c26668408170 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..b64e69506b41 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained.MS).sql b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained.MS).sql new file mode 100644 index 000000000000..8501ae8f2890 --- /dev/null +++ b/SqlServer.Contained.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained).sql new file mode 100644 index 000000000000..fd72a87bf961 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.Contained).sql @@ -0,0 +1,13 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained).sql new file mode 100644 index 000000000000..e5b27010fade --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.Contained).sql @@ -0,0 +1,11 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained).sql new file mode 100644 index 000000000000..be609dcd449e --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..be609dcd449e --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained).sql new file mode 100644 index 000000000000..4ef89ed4b2a4 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained).sql new file mode 100644 index 000000000000..c0188794a63c --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained).sql new file mode 100644 index 000000000000..9343fc70a1cf --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained).sql new file mode 100644 index 000000000000..5450c3eaa239 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..5224fe335c72 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained).sql new file mode 100644 index 000000000000..109f8d67df3b --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..b1d4c8e38221 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..34b87f4e4d42 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..54611959159d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..7dfd2b640f34 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained).sql new file mode 100644 index 000000000000..647c529f0a8a --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.Contained).sql @@ -0,0 +1,15 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained).sql new file mode 100644 index 000000000000..c9368d20aea7 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..92e3bb1eb383 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..db211f571461 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..98906890f27f --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..5c4a282f5942 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained).sql new file mode 100644 index 000000000000..048413e71713 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..048413e71713 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained).sql new file mode 100644 index 000000000000..4e1359916623 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained).sql new file mode 100644 index 000000000000..1c5c0e36db83 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.Contained).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained).sql new file mode 100644 index 000000000000..badcd3206837 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.Contained).sql @@ -0,0 +1,12 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained).sql new file mode 100644 index 000000000000..c9849a164b95 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained).sql new file mode 100644 index 000000000000..c55c26b3c490 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained).sql new file mode 100644 index 000000000000..34833b694e0c --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..4af0412218f9 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained).sql new file mode 100644 index 000000000000..c8ee93b433a6 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..c8ee93b433a6 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained).sql new file mode 100644 index 000000000000..80d873de8713 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained).sql new file mode 100644 index 000000000000..00390333dcf0 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.Contained).sql @@ -0,0 +1,12 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained).sql new file mode 100644 index 000000000000..e45a453e93cd --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.Contained).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained).sql new file mode 100644 index 000000000000..cf75a23f26b0 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..093c3e36c2f1 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained).sql new file mode 100644 index 000000000000..e0d32cce08d8 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained).sql new file mode 100644 index 000000000000..8d9f8c338709 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..093c3e36c2f1 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.Contained).sql @@ -0,0 +1,8 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained).sql new file mode 100644 index 000000000000..1daabe21f83d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..1daabe21f83d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained).sql new file mode 100644 index 000000000000..a9d4aa06e40d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..a9d4aa06e40d --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained).sql new file mode 100644 index 000000000000..8dfd998cc3cc --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.Contained).sql @@ -0,0 +1,14 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..aa5afbe81c68 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..9197e7d8287f --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..df0fe7a5c21b --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..a49b8bd475b6 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..cd1da1aa4f80 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..13deb00205f4 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..de5582f3821b --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..51c08fd743a4 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained).sql new file mode 100644 index 000000000000..b7da02af808e --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.Contained).sql @@ -0,0 +1,9 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..03f3f8dd3263 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..058629f42e54 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..06e6ee5f3bef --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..ef469ce12576 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained).sql new file mode 100644 index 000000000000..23373bb5dd0a --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..6ea3b4d71e7f --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained).sql new file mode 100644 index 000000000000..9681a3240161 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.Contained).sql @@ -0,0 +1,29 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained).sql new file mode 100644 index 000000000000..aa1db49ae394 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.Contained).sql @@ -0,0 +1,33 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained).sql new file mode 100644 index 000000000000..4e9e98d60893 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.Contained).sql @@ -0,0 +1,15 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained).sql new file mode 100644 index 000000000000..3c6f8419f3c1 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained).sql new file mode 100644 index 000000000000..3c6f8419f3c1 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.Contained).sql @@ -0,0 +1,20 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained).sql new file mode 100644 index 000000000000..d61ff4831cb1 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.Contained).sql @@ -0,0 +1,7 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained).sql b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained).sql new file mode 100644 index 000000000000..66ee19b35e42 --- /dev/null +++ b/SqlServer.Contained/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.Contained).sql @@ -0,0 +1,10 @@ +-- SqlServer.Contained SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..446069afea5a --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA.MS).sql @@ -0,0 +1,13 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..672e76107cbc --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA.MS).sql @@ -0,0 +1,11 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..35b6919e6c6c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..35b6919e6c6c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..ebddc0f1774a --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..e5efac11bf62 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..8da097ca3248 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d7261be044ae --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..b41b610c9e0d --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..ac0dbed04852 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..0c04ea935bfa --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..760570df6b4d --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d89c40d3105f --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..c29490ed49a6 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..255a7181f989 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..69ab2ac1eb15 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..92f61988ec80 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..8f3fa2bc8c90 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..7bf6a4c33630 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..e60b55c307d3 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..fea860e53173 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..fea860e53173 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..a3a7ac5702d0 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..956ad8507dd5 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..102eb70887ad --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..fe033bffc857 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..8a5e0ca54a4a --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..f3a84b2f2414 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..8dadbaac74ad --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..771ece3e9960 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..771ece3e9960 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d6132b9e6f93 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d3f6cfcb8c9e --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA.MS).sql @@ -0,0 +1,12 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..eb170e946de1 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..e561880a0962 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..0bfb802b50a4 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d9f1a0a940c5 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..061f2ed219fe --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..0bfb802b50a4 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA.MS).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..e8bb07558d78 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..e8bb07558d78 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..ab0191fbbf4e --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..ab0191fbbf4e --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..14635dd1faba --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA.MS).sql @@ -0,0 +1,14 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..9e3e29b1cc79 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..bd2b89f9e73c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..4e6fe0267dc8 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..0d207bf16051 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..5d2a4860bb0a --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..9b87059ae225 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d855258f0c5e --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..f8aa4785aa11 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..78a2c184f217 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA.MS).sql @@ -0,0 +1,9 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..a0455d373cc6 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..fd1277c89aa1 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..fa3e22f14dd9 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..9de89b0669cf --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..a039515420f6 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..a93f3ca25853 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..027df20d2003 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA.MS).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d88561ce7470 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA.MS).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..d3ed3520f3cb --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA.MS).sql @@ -0,0 +1,15 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..7f261486552c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..7f261486552c --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA.MS).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..85920194eda6 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA.MS).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA.MS).sql b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA.MS).sql new file mode 100644 index 000000000000..2e3599a0c4b9 --- /dev/null +++ b/SqlServer.SA.MS/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA.MS).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA.MS SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA).sql new file mode 100644 index 000000000000..157629b15f13 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFilter(SqlServer.SA).sql @@ -0,0 +1,13 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(IIF([t].[IntValue] > 20, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING), + AVG(IIF([t].[DoubleValue] > 15, [t].[DoubleValue], NULL)) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + MIN(IIF([t].[IntValue] > 10, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX(IIF([t].[IntValue] < 80, [t].[IntValue], NULL)) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA).sql new file mode 100644 index 000000000000..7e6d16702a12 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AggregateWithFrame(SqlServer.SA).sql @@ -0,0 +1,11 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND CURRENT ROW), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA).sql new file mode 100644 index 000000000000..ec68b1070e3e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloads(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..ec68b1070e3e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageOverloadsViaWindow(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + AVG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA).sql new file mode 100644 index 000000000000..d49f6d8ef53c --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.AverageWithFilter(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + AVG(IIF([t].[CategoryId] = 1, [t].[DoubleValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA).sql new file mode 100644 index 000000000000..c142dd178cc0 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountArgWithFrame(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA).sql new file mode 100644 index 000000000000..d3bcc1059d24 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountNoArgs(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA).sql new file mode 100644 index 000000000000..b0dfd1575107 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithArg(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + COUNT([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..cdd551784719 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA).sql new file mode 100644 index 000000000000..f24823152d0b --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CountWithFilter(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + COUNT(IIF([t].[IntValue] > 20, 1, NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..d2b8f2264e22 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..959c0066bb25 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..197a7d28b43e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + CUME_DIST() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..c409db7e7057 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.CumeDistWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + CUME_DIST() OVER (ORDER BY [x].[Timestamp]), + CUME_DIST() OVER (ORDER BY [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC), + CUME_DIST() OVER (ORDER BY [x].[Value] DESC), + CUME_DIST() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + CUME_DIST() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA).sql new file mode 100644 index 000000000000..4d8daf694366 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseRanking(SqlServer.SA).sql @@ -0,0 +1,15 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + AVG([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + COUNT(*) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA).sql new file mode 100644 index 000000000000..584326beabd3 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DefineWindowReuseValueFunctions(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..056d00e93ff5 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..f670fbcf9639 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..85d29f9d8bcf --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + DENSE_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..d5a6d0f3e0cf --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.DenseRankWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + DENSE_RANK() OVER (ORDER BY [x].[Timestamp]), + DENSE_RANK() OVER (ORDER BY [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Value] DESC), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + DENSE_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA).sql new file mode 100644 index 000000000000..f4da030f5cba --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueBasic(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..f4da030f5cba --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA).sql new file mode 100644 index 000000000000..5316f4d9bd75 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FirstValueWithFrame(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA).sql new file mode 100644 index 000000000000..2c90a5d1e541 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRangeNoValue(SqlServer.SA).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND CURRENT ROW) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA).sql new file mode 100644 index 000000000000..325fa0fb6f3e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.FrameRows(SqlServer.SA).sql @@ -0,0 +1,12 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN 1 PRECEDING AND 2 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA).sql new file mode 100644 index 000000000000..c59786ce6483 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagSimple(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA).sql new file mode 100644 index 000000000000..ad45a03bf202 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffset(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA).sql new file mode 100644 index 000000000000..bf83c6f8f2d9 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithOffsetAndDefault(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..fcf326b229f4 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LagWithPartition(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA).sql new file mode 100644 index 000000000000..bf000f74e87f --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueBasic(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..bf000f74e87f --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA).sql new file mode 100644 index 000000000000..891e87bc82df --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LastValueWithFrame(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA).sql new file mode 100644 index 000000000000..672dcd99d396 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagAllOverloads(SqlServer.SA).sql @@ -0,0 +1,12 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LEAD([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 2, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA).sql new file mode 100644 index 000000000000..fd4de1a157d7 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadLagDifferentTypes(SqlServer.SA).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + LEAD([t].[DoubleValue]) OVER (ORDER BY [t].[Id]), + LAG([t].[DecimalValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[NullableIntValue]) OVER (ORDER BY [t].[Id]), + LEAD([t].[IntValue]) OVER (ORDER BY [t].[CategoryId], [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA).sql new file mode 100644 index 000000000000..404822066f32 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadSimple(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..7c6212960222 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA).sql new file mode 100644 index 000000000000..5d6a6c96fa09 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffset(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA).sql new file mode 100644 index 000000000000..352700ba4477 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithOffsetAndDefault(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue], 2, 0) OVER (ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..7c6212960222 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.LeadWithPartition(SqlServer.SA).sql @@ -0,0 +1,8 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [t].[Id], + LEAD([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA).sql new file mode 100644 index 000000000000..44be4f0634b9 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloads(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..44be4f0634b9 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MaxOverloadsViaWindow(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + MAX([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MAX([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA).sql new file mode 100644 index 000000000000..ffbd2cc7ce65 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloads(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..ffbd2cc7ce65 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MinOverloadsViaWindow(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + MIN([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[ByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + MIN([t].[NullableByteValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA).sql new file mode 100644 index 000000000000..7d6b8c2ea7c3 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.MixedFunctionsInOneSelect(SqlServer.SA).sql @@ -0,0 +1,14 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + ROW_NUMBER() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + DENSE_RANK() OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[IntValue]), + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LEAD([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + LAG([t].[IntValue], 1, 0) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..d92697b6a381 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..bb7d256b6425 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..6770d872efa7 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + NTILE(4) OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..380d7bc132cd --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.NTileWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + NTILE(4) OVER (ORDER BY [x].[Timestamp]), + NTILE(4) OVER (ORDER BY [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC), + NTILE(4) OVER (ORDER BY [x].[Value] DESC), + NTILE(4) OVER (ORDER BY [x].[Timestamp], [x].[Value]), + NTILE(4) OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..d45ceadc5b6a --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..3704e01303df --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..639a766bafa9 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + PERCENT_RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..523b1cdea507 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.PercentRankWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp]), + PERCENT_RANK() OVER (ORDER BY [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Value] DESC), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + PERCENT_RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA).sql new file mode 100644 index 000000000000..a42f4d0788bc --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RangeFrameBoundaries(SqlServer.SA).sql @@ -0,0 +1,9 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] RANGE BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..e55c0fdf5d72 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..a7ccefee276e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..eeb0414f75f6 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + RANK() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..c65719c89685 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RankWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + RANK() OVER (ORDER BY [x].[Timestamp]), + RANK() OVER (ORDER BY [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC), + RANK() OVER (ORDER BY [x].[Value] DESC), + RANK() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + RANK() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA).sql new file mode 100644 index 000000000000..59d47cf87f8e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitions(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..0b047f3e87ad --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithMultiplePartitionsWithDefineWindow(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId], [x].[Name] ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA).sql new file mode 100644 index 000000000000..3316676aa5b3 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithNulls(SqlServer.SA).sql @@ -0,0 +1,29 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 0, 1), [x].[Timestamp]), + ROW_NUMBER() OVER (PARTITION BY [x].[CategoryId] ORDER BY IIF([x].[Timestamp] IS NULL, 1, 0), [x].[Timestamp] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA).sql new file mode 100644 index 000000000000..a2fbdfb8c94b --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowNumberWithoutPartition(SqlServer.SA).sql @@ -0,0 +1,33 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + [x].[Id], + [x].[Name], + [x].[CategoryId], + [x].[Value], + [x].[Timestamp], + [x].[IntValue], + [x].[NullableIntValue], + [x].[LongValue], + [x].[NullableLongValue], + [x].[DoubleValue], + [x].[NullableDoubleValue], + [x].[DecimalValue], + [x].[NullableDecimalValue], + [x].[FloatValue], + [x].[NullableFloatValue], + [x].[ShortValue], + [x].[NullableShortValue], + [x].[ByteValue], + [x].[NullableByteValue], + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp]), + ROW_NUMBER() OVER (ORDER BY [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Value] DESC), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp], [x].[Value]), + ROW_NUMBER() OVER (ORDER BY [x].[Timestamp] DESC, [x].[Value] DESC) +FROM + [WindowFunctionTestEntity] [x] +ORDER BY + [x].[Id] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA).sql new file mode 100644 index 000000000000..5da12889f1cb --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.RowsFrameAllBoundaries(SqlServer.SA).sql @@ -0,0 +1,15 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND 3 FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND CURRENT ROW), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND UNBOUNDED FOLLOWING), + SUM([t].[IntValue]) OVER (ORDER BY [t].[Id] ROWS BETWEEN 2 PRECEDING AND 3 FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA).sql new file mode 100644 index 000000000000..36aae073771e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloads(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA).sql new file mode 100644 index 000000000000..36aae073771e --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumOverloadsViaWindow(SqlServer.SA).sql @@ -0,0 +1,20 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableIntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[LongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableLongValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDoubleValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[DecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableDecimalValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[FloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[NullableFloatValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM([t].[ShortValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableShortValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[ByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]), + SUM(CAST([t].[NullableByteValue] AS Int)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA).sql new file mode 100644 index 000000000000..5714ce21f667 --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.SumWithFilter(SqlServer.SA).sql @@ -0,0 +1,7 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + SUM(IIF([t].[CategoryId] = 1, [t].[IntValue], NULL)) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id]) +FROM + [WindowFunctionTestEntity] [t] + diff --git a/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA).sql b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA).sql new file mode 100644 index 000000000000..3f899559b1cd --- /dev/null +++ b/SqlServer.SA/Tests/Linq/WindowFunctionsTests/Tests.Linq.WindowFunctionsTests.ValueFunctionWithFrames(SqlServer.SA).sql @@ -0,0 +1,10 @@ +-- SqlServer.SA SqlServer.2019 + +SELECT + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + FIRST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING), + LAST_VALUE([t].[IntValue]) OVER (PARTITION BY [t].[CategoryId] ORDER BY [t].[Id] ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING) +FROM + [WindowFunctionTestEntity] [t] +