This commit is contained in:
avogar 2024-04-04 20:00:22 +00:00
parent 3e1e434833
commit 0f5a3eae7e
3 changed files with 10 additions and 10 deletions

View File

@ -83,7 +83,7 @@ public:
static ColumnWithTypeAndName createScalar(ContextPtr context_)
{
if (const auto * block = context_->tryGetSpecialScalar(Scalar::scalar_name))
if (auto block = context_->tryGetSpecialScalar(Scalar::scalar_name))
return block->getByPosition(0);
else if (context_->hasQueryContext())
{

View File

@ -48,7 +48,7 @@
#include <Interpreters/SessionTracker.h>
#include <Core/ServerSettings.h>
#include <Interpreters/PreparedSets.h>
#include <Core/Settings.h>
//#include <Core/Settings.h>
#include <Core/SettingsQuirks.h>
#include <Access/AccessControl.h>
#include <Access/ContextAccess.h>
@ -1550,14 +1550,14 @@ ClassifierPtr Context::getWorkloadClassifier() const
}
const Scalars & Context::getScalars() const
Scalars Context::getScalars() const
{
std::lock_guard lock(mutex);
return scalars;
}
const Block & Context::getScalar(const String & name) const
Block Context::getScalar(const String & name) const
{
std::lock_guard lock(mutex);
@ -1571,13 +1571,13 @@ const Block & Context::getScalar(const String & name) const
return it->second;
}
const Block * Context::tryGetSpecialScalar(const String & name) const
std::optional<Block> Context::tryGetSpecialScalar(const String & name) const
{
std::lock_guard lock(mutex);
auto it = special_scalars.find(name);
if (special_scalars.end() == it)
return nullptr;
return &it->second;
return std::nullopt;
return it->second;
}
Tables Context::getExternalTables() const

View File

@ -680,12 +680,12 @@ public:
std::shared_ptr<TemporaryTableHolder> findExternalTable(const String & table_name) const;
std::shared_ptr<TemporaryTableHolder> removeExternalTable(const String & table_name);
const Scalars & getScalars() const;
const Block & getScalar(const String & name) const;
Scalars getScalars() const;
Block getScalar(const String & name) const;
void addScalar(const String & name, const Block & block);
bool hasScalar(const String & name) const;
const Block * tryGetSpecialScalar(const String & name) const;
std::optional<Block> tryGetSpecialScalar(const String & name) const;
void addSpecialScalar(const String & name, const Block & block);
const QueryAccessInfo & getQueryAccessInfo() const { return *getQueryAccessInfoPtr(); }