Better exception messages

This commit is contained in:
Alexey Milovidov 2023-10-08 22:54:33 +02:00
parent 0b939fae5d
commit 2aaddcce18
3 changed files with 3 additions and 3 deletions

View File

@ -684,7 +684,7 @@ 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");
throw Exception(ErrorCodes::SAMPLING_NOT_SUPPORTED, "Illegal SAMPLE: table {} doesn't support sampling", storage->getStorageID().getNameForLogs());
if (query.final() && (input_pipe || !storage || !storage->supportsFinal()))
{

View File

@ -629,7 +629,7 @@ MergeTreeDataSelectSamplingData MergeTreeDataSelectExecutor::getSampling(
RelativeSize size_of_universum = 0;
const auto & sampling_key = metadata_snapshot->getSamplingKey();
DataTypePtr sampling_column_type = sampling_key.data_types[0];
DataTypePtr sampling_column_type = sampling_key.data_types.at(0);
if (sampling_key.data_types.size() == 1)
{

View File

@ -458,7 +458,7 @@ void ReadFromMerge::initializePipeline(QueryPipelineBuilder & pipeline, const Bu
/// If sampling requested, then check that table supports it.
if (sampling_requested && !storage->supportsSampling())
throw Exception(ErrorCodes::SAMPLING_NOT_SUPPORTED, "Illegal SAMPLE: table doesn't support sampling");
throw Exception(ErrorCodes::SAMPLING_NOT_SUPPORTED, "Illegal SAMPLE: table {} doesn't support sampling", storage->getStorageID().getNameForLogs());
Aliases aliases;
auto storage_metadata_snapshot = storage->getInMemoryMetadataPtr();