mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #55541 from ClickHouse/sample-segfault
Better exception messages but without SEGFAULT
This commit is contained in:
commit
b6b92f46cc
@ -684,7 +684,15 @@ InterpreterSelectQuery::InterpreterSelectQuery(
|
||||
if (!options.only_analyze)
|
||||
{
|
||||
if (query.sampleSize() && (input_pipe || !storage || !storage->supportsSampling()))
|
||||
throw Exception(ErrorCodes::SAMPLING_NOT_SUPPORTED, "Illegal SAMPLE: table {} doesn't support sampling", storage->getStorageID().getNameForLogs());
|
||||
{
|
||||
if (storage)
|
||||
throw Exception(
|
||||
ErrorCodes::SAMPLING_NOT_SUPPORTED,
|
||||
"Storage {} doesn't support sampling",
|
||||
storage->getStorageID().getNameForLogs());
|
||||
else
|
||||
throw Exception(ErrorCodes::SAMPLING_NOT_SUPPORTED, "Illegal SAMPLE: sampling is only allowed with the table engines that support it");
|
||||
}
|
||||
|
||||
if (query.final() && (input_pipe || !storage || !storage->supportsFinal()))
|
||||
{
|
||||
|
1
tests/queries/0_stateless/02896_illegal_sampling.sql
Normal file
1
tests/queries/0_stateless/02896_illegal_sampling.sql
Normal file
@ -0,0 +1 @@
|
||||
SELECT * FROM (SELECT 1) SAMPLE 1 / 2; -- { serverError SAMPLING_NOT_SUPPORTED, UNSUPPORTED_METHOD }
|
Loading…
Reference in New Issue
Block a user