diff --git a/ydb/public/api/protos/draft/fq.proto b/ydb/public/api/protos/draft/fq.proto index 9551b56ab9db..763701ba6bd3 100644 --- a/ydb/public/api/protos/draft/fq.proto +++ b/ydb/public/api/protos/draft/fq.proto @@ -118,7 +118,7 @@ message QueryContent { string name = 2 [(Ydb.length).le = 1024]; Acl acl = 3; Limits limits = 4; - string text = 5 [(Ydb.length).le = 102400]; // The text of the query itself + string text = 5 [(Ydb.length).range = {min: 1, max: 102400}]; // The text of the query itself bool automatic = 6; // Is used for queries that are created by automatic systems (robots, jdbc driver, ...) string description = 7 [(Ydb.length).le = 10240]; // Description of the query, there can be any text // Specified settings for query's executor diff --git a/ydb/tests/fq/http_api/test_http_api.py b/ydb/tests/fq/http_api/test_http_api.py index f7132c5a9828..c514210f711e 100644 --- a/ydb/tests/fq/http_api/test_http_api.py +++ b/ydb/tests/fq/http_api/test_http_api.py @@ -121,58 +121,12 @@ def test_simple_analitycs_query(self): def test_empty_query(self): client = self.create_client() - result = client.create_query() - query_id = result.get("id") - - wait_for_query_status(client, query_id, ["FAILED"]) - query_json = client.get_query(query_id) - assert normalize_json(query_json) == { - "id": "xxxxxxxxxxxxxxxxxxxx", - "name": "", - "description": "", - "text": "", - "type": "ANALYTICS", - "status": "FAILED", - "issues": { - "message": "{
: Error: Query failed with code ABORTED at ISOTIME subissue: " - "{
: Error: Failed to parse query subissue: " - "{
: Error: Parse Sql subissue: " - "{
:1:0: Error: Unexpected token absence : cannot match to any predicted input... " - "} } } }", - "details": [ - { - "message": "Query failed with code ABORTED at ISOTIME", - "severity": "ERROR", - "issues": [ - { - "message": "Failed to parse query", - "severity": "ERROR", - "issues": [ - { - "message": "Parse Sql", - "severity": "ERROR", - "issues": [ - { - "position": {"row": 1}, - "message": "Unexpected token absence : cannot match to any predicted input...\u000a", - "end_position": {"row": 1}, - "severity": "ERROR", - "issues": [] - } - ] - } - ] - } - ] - } - ] - }, - "meta": { - "finished_at": "ISOTIME", - "started_at": "ISOTIME" - }, - "result_sets": [] - } + try: + result = client.create_query() + except Exception as e: + assert "\"message\":\"text\'s length is not in [1; 102400]" in e.args[0] + return + assert False def test_warning(self): client = self.create_client() diff --git a/ydb/tests/fq/s3/test_empty.py b/ydb/tests/fq/s3/test_empty.py new file mode 100644 index 000000000000..a964e46c1bde --- /dev/null +++ b/ydb/tests/fq/s3/test_empty.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import pytest + +import ydb.public.api.protos.draft.fq_pb2 as fq + +from ydb.tests.tools.fq_runner.fq_client import FederatedQueryException +from ydb.tests.tools.fq_runner.kikimr_utils import yq_all + + +class TestS3(object): + + @yq_all + @pytest.mark.parametrize("client", [{"folder_id": "my_folder"}], indirect=True) + def test_empty(self, kikimr, client): + try: + client.create_query("simple", "", type=fq.QueryContent.QueryType.ANALYTICS).result.query_id + except FederatedQueryException as e: + assert "message: \"text\\\'s length is not in [1; 102400]" in e.args[0] + return + assert False + diff --git a/ydb/tests/fq/s3/ya.make b/ydb/tests/fq/s3/ya.make index 54bd7ac3dc55..eb4f4829ebc8 100644 --- a/ydb/tests/fq/s3/ya.make +++ b/ydb/tests/fq/s3/ya.make @@ -23,6 +23,7 @@ TEST_SRCS( test_bindings.py test_compressions.py test_early_finish.py + test_empty.py test_explicit_partitioning.py test_format_setting.py test_formats.py