Название таблицы «лайк» в vespa.ai - PullRequest
1 голос
/ 30 сентября 2019

Запрещено ли имя таблицы like в движке Vespa?

YQL:

select * from sources like where text contains "test";

Результат:

{
  "root": {
    "id": "toplevel",
    "relevance": 1,
    "fields": {
      "totalCount": 0
    },
    "errors": [
      {
        "code": 4,
        "summary": "Invalid query parameter",
        "message": "Could not instantiate query from YQL",
        "stackTrace": "java.lang.IllegalArgumentException: com.yahoo.search.yql.ProgramCompileException: query:L1:22 extraneous input 'like' expecting {'inner', 'paged', 'fallback', 'limit', 'offset', 'where', 'order by', 'as', 'left', 'join', 'output', '(', '|', '.', ';', 'timeout', ID}\n\tat com.yahoo.search.yql.YqlParser.parseYqlProgram(YqlParser.java:713)\n\tat com.yahoo.search.yql.YqlParser.parse(YqlParser.java:252)\n\tat com.yahoo.search.yql.MinimalQueryInserter.insertQuery(MinimalQueryInserter.java:77)\n\tat com.yahoo.search.yql.MinimalQueryInserter.search(MinimalQueryInserter.java:123)\n\tat com.yahoo.search.Searcher.process(Searcher.java:133)\n\tat com.yahoo.processing.execution.Execution.process(Execution.java:112)\n\tat com.yahoo.search.searchchain.Execution.search(Execution.java:497)\n\tat com.yahoo.prelude.searcher.FieldCollapsingSearcher.search(FieldCollapsingSearcher.java:102)\n\tat com.yahoo.search.Searcher.process(Searcher.java:133)\n\tat com.yahoo.processing.execution.Execution.process(Execution.java:112)\n\tat com.yahoo.search.searchchain.Execution.search(Execution.java:497)\n\tat com.yahoo.prelude.querytransform.PhrasingSearcher.search(PhrasingSearcher.java:60)\n\tat com.yahoo.search.Searcher.process(Searcher.java:133)\n\tat com.yahoo.processing.execution.Execution.process(Execution.java:112)\n\tat com.yahoo.search.searchchain.Execution.search(Execution.java:497)\n\tat com.yahoo.prelude.statistics.StatisticsSearcher.search(StatisticsSearcher.java:234)\n\tat com.yahoo.search.Searcher.process(Searcher.java:133)\n\tat com.yahoo.processing.execution.Execution.process(Execution.java:112)\n\tat com.yahoo.search.searchchain.Execution.search(Execution.java:497)\n\tat com.yahoo.search.handler.SearchHandler.searchAndFill(SearchHandler.java:338)\n\tat com.yahoo.search.handler.SearchHandler.search(SearchHandler.java:390)\n\tat com.yahoo.search.handler.SearchHandler.handleBody(SearchHandler.java:278)\n\tat com.yahoo.search.handler.SearchHandler.handle(SearchHandler.java:191)\n\tat com.yahoo.container.jdisc.ThreadedHttpRequestHandler.handle(ThreadedHttpRequestHandler.java:65)\n\tat com.yahoo.container.jdisc.ThreadedHttpRequestHandler.handleRequest(ThreadedHttpRequestHandler.java:78)\n\tat com.yahoo.container.jdisc.ThreadedRequestHandler$RequestTask.processRequest(ThreadedRequestHandler.java:180)\n\tat com.yahoo.container.jdisc.ThreadedRequestHandler$RequestTask.run(ThreadedRequestHandler.java:174)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\nCaused by: com.yahoo.search.yql.ProgramCompileException: query:L1:22 extraneous input 'like' expecting {'inner', 'paged', 'fallback', 'limit', 'offset', 'where', 'order by', 'as', 'left', 'join', 'output', '(', '|', '.', ';', 'timeout', ID}\n\tat com.yahoo.search.yql.ProgramParser$2.syntaxError(ProgramParser.java:159)\n\tat org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:65)\n\tat org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:558)\n\tat org.antlr.v4.runtime.DefaultErrorStrategy.reportUnwantedToken(DefaultErrorStrategy.java:377)\n\tat org.antlr.v4.runtime.DefaultErrorStrategy.singleTokenDeletion(DefaultErrorStrategy.java:541)\n\tat org.antlr.v4.runtime.DefaultErrorStrategy.sync(DefaultErrorStrategy.java:266)\n\tat com.yahoo.search.yql.yqlplusParser.namespaced_name(yqlplusParser.java:3435)\n\tat com.yahoo.search.yql.yqlplusParser.call_source(yqlplusParser.java:3323)\n\tat com.yahoo.search.yql.yqlplusParser.data_source(yqlplusParser.java:3253)\n\tat com.yahoo.search.yql.yqlplusParser.source_spec(yqlplusParser.java:3093)\n\tat com.yahoo.search.yql.yqlplusParser.select_source_join(yqlplusParser.java:2831)\n\tat com.yahoo.search.yql.yqlplusParser.select_source(yqlplusParser.java:2677)\n\tat com.yahoo.search.yql.yqlplusParser.select_statement(yqlplusParser.java:2280)\n\tat com.yahoo.search.yql.yqlplusParser.query_statement(yqlplusParser.java:2047)\n\tat com.yahoo.search.yql.yqlplusParser.source_statement(yqlplusParser.java:1414)\n\tat com.yahoo.search.yql.yqlplusParser.output_statement(yqlplusParser.java:1236)\n\tat com.yahoo.search.yql.yqlplusParser.statement(yqlplusParser.java:1167)\n\tat com.yahoo.search.yql.yqlplusParser.program(yqlplusParser.java:471)\n\tat com.yahoo.search.yql.ProgramParser.parseProgram(ProgramParser.java:169)\n\tat com.yahoo.search.yql.ProgramParser.parse(ProgramParser.java:185)\n\tat com.yahoo.search.yql.YqlParser.parseYqlProgram(YqlParser.java:711)\n\t... 29 more\n"
      }
    ]
  }
}

Ответы [ 2 ]

2 голосов
/ 30 сентября 2019

Это не зарезервированное слово, но, к сожалению, парсер YQL так считает. Я исправил это в https://github.com/vespa-engine/vespa/pull/10822

Я исправил это в https://github.com/vespa-engine/vespa/pull/10822 - должен быть выпущен завтра.

Так как это только в синтаксическом анализаторе YQL, вы можете использовать это имя источниканапример, в другом месте передайте его как отдельный параметр HTTP с именем «sources».

0 голосов
/ 30 сентября 2019

Нет, это не зарезервировано, но имя источника не должно заключаться в кавычки.

select * from sources like where text contains "test";

...