Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/src/cwrapper/tsfile_cwrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ bool tsfile_result_set_next(ResultSet result_set, ERRNO *err_code) {
const char *column_name) { \
auto *r = static_cast<storage::TableResultSet *>(result_set); \
std::string column_name_(column_name); \
return r->get_value<type>(storage::to_lower(column_name_)); \
return r->get_value<type>(column_name_); \
}

TSFILE_RESULT_SET_GET_VALUE_BY_NAME_DEF(bool);
Expand All @@ -329,7 +329,7 @@ char *tsfile_result_set_get_value_by_name_string(ResultSet result_set,
auto *r = static_cast<storage::TableResultSet *>(result_set);
std::string column_name_(column_name);
common::String *ret =
r->get_value<common::String *>(storage::to_lower(column_name_));
r->get_value<common::String *>(column_name_);
// Caller should free return's char* 's space.
char *dup = (char *)malloc(ret->len_ + 1);
if (dup) {
Expand Down
10 changes: 7 additions & 3 deletions cpp/src/reader/table_query_executor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,13 @@ int TableQueryExecutor::query(const std::string &table_name,
ret_qds = nullptr;
return ret;
}
std::vector<std::string> std_column_names(columns);
for (auto &column : std_column_names) {
to_lowercase_inplace(column);
}
std::shared_ptr<ColumnMapping> column_mapping = std::make_shared<ColumnMapping>();
for (size_t i = 0; i < columns.size(); ++i) {
column_mapping->add(columns[i], static_cast<int>(i), *table_schema);
for (size_t i = 0; i < std_column_names.size(); ++i) {
column_mapping->add(std_column_names[i], static_cast<int>(i), *table_schema);
}
std::vector<common::TSDataType> data_types;
data_types.reserve(columns.size());
Expand All @@ -57,7 +61,7 @@ int TableQueryExecutor::query(const std::string &table_name,
// column_mapping.add(*measurement_filter);

auto device_task_iterator = std::unique_ptr<DeviceTaskIterator>(
new DeviceTaskIterator(columns, table_root, column_mapping,
new DeviceTaskIterator(std_column_names, table_root, column_mapping,
meta_data_querier_, id_filter, table_schema));

std::unique_ptr<TsBlockReader> tsblock_reader;
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/reader/table_result_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int TableResultSet::next(bool& has_next) {
}

bool TableResultSet::is_null(const std::string& column_name) {
auto iter = index_lookup_.find(to_lower(column_name));
auto iter = index_lookup_.find(column_name);
if (iter == index_lookup_.end()) {
return true;
} else {
Expand Down
6 changes: 1 addition & 5 deletions cpp/src/reader/tsfile_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,11 @@ int TsFileReader::query(const std::string &table_name,
if (table_schema == nullptr) {
return E_TABLE_NOT_EXIST;
}
std::vector<std::string> columns_names_lowercase(columns_names);
for (auto &column_name : columns_names_lowercase) {
to_lowercase_inplace(column_name);
}

std::vector<TSDataType> data_types = table_schema->get_data_types();

Filter* time_filter = new TimeBetween(start_time, end_time, false);
ret = table_query_executor_->query(to_lower(table_name), columns_names_lowercase, time_filter, nullptr, nullptr, result_set);
ret = table_query_executor_->query(to_lower(table_name), columns_names, time_filter, nullptr, nullptr, result_set);
return ret;
}

Expand Down
2 changes: 0 additions & 2 deletions cpp/src/utils/storage_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#ifndef UTILS_STORAGE_UTILS_H
#define UTILS_STORAGE_UTILS_H

#include <inttypes.h>
#include <stdint.h>
#include <algorithm>

#include "common/datatype/value.h"
Expand Down
4 changes: 2 additions & 2 deletions cpp/test/cwrapper/c_release_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ TEST_F(CReleaseTest, TsFileWriterMultiDataType) {
ASSERT_EQ("device1", std::string(str_value));
free(str_value);
ASSERT_EQ(value, tsfile_result_set_get_value_by_name_int32_t(result_set,
"int32"));
"INT32"));
ASSERT_EQ(value * 100, tsfile_result_set_get_value_by_name_int64_t(
result_set, "int64"));
result_set, "INT64"));
ASSERT_EQ(value * 100.0, tsfile_result_set_get_value_by_name_float(
result_set, "FLOAT"));

Expand Down