Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
rui-mo committed Mar 23, 2021
1 parent 107b07b commit ab7773c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3671,7 +3671,7 @@ arrow::Status MakeUniqueAction(
type);
*out = std::dynamic_pointer_cast<ActionBase>(action_ptr);
} break;
case arrow::TimestampType::type_id: {
case arrow::TimestampType::type_id: {
auto action_ptr =
std::make_shared<UniqueAction<arrow::TimestampType, int64_t>>(ctx, type);
*out = std::dynamic_pointer_cast<ActionBase>(action_ptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ template <typename DataType, typename R = void>
using enable_if_number_or_date = std::enable_if_t<is_number_or_date<DataType>::value, R>;

template <typename DataType, typename R = void>
using enable_if_timestamp = std::enable_if_t<arrow::is_timestamp_type<DataType>::value, R>;
using enable_if_timestamp =
std::enable_if_t<arrow::is_timestamp_type<DataType>::value, R>;

template <typename DataType>
class ArrayAppender<DataType, enable_if_number_or_date<DataType>> : public AppenderBase {
Expand Down Expand Up @@ -457,7 +458,7 @@ class ArrayAppender<DataType, enable_if_timestamp<DataType>> : public AppenderBa
}

arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id) override {
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
Expand All @@ -469,7 +470,7 @@ class ArrayAppender<DataType, enable_if_timestamp<DataType>> : public AppenderBa
arrow::Status Append(const uint16_t& array_id, const uint16_t& item_id,
int repeated) override {
if (repeated == 0) return arrow::Status::OK();
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
if (has_null_ && cached_arr_[array_id]->null_count() > 0 &&
cached_arr_[array_id]->IsNull(item_id)) {
RETURN_NOT_OK(builder_->AppendNulls(repeated));
} else {
Expand All @@ -483,7 +484,7 @@ class ArrayAppender<DataType, enable_if_timestamp<DataType>> : public AppenderBa

arrow::Status Append(const std::vector<ArrayItemIndex>& index_list) {
for (auto tmp : index_list) {
if (has_null_ && cached_arr_[tmp.array_id]->null_count() > 0 &&
if (has_null_ && cached_arr_[tmp.array_id]->null_count() > 0 &&
cached_arr_[tmp.array_id]->IsNull(tmp.id)) {
RETURN_NOT_OK(builder_->AppendNull());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ std::string GetTemplateString(std::shared_ptr<arrow::DataType> type,
return template_name + "<" + prefix + "Date32" + tail + ">";
case arrow::Date64Type::type_id:
if (tail.empty())
return template_name + "<int64_t>";
return template_name + "<uint64_t>";
else
return template_name + "<" + prefix + "Date64" + tail + ">";
case arrow::StringType::type_id:
Expand All @@ -245,7 +245,7 @@ std::string GetTemplateString(std::shared_ptr<arrow::DataType> type,
return template_name + "<" + prefix + "Decimal128" + tail + ">";
case arrow::TimestampType::type_id:
if (tail.empty())
return template_name + "<uint64_t>";
return template_name + "<int64_t>";
else
return template_name + "<" + prefix + "Timestamp" + tail + ">";
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ namespace codegen {
namespace arrowcompute {
namespace extra {
using ArrayList = std::vector<std::shared_ptr<arrow::Array>>;
using precompile::StringHashMap;
using precompile::enable_if_number_or_timestamp;
using precompile::StringHashMap;

/////////////// SortArraysToIndices ////////////////
class HashAggregateKernel::Impl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ using ArrayList = std::vector<std::shared_ptr<arrow::Array>>;
using namespace sparkcolumnarplugin::precompile;

template <typename T>
using is_number_bool_date = std::integral_constant<bool,
arrow::is_number_type<T>::value || arrow::is_boolean_type<T>::value ||
arrow::is_date_type<T>::value || arrow::is_timestamp_type<T>::value>;
using is_number_bool_date = std::integral_constant<
bool, arrow::is_number_type<T>::value || arrow::is_boolean_type<T>::value ||
arrow::is_date_type<T>::value || arrow::is_timestamp_type<T>::value>;

/////////////// SortArraysToIndices ////////////////
class SortArraysToIndicesKernel::Impl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ using sparkcolumnarplugin::precompile::TypeTraits;
/////////////////////////////////////////////////////////////////////////

template <typename DataType>
class TypedHashRelation<DataType, enable_if_number_or_timestamp<DataType>> : public HashRelation {
class TypedHashRelation<DataType, enable_if_number_or_timestamp<DataType>>
: public HashRelation {
public:
using T = typename TypeTraits<DataType>::CType;
TypedHashRelation(
Expand Down
3 changes: 2 additions & 1 deletion native-sql-engine/cpp/src/precompile/hash_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ TYPED_ARROW_HASH_MAP_IMPL(StringHashMap, StringType, arrow::util::string_view,
StringMemoTableType)
TYPED_ARROW_HASH_MAP_DECIMAL_IMPL(Decimal128HashMap, Decimal128Type, arrow::Decimal128,
DecimalMemoTableType)
TYPED_ARROW_HASH_MAP_IMPL(TimestampHashMap, TimestampType, int64_t, TimestampMemoTableType)
TYPED_ARROW_HASH_MAP_IMPL(TimestampHashMap, TimestampType, int64_t,
TimestampMemoTableType)
#undef TYPED_ARROW_HASH_MAP_IMPL

} // namespace precompile
Expand Down
9 changes: 5 additions & 4 deletions native-sql-engine/cpp/src/precompile/type_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ using is_number_or_timestamp_type =
is_number_like_type<T>::value || is_timestamp_type<T>::value>;

template <typename T>
using enable_if_number_or_timestamp = std::enable_if_t<is_number_or_timestamp_type<T>::value>;
using enable_if_number_or_timestamp =
std::enable_if_t<is_number_or_timestamp_type<T>::value>;

template <typename T>
using is_number_decimal_or_timestamp_type =
std::integral_constant<bool,
is_number_like_type<T>::value || is_decimal_type<T>::value ||
is_timestamp_type<T>::value>;
std::integral_constant<bool, is_number_like_type<T>::value ||
is_decimal_type<T>::value ||
is_timestamp_type<T>::value>;

template <typename T>
using enable_if_boolean = std::enable_if_t<is_boolean_type<T>::value>;
Expand Down

0 comments on commit ab7773c

Please sign in to comment.