Skip to content

Commit 27280fc

Browse files
committed
Extract all inlined sql invoked functions into a new plugin presto-sql-invoked-functions-plugin
1 parent 4cf74fc commit 27280fc

File tree

52 files changed

+343
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+343
-80
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@
221221
<module>presto-function-server</module>
222222
<module>presto-router-example-plugin-scheduler</module>
223223
<module>presto-plan-checker-router-plugin</module>
224+
<module>presto-sql-invoked-functions-plugin</module>
224225
<module>presto-spark-classloader-spark${dep.pos.classloader.module-name.suffix}</module>
225226
</modules>
226227

presto-hive/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,12 @@
494494
</exclusion>
495495
</exclusions>
496496
</dependency>
497+
<dependency>
498+
<groupId>com.facebook.presto</groupId>
499+
<artifactId>presto-sql-invoked-functions-plugin</artifactId>
500+
<version>${project.version}</version>
501+
<scope>test</scope>
502+
</dependency>
497503
</dependencies>
498504

499505
<build>

presto-hive/src/test/java/com/facebook/presto/hive/TestDistributedQueriesSingleNode.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414
package com.facebook.presto.hive;
1515

16+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1617
import com.facebook.presto.testing.QueryRunner;
1718
import com.facebook.presto.tests.AbstractTestDistributedQueries;
1819
import com.google.common.collect.ImmutableMap;
@@ -32,11 +33,13 @@ protected QueryRunner createQueryRunner()
3233
{
3334
ImmutableMap.Builder<String, String> coordinatorProperties = ImmutableMap.builder();
3435
coordinatorProperties.put("single-node-execution-enabled", "true");
35-
return HiveQueryRunner.createQueryRunner(
36+
QueryRunner queryRunner = HiveQueryRunner.createQueryRunner(
3637
getTables(),
3738
ImmutableMap.of(),
3839
coordinatorProperties.build(),
3940
Optional.empty());
41+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
42+
return queryRunner;
4043
}
4144

4245
@Override

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveDistributedNanQueries.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
package com.facebook.presto.hive;
1616

17+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1718
import com.facebook.presto.testing.QueryRunner;
1819
import com.facebook.presto.tests.AbstractTestNanQueries;
1920
import com.google.common.collect.ImmutableList;
@@ -28,6 +29,9 @@ public class TestHiveDistributedNanQueries
2829
protected QueryRunner createQueryRunner()
2930
throws Exception
3031
{
31-
return HiveQueryRunner.createQueryRunner(ImmutableList.of(), ImmutableMap.of("use-new-nan-definition", "true"), ImmutableMap.of(), Optional.empty());
32+
QueryRunner queryRunner =
33+
HiveQueryRunner.createQueryRunner(ImmutableList.of(), ImmutableMap.of("use-new-nan-definition", "true"), ImmutableMap.of(), Optional.empty());
34+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
35+
return queryRunner;
3236
}
3337
}

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveDistributedQueries.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import com.facebook.presto.Session;
1717
import com.facebook.presto.hive.TestHiveEventListenerPlugin.TestingHiveEventListener;
18+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1819
import com.facebook.presto.spi.QueryId;
1920
import com.facebook.presto.spi.eventlistener.EventListener;
2021
import com.facebook.presto.testing.MaterializedResult;
@@ -59,7 +60,9 @@ public class TestHiveDistributedQueries
5960
protected QueryRunner createQueryRunner()
6061
throws Exception
6162
{
62-
return HiveQueryRunner.createQueryRunner(getTables());
63+
QueryRunner queryRunner = HiveQueryRunner.createQueryRunner(getTables());
64+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
65+
return queryRunner;
6366
}
6467

6568
@Override

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveDistributedQueriesWithExchangeMaterialization.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.facebook.presto.hive;
1515

1616
import com.facebook.presto.Session;
17+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1718
import com.facebook.presto.testing.MaterializedResult;
1819
import com.facebook.presto.testing.QueryRunner;
1920
import com.facebook.presto.tests.AbstractTestDistributedQueries;
@@ -40,7 +41,9 @@ public class TestHiveDistributedQueriesWithExchangeMaterialization
4041
protected QueryRunner createQueryRunner()
4142
throws Exception
4243
{
43-
return createMaterializingQueryRunner(getTables());
44+
QueryRunner queryRunner = createMaterializingQueryRunner(getTables());
45+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
46+
return queryRunner;
4447
}
4548

4649
@Test

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveDistributedQueriesWithOptimizedRepartitioning.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414
package com.facebook.presto.hive;
1515

16+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1617
import com.facebook.presto.testing.QueryRunner;
1718
import com.facebook.presto.tests.AbstractTestDistributedQueries;
1819
import com.google.common.collect.ImmutableMap;
@@ -30,13 +31,15 @@ public class TestHiveDistributedQueriesWithOptimizedRepartitioning
3031
protected QueryRunner createQueryRunner()
3132
throws Exception
3233
{
33-
return HiveQueryRunner.createQueryRunner(
34+
QueryRunner queryRunner = HiveQueryRunner.createQueryRunner(
3435
getTables(),
3536
ImmutableMap.of(
3637
"experimental.optimized-repartitioning", "true",
3738
// Use small SerializedPages to force flushing
3839
"driver.max-page-partitioning-buffer-size", "10000B"),
3940
Optional.empty());
41+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
42+
return queryRunner;
4043
}
4144

4245
@Override

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveDistributedQueriesWithThriftRpc.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414
package com.facebook.presto.hive;
1515

16+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1617
import com.facebook.presto.testing.QueryRunner;
1718
import com.facebook.presto.tests.AbstractTestDistributedQueries;
1819
import com.google.common.collect.ImmutableMap;
@@ -30,13 +31,15 @@ public class TestHiveDistributedQueriesWithThriftRpc
3031
protected QueryRunner createQueryRunner()
3132
throws Exception
3233
{
33-
return HiveQueryRunner.createQueryRunner(
34+
QueryRunner queryRunner = HiveQueryRunner.createQueryRunner(
3435
getTables(),
3536
ImmutableMap.of(
3637
"internal-communication.task-communication-protocol", "THRIFT",
3738
"internal-communication.server-info-communication-protocol", "THRIFT"),
3839
ImmutableMap.of(),
3940
Optional.empty());
41+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
42+
return queryRunner;
4043
}
4144

4245
@Override

presto-hive/src/test/java/com/facebook/presto/hive/TestHivePushdownDistributedQueries.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*/
1414
package com.facebook.presto.hive;
1515

16+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1617
import com.facebook.presto.testing.MaterializedResult;
1718
import com.facebook.presto.testing.QueryRunner;
1819
import com.facebook.presto.tests.AbstractTestDistributedQueries;
@@ -34,7 +35,7 @@ public class TestHivePushdownDistributedQueries
3435
protected QueryRunner createQueryRunner()
3536
throws Exception
3637
{
37-
return HiveQueryRunner.createQueryRunner(
38+
QueryRunner queryRunner = HiveQueryRunner.createQueryRunner(
3839
getTables(),
3940
ImmutableMap.of("experimental.pushdown-subfields-enabled", "true",
4041
"experimental.pushdown-dereference-enabled", "true"),
@@ -44,6 +45,8 @@ protected QueryRunner createQueryRunner()
4445
"hive.partial_aggregation_pushdown_enabled", "true",
4546
"hive.partial_aggregation_pushdown_for_variable_length_datatypes_enabled", "true"),
4647
Optional.empty());
48+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
49+
return queryRunner;
4750
}
4851

4952
@Override

presto-hive/src/test/java/com/facebook/presto/hive/TestLambdaSubfieldPruning.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
package com.facebook.presto.hive;
1515

1616
import com.facebook.presto.Session;
17+
import com.facebook.presto.scalar.sql.SqlInvokedFunctionsPlugin;
1718
import com.facebook.presto.testing.QueryRunner;
1819
import com.facebook.presto.tests.AbstractTestQueryFramework;
1920
import com.facebook.presto.tests.DistributedQueryRunner;
@@ -126,6 +127,7 @@ private static DistributedQueryRunner createLineItemExTable(DistributedQueryRunn
126127

127128
"FROM lineitem \n");
128129
}
130+
queryRunner.installPlugin(new SqlInvokedFunctionsPlugin());
129131
return queryRunner;
130132
}
131133

0 commit comments

Comments
 (0)