|
| 1 | +/* |
| 2 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | + * you may not use this file except in compliance with the License. |
| 4 | + * You may obtain a copy of the License at |
| 5 | + * |
| 6 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * |
| 8 | + * Unless required by applicable law or agreed to in writing, software |
| 9 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | + * See the License for the specific language governing permissions and |
| 12 | + * limitations under the License. |
| 13 | + */ |
| 14 | +package com.facebook.presto.tests; |
| 15 | + |
| 16 | +import com.facebook.presto.testing.MaterializedResult; |
| 17 | +import com.facebook.presto.testing.QueryRunner; |
| 18 | +import org.intellij.lang.annotations.Language; |
| 19 | +import org.testng.annotations.Test; |
| 20 | + |
| 21 | +import static com.facebook.presto.testing.TestingSession.testSessionBuilder; |
| 22 | +import static org.testng.Assert.assertEquals; |
| 23 | + |
| 24 | +public class TestSetWorkerSessionPropertiesIncludingInvalidProperties |
| 25 | + extends AbstractTestQueryFramework |
| 26 | +{ |
| 27 | + @Override |
| 28 | + protected QueryRunner createQueryRunner() |
| 29 | + throws Exception |
| 30 | + { |
| 31 | + return DistributedQueryRunner.builder(testSessionBuilder().build()).build(); |
| 32 | + } |
| 33 | + |
| 34 | + @Test |
| 35 | + public void testSetSessionValidNativeWorkerSessionProperty() |
| 36 | + { |
| 37 | + // SET SESSION on a native-worker session property |
| 38 | + @Language("SQL") String setSession = "SET SESSION native_expression_max_array_size_in_reduce=50000"; |
| 39 | + MaterializedResult setSessionResult = computeActual(setSession); |
| 40 | + assertEquals( |
| 41 | + setSessionResult.toString(), |
| 42 | + "MaterializedResult{rows=[[true]], " + |
| 43 | + "types=[boolean], " + |
| 44 | + "setSessionProperties={native_expression_max_array_size_in_reduce=50000}, " + |
| 45 | + "resetSessionProperties=[], updateType=SET SESSION}"); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void testSetSessionValidJavaWorkerSessionProperty() |
| 50 | + { |
| 51 | + // SET SESSION on a java-worker session property |
| 52 | + @Language("SQL") String setSession = "SET SESSION distinct_aggregation_spill_enabled=false"; |
| 53 | + MaterializedResult setSessionResult = computeActual(setSession); |
| 54 | + assertEquals( |
| 55 | + setSessionResult.toString(), |
| 56 | + "MaterializedResult{rows=[[true]], " + |
| 57 | + "types=[boolean], " + |
| 58 | + "setSessionProperties={distinct_aggregation_spill_enabled=false}, " + |
| 59 | + "resetSessionProperties=[], updateType=SET SESSION}"); |
| 60 | + } |
| 61 | +} |
0 commit comments