fix code typo

This commit is contained in:
taiyang-li 2021-11-24 16:35:11 +08:00
parent 89dcef69d5
commit 13226c9bbf
7 changed files with 32 additions and 34 deletions

View File

@ -1842,9 +1842,9 @@ HMSClientPtr Context::getHMSClient(const String & name) const
if (it == shared->hive_metastore_clients.end() || it->second->isExpired()) if (it == shared->hive_metastore_clients.end() || it->second->isExpired())
{ {
// connect to hive metastore // connect to hive metastore
Poco::URI hms_url(name); Poco::URI hive_metastore_url(name);
const auto& host = hms_url.getHost(); const auto & host = hive_metastore_url.getHost();
auto port = hms_url.getPort(); auto port = hive_metastore_url.getPort();
std::shared_ptr<TSocket> socket = std::make_shared<TSocket>(host, port); std::shared_ptr<TSocket> socket = std::make_shared<TSocket>(host, port);
socket->setKeepAlive(true); socket->setKeepAlive(true);

View File

@ -133,12 +133,13 @@ std::vector<HMSClient::FileInfo> HMSClient::HiveTableMeta::getLocationFiles(cons
auto fs_builder = createHDFSBuilder(getNameNodeUrl(table->sd.location), getContext()->getGlobalContext()->getConfigRef()); auto fs_builder = createHDFSBuilder(getNameNodeUrl(table->sd.location), getContext()->getGlobalContext()->getConfigRef());
auto fs = createHDFSFS(fs_builder.get()); auto fs = createHDFSFS(fs_builder.get());
Poco::URI uri(location); Poco::URI uri(location);
HDFSFileInfo ls; HDFSFileInfo dir_info;
ls.file_info = hdfsListDirectory(fs.get(), uri.getPath().c_str(), &ls.length); dir_info.file_info = hdfsListDirectory(fs.get(), uri.getPath().c_str(), &dir_info.length);
auto result = std::make_shared<std::vector<FileInfo>>(); auto result = std::make_shared<std::vector<FileInfo>>();
for (int i = 0; i < ls.length; ++i) for (int i = 0; i < dir_info.length; ++i)
{ {
auto & finfo = ls.file_info[i]; auto & finfo = dir_info.file_info[i];
/// skip directories and empty files, mKind value 'D' represents directory, otherwise file
if (finfo.mKind != 'D' && finfo.mSize > 0) if (finfo.mKind != 'D' && finfo.mSize > 0)
result->emplace_back(String(finfo.mName), finfo.mLastMod, finfo.mSize); result->emplace_back(String(finfo.mName), finfo.mLastMod, finfo.mSize);
} }

View File

@ -20,9 +20,9 @@ public:
struct FileInfo struct FileInfo
{ {
FileInfo() = default; FileInfo() = default;
FileInfo(const std::string & path_, UInt64 ts_, size_t size_) : path(path_), last_mod_ts(ts_), size(size_) { } FileInfo(const std::string & path_, UInt64 last_modify_time_, size_t size_) : path(path_), last_modify_time(last_modify_time_), size(size_) { }
std::string path; std::string path;
UInt64 last_mod_ts; // in ms UInt64 last_modify_time; // in ms
size_t size; size_t size;
}; };

View File

@ -24,20 +24,20 @@
namespace DB namespace DB
{ {
template <class T, class S> template <class FieldType, class StatisticsType>
Range createRangeFromOrcStatistics(const S * stats) Range createRangeFromOrcStatistics(const StatisticsType * stats)
{ {
if (stats->hasMinimum() && stats->hasMaximum()) if (stats->hasMinimum() && stats->hasMaximum())
{ {
return Range(T(stats->getMinimum()), true, T(stats->getMaximum()), true); return Range(FieldType(stats->getMinimum()), true, FieldType(stats->getMaximum()), true);
} }
else if (stats->hasMinimum()) else if (stats->hasMinimum())
{ {
return Range::createLeftBounded(T(stats->getMinimum()), true); return Range::createLeftBounded(FieldType(stats->getMinimum()), true);
} }
else if (stats->hasMaximum()) else if (stats->hasMaximum())
{ {
return Range::createRightBounded(T(stats->getMaximum()), true); return Range::createRightBounded(FieldType(stats->getMaximum()), true);
} }
else else
{ {
@ -45,12 +45,12 @@ Range createRangeFromOrcStatistics(const S * stats)
} }
} }
template <class T, class S> template <class FieldType, class StatisticsType>
Range createRangeFromParquetStatistics(std::shared_ptr<S> stats) Range createRangeFromParquetStatistics(std::shared_ptr<StatisticsType> stats)
{ {
if (!stats->HasMinMax()) if (!stats->HasMinMax())
return Range(); return Range();
return Range(T(stats->min()), true, T(stats->max()), true); return Range(FieldType(stats->min()), true, FieldType(stats->max()), true);
} }
Range createRangeFromParquetStatistics(std::shared_ptr<parquet::ByteArrayStatistics> stats) Range createRangeFromParquetStatistics(std::shared_ptr<parquet::ByteArrayStatistics> stats)

View File

@ -54,7 +54,7 @@ public:
const FieldVector & values_, const FieldVector & values_,
const String & namenode_url_, const String & namenode_url_,
const String & path_, const String & path_,
UInt64 ts_, UInt64 last_modify_time_,
size_t size_, size_t size_,
const NamesAndTypesList & index_names_and_types_, const NamesAndTypesList & index_names_and_types_,
const std::shared_ptr<HiveSettings> & storage_settings_, const std::shared_ptr<HiveSettings> & storage_settings_,
@ -63,14 +63,11 @@ public:
, partition_values(values_) , partition_values(values_)
, namenode_url(namenode_url_) , namenode_url(namenode_url_)
, path(path_) , path(path_)
, last_mod_ts(ts_) , last_modify_time(last_modify_time_)
, size(size_) , size(size_)
, index_names_and_types(index_names_and_types_) , index_names_and_types(index_names_and_types_)
, storage_settings(storage_settings_) , storage_settings(storage_settings_)
{ {
// std::cout << "1delim:" << storage_settings->hive_text_field_delimeter << std::endl;
// std::cout << "1disable orc:" << storage_settings->disable_orc_stripe_minmax_index << std::endl;
// std::cout << "1disable parquet:" << storage_settings->disable_parquet_rowgroup_minmax_index << std::endl;
} }
virtual ~IHiveFile() = default; virtual ~IHiveFile() = default;
@ -123,14 +120,14 @@ public:
return boost::algorithm::join(strs, "|"); return boost::algorithm::join(strs, "|");
} }
inline UInt64 getLastModTs() const { return last_mod_ts; } inline UInt64 getLastModTs() const { return last_modify_time; }
inline size_t getSize() const { return size; } inline size_t getSize() const { return size; }
protected: protected:
FieldVector partition_values; FieldVector partition_values;
String namenode_url; String namenode_url;
String path; String path;
UInt64 last_mod_ts; UInt64 last_modify_time;
size_t size; size_t size;
NamesAndTypesList index_names_and_types; NamesAndTypesList index_names_and_types;
std::shared_ptr<IMergeTreeDataPart::MinMaxIndex> minmax_idx; std::shared_ptr<IMergeTreeDataPart::MinMaxIndex> minmax_idx;
@ -146,12 +143,12 @@ public:
const FieldVector & values_, const FieldVector & values_,
const String & namenode_url_, const String & namenode_url_,
const String & path_, const String & path_,
UInt64 ts_, UInt64 last_modify_time_,
size_t size_, size_t size_,
const NamesAndTypesList & index_names_and_types_, const NamesAndTypesList & index_names_and_types_,
const std::shared_ptr<HiveSettings> & hive_settings_, const std::shared_ptr<HiveSettings> & hive_settings_,
ContextPtr context_) ContextPtr context_)
: IHiveFile(values_, namenode_url_, path_, ts_, size_, index_names_and_types_, hive_settings_, context_) : IHiveFile(values_, namenode_url_, path_, last_modify_time_, size_, index_names_and_types_, hive_settings_, context_)
{ {
} }
@ -167,12 +164,12 @@ public:
const FieldVector & values_, const FieldVector & values_,
const String & namenode_url_, const String & namenode_url_,
const String & path_, const String & path_,
UInt64 ts_, UInt64 last_modify_time_,
size_t size_, size_t size_,
const NamesAndTypesList & index_names_and_types_, const NamesAndTypesList & index_names_and_types_,
const std::shared_ptr<HiveSettings> & hive_settings_, const std::shared_ptr<HiveSettings> & hive_settings_,
ContextPtr context_) ContextPtr context_)
: IHiveFile(values_, namenode_url_, path_, ts_, size_, index_names_and_types_, hive_settings_, context_) : IHiveFile(values_, namenode_url_, path_, last_modify_time_, size_, index_names_and_types_, hive_settings_, context_)
{ {
} }
@ -202,12 +199,12 @@ public:
const FieldVector & values_, const FieldVector & values_,
const String & namenode_url_, const String & namenode_url_,
const String & path_, const String & path_,
UInt64 ts_, UInt64 last_modify_time_,
size_t size_, size_t size_,
const NamesAndTypesList & index_names_and_types_, const NamesAndTypesList & index_names_and_types_,
const std::shared_ptr<HiveSettings> & hive_settings_, const std::shared_ptr<HiveSettings> & hive_settings_,
ContextPtr context_) ContextPtr context_)
: IHiveFile(values_, namenode_url_, path_, ts_, size_, index_names_and_types_, hive_settings_, context_) : IHiveFile(values_, namenode_url_, path_, last_modify_time_, size_, index_names_and_types_, hive_settings_, context_)
{ {
} }

View File

@ -14,9 +14,9 @@ class ASTStorage;
#define HIVE_RELATED_SETTINGS(M) \ #define HIVE_RELATED_SETTINGS(M) \
M(Char, hive_text_field_delimeter, '\x01', "How to split one row of hive data with format text", 0) \ M(Char, hive_text_field_delimeter, '\x01', "How to split one row of hive data with format text", 0) \
M(Bool, disable_orc_stripe_minmax_index, true, "Disable using ORC stripe level minmax index.", 0) \ M(Bool, enable_orc_stripe_minmax_index, false, "Enable using ORC stripe level minmax index.", 0) \
M(Bool, disable_parquet_rowgroup_minmax_index, true, "Disable using Parquet row-group level minmax index.", 0) \ M(Bool, enable_parquet_rowgroup_minmax_index, false, "Enable using Parquet row-group level minmax index.", 0) \
M(Bool, disable_orc_file_minmax_index, false, "Disable using ORC file level minmax index.", 0) M(Bool, enable_orc_file_minmax_index, true, "Enable using ORC file level minmax index.", 0)
#define LIST_OF_HIVE_SETTINGS(M) \ #define LIST_OF_HIVE_SETTINGS(M) \
HIVE_RELATED_SETTINGS(M) \ HIVE_RELATED_SETTINGS(M) \

View File

@ -410,7 +410,7 @@ Pipe StorageHive::read(
fields, fields,
hdfs_namenode_url, hdfs_namenode_url,
hfile.path, hfile.path,
hfile.last_mod_ts, hfile.last_modify_time,
hfile.size, hfile.size,
hivefile_name_types, hivefile_name_types,
storage_settings, storage_settings,