harbby / presto-connectors

facebook presto connectors
Apache License 2.0
49 stars 22 forks source link

Function match_query not registered #3

Closed tooptoop4 closed 6 years ago

tooptoop4 commented 6 years ago

/home/ec2-user/presto-server-0.210/plugin/presto-elasticsearch5/ has animal-sniffer-annotations-1.14.jar httpcore-4.4.5.jar logback-core-1.2.3.jar netty-common-4.1.7.Final.jar aopalliance-1.0.jar httpcore-nio-4.4.5.jar log-manager-0.172.jar netty-handler-4.1.7.Final.jar bootstrap-0.172.jar j2objc-annotations-1.1.jar lucene-analyzers-common-7.2.1.jar netty-resolver-4.1.7.Final.jar bval-core-1.1.1.jar jackson-core-2.8.1.jar lucene-backward-codecs-6.4.1.jar netty-transport-4.1.7.Final.jar bval-jsr-1.1.1.jar jackson-databind-2.8.1.jar lucene-core-6.4.1.jar percolator-client-5.3.0.jar cglib-nodep-3.2.5.jar jackson-dataformat-cbor-2.8.6.jar lucene-grouping-6.4.1.jar presto-base-elasticsearch-0.210.jar checker-compat-qual-2.0.0.jar jackson-dataformat-yaml-2.8.6.jar lucene-highlighter-6.4.1.jar presto-elasticsearch5-0.210.jar commons-beanutils-core-1.8.3.jar javax.annotation-api-1.3.1.jar lucene-join-6.4.1.jar reindex-client-5.3.0.jar commons-codec-1.10.jar javax.inject-1.jar lucene-memory-6.4.1.jar rest-5.3.0.jar commons-lang3-3.4.jar jaxb-api-2.2.6.jar lucene-misc-6.4.1.jar securesm-1.1.jar commons-logging-1.1.3.jar jaxb-impl-2.2.6.jar lucene-queries-6.4.1.jar slf4j-api-1.7.25.jar compiler-0.9.3.jar jmxutils-1.19.jar lucene-queryparser-6.4.1.jar slf4j-jdk14-1.7.25.jar configuration-0.172.jar jna-4.2.2.jar lucene-sandbox-6.4.1.jar snakeyaml-1.15.jar elasticsearch-5.3.0.jar joda-time-2.9.9.jar lucene-spatial3d-6.4.1.jar t-digest-3.0.jar error_prone_annotations-2.1.3.jar jopt-simple-5.0.2.jar lucene-spatial-6.4.1.jar transport-5.3.0.jar guava-24.1-jre.jar jsr305-3.0.2.jar lucene-spatial-extras-6.4.1.jar transport-netty3-client-5.3.0.jar guice-4.2.0.jar lang-mustache-client-5.3.0.jar lucene-suggest-6.4.1.jar transport-netty4-client-5.3.0.jar HdrHistogram-2.1.6.jar log-0.172.jar netty-3.10.6.Final.jar validation-api-1.1.0.Final.jar hppc-0.7.1.jar log4j-api-2.11.1.jar netty-buffer-4.1.7.Final.jar httpasyncclient-4.1.2.jar log4j-core-2.11.1.jar netty-codec-4.1.7.Final.jar httpclient-4.5.2.jar log4j-over-slf4j-1.7.25.jar netty-codec-http-4.1.7.Final.jar

presto> select from elasticsearch.default.metacat where name = match_query('Lucy'); Query 20180917_002811_00007_skjd4 failed: line 1:58: Function match_query not registered com.facebook.presto.sql.analyzer.SemanticException: line 1:58: Function match_query not registered at com.facebook.presto.sql.analyzer.ExpressionAnalyzer.resolveFunction(ExpressionAnalyzer.java:1421) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitFunctionCall(ExpressionAnalyzer.java:861) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitFunctionCall(ExpressionAnalyzer.java:305) at com.facebook.presto.sql.tree.FunctionCall.accept(FunctionCall.java:119) at com.facebook.presto.sql.tree.StackableAstVisitor.process(StackableAstVisitor.java:26) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.process(ExpressionAnalyzer.java:326) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.getOperator(ExpressionAnalyzer.java:1232) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitComparisonExpression(ExpressionAnalyzer.java:484) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.visitComparisonExpression(ExpressionAnalyzer.java:305) at com.facebook.presto.sql.tree.ComparisonExpression.accept(ComparisonExpression.java:71) at com.facebook.presto.sql.tree.StackableAstVisitor.process(StackableAstVisitor.java:26) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer$Visitor.process(ExpressionAnalyzer.java:326) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer.analyze(ExpressionAnalyzer.java:271) at com.facebook.presto.sql.analyzer.ExpressionAnalyzer.analyzeExpression(ExpressionAnalyzer.java:1569) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.analyzeExpression(StatementAnalyzer.java:1918) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.analyzeWhere(StatementAnalyzer.java:1754) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.lambda$visitQuerySpecification$10(StatementAnalyzer.java:956) at java.util.Optional.ifPresent(Optional.java:159) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:956) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.visitQuerySpecification(StatementAnalyzer.java:258) at com.facebook.presto.sql.tree.QuerySpecification.accept(QuerySpecification.java:127) at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:270) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:280) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:676) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.visitQuery(StatementAnalyzer.java:258) at com.facebook.presto.sql.tree.Query.accept(Query.java:94) at com.facebook.presto.sql.tree.AstVisitor.process(AstVisitor.java:27) at com.facebook.presto.sql.analyzer.StatementAnalyzer$Visitor.process(StatementAnalyzer.java:270) at com.facebook.presto.sql.analyzer.StatementAnalyzer.analyze(StatementAnalyzer.java:244) at com.facebook.presto.sql.analyzer.Analyzer.analyze(Analyzer.java:72) at com.facebook.presto.sql.analyzer.Analyzer.analyze(Analyzer.java:64) at com.facebook.presto.execution.SqlQueryExecution.(SqlQueryExecution.java:176) at com.facebook.presto.execution.SqlQueryExecution$SqlQueryExecutionFactory.createQueryExecution(SqlQueryExecution.java:705) at com.facebook.presto.execution.SqlQueryManager.createQueryInternal(SqlQueryManager.java:444) at com.facebook.presto.execution.SqlQueryManager.lambda$createQuery$3(SqlQueryManager.java:377) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) select from elasticsearch.default.metacat where name = match_query('Lucy')

If I copy jars from /home/ec2-user/presto-server-0.210/plugin/presto-elasticsearch5/ to /home/ec2-user/presto-server-0.210/plugin/udfs then presto startup fails with: ERROR main com.facebook.presto.server.PrestoServer Connector elasticsearch5 is already registered java.lang.IllegalArgumentException: Connector elasticsearch5 is already registered

harbby commented 6 years ago

sorry
This function is commented out, as follows You can remove the comment yourself first.

public class Elasticsearch5Plugin
        extends ElasticsearchPlugin
{
    @Override
    public Set<Class<?>> getFunctions()
    {
        return ImmutableSet.<Class<?>>builder()
//                .add(MatchQueryFunction.class)
                .build();
    }