@@ -70,6 +70,36 @@ public void testFoldingToLocalExecWithProject() {
70
70
assertThat (ee .output ().get (0 ).toString (), startsWith ("keyword{f}#" ));
71
71
}
72
72
73
+ public void testFoldingToLocalExecWithProjectAndLimit () {
74
+ PhysicalPlan p = plan ("SELECT keyword FROM test WHERE 1 = 2 LIMIT 10" );
75
+ assertEquals (LocalExec .class , p .getClass ());
76
+ LocalExec le = (LocalExec ) p ;
77
+ assertEquals (EmptyExecutable .class , le .executable ().getClass ());
78
+ EmptyExecutable ee = (EmptyExecutable ) le .executable ();
79
+ assertEquals (1 , ee .output ().size ());
80
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("keyword{f}#" ));
81
+ }
82
+
83
+ public void testFoldingToLocalExecWithProjectAndOrderBy () {
84
+ PhysicalPlan p = plan ("SELECT keyword FROM test WHERE 1 = 2 ORDER BY 1" );
85
+ assertEquals (LocalExec .class , p .getClass ());
86
+ LocalExec le = (LocalExec ) p ;
87
+ assertEquals (EmptyExecutable .class , le .executable ().getClass ());
88
+ EmptyExecutable ee = (EmptyExecutable ) le .executable ();
89
+ assertEquals (1 , ee .output ().size ());
90
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("keyword{f}#" ));
91
+ }
92
+
93
+ public void testFoldingToLocalExecWithProjectAndOrderByAndLimit () {
94
+ PhysicalPlan p = plan ("SELECT keyword FROM test WHERE 1 = 2 ORDER BY 1 LIMIT 10" );
95
+ assertEquals (LocalExec .class , p .getClass ());
96
+ LocalExec le = (LocalExec ) p ;
97
+ assertEquals (EmptyExecutable .class , le .executable ().getClass ());
98
+ EmptyExecutable ee = (EmptyExecutable ) le .executable ();
99
+ assertEquals (1 , ee .output ().size ());
100
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("keyword{f}#" ));
101
+ }
102
+
73
103
public void testLocalExecWithPrunedFilterWithFunction () {
74
104
PhysicalPlan p = plan ("SELECT E() FROM test WHERE PI() = 5" );
75
105
assertEquals (LocalExec .class , p .getClass ());
@@ -90,6 +120,36 @@ public void testLocalExecWithPrunedFilterWithFunctionAndAggregation() {
90
120
assertThat (ee .output ().get (0 ).toString (), startsWith ("E(){c}#" ));
91
121
}
92
122
123
+ public void testFoldingToLocalExecWithAggregationAndLimit () {
124
+ PhysicalPlan p = plan ("SELECT 'foo' FROM test GROUP BY 1 LIMIT 10" );
125
+ assertEquals (LocalExec .class , p .getClass ());
126
+ LocalExec le = (LocalExec ) p ;
127
+ assertEquals (SingletonExecutable .class , le .executable ().getClass ());
128
+ SingletonExecutable ee = (SingletonExecutable ) le .executable ();
129
+ assertEquals (1 , ee .output ().size ());
130
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("'foo'{c}#" ));
131
+ }
132
+
133
+ public void testFoldingToLocalExecWithAggregationAndOrderBy () {
134
+ PhysicalPlan p = plan ("SELECT 'foo' FROM test GROUP BY 1 ORDER BY 1" );
135
+ assertEquals (LocalExec .class , p .getClass ());
136
+ LocalExec le = (LocalExec ) p ;
137
+ assertEquals (SingletonExecutable .class , le .executable ().getClass ());
138
+ SingletonExecutable ee = (SingletonExecutable ) le .executable ();
139
+ assertEquals (1 , ee .output ().size ());
140
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("'foo'{c}#" ));
141
+ }
142
+
143
+ public void testFoldingToLocalExecWithAggregationAndOrderByAndLimit () {
144
+ PhysicalPlan p = plan ("SELECT 'foo' FROM test GROUP BY 1 ORDER BY 1 LIMIT 10" );
145
+ assertEquals (LocalExec .class , p .getClass ());
146
+ LocalExec le = (LocalExec ) p ;
147
+ assertEquals (SingletonExecutable .class , le .executable ().getClass ());
148
+ SingletonExecutable ee = (SingletonExecutable ) le .executable ();
149
+ assertEquals (1 , ee .output ().size ());
150
+ assertThat (ee .output ().get (0 ).toString (), startsWith ("'foo'{c}#" ));
151
+ }
152
+
93
153
public void testLocalExecWithoutFromClause () {
94
154
PhysicalPlan p = plan ("SELECT E(), 'foo', abs(10)" );
95
155
assertEquals (LocalExec .class , p .getClass ());
0 commit comments