Skip to content

Commit b1c6036

Browse files
committed
Refuse empty query text
1 parent 2d412df commit b1c6036

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

ydb/public/api/protos/draft/fq.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ message QueryContent {
118118
string name = 2 [(Ydb.length).le = 1024];
119119
Acl acl = 3;
120120
Limits limits = 4;
121-
string text = 5 [(Ydb.length).le = 102400]; // The text of the query itself
121+
string text = 5 [(Ydb.length).range = {min: 1, max: 102400}]; // The text of the query itself
122122
bool automatic = 6; // Is used for queries that are created by automatic systems (robots, jdbc driver, ...)
123123
string description = 7 [(Ydb.length).le = 10240]; // Description of the query, there can be any text
124124
// Specified settings for query's executor

ydb/tests/fq/s3/test_empty.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import boto3
5+
import json
6+
7+
import pytest
8+
9+
import ydb.public.api.protos.draft.fq_pb2 as fq
10+
11+
from ydb.tests.tools.fq_runner.fq_client import FederatedQueryException
12+
from ydb.tests.tools.fq_runner.kikimr_utils import yq_all
13+
14+
15+
class TestS3(object):
16+
17+
@yq_all
18+
@pytest.mark.parametrize("client", [{"folder_id": "my_folder"}], indirect=True)
19+
def test_empty(self, kikimr, client):
20+
try:
21+
client.create_query("simple", "", type=fq.QueryContent.QueryType.ANALYTICS).result.query_id
22+
except FederatedQueryException as e:
23+
assert "message: \"text\\\'s length is not in [1; 102400]" in e.args[0]
24+
pass

ydb/tests/fq/s3/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ TEST_SRCS(
2323
test_bindings.py
2424
test_compressions.py
2525
test_early_finish.py
26+
test_empty.py
2627
test_explicit_partitioning.py
2728
test_format_setting.py
2829
test_formats.py

0 commit comments

Comments
 (0)