Skip to content
Closed
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
34 changes: 17 additions & 17 deletions velox/connectors/hive/HivePartitionUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@

namespace facebook::velox::connector::hive {

#define PARTITION_TYPE_DISPATCH(TEMPLATE_FUNC, typeKind, ...) \
[&]() { \
switch (typeKind) { \
case TypeKind::BOOLEAN: \
case TypeKind::TINYINT: \
case TypeKind::SMALLINT: \
case TypeKind::INTEGER: \
case TypeKind::BIGINT: \
case TypeKind::VARCHAR: \
case TypeKind::VARBINARY: \
case TypeKind::TIMESTAMP: \
return VELOX_DYNAMIC_SCALAR_TYPE_DISPATCH( \
TEMPLATE_FUNC, typeKind, __VA_ARGS__); \
default: \
VELOX_UNSUPPORTED( \
"Unsupported partition type: {}", mapTypeKindToName(typeKind)); \
} \
#define PARTITION_TYPE_DISPATCH(TEMPLATE_FUNC, typeKind, ...) \
[&]() { \
switch (typeKind) { \
case TypeKind::BOOLEAN: \
case TypeKind::TINYINT: \
case TypeKind::SMALLINT: \
case TypeKind::INTEGER: \
case TypeKind::BIGINT: \
case TypeKind::VARCHAR: \
case TypeKind::VARBINARY: \
case TypeKind::TIMESTAMP: \
return VELOX_DYNAMIC_SCALAR_TYPE_DISPATCH( \
TEMPLATE_FUNC, typeKind, __VA_ARGS__); \
default: \
VELOX_UNSUPPORTED( \
"Unsupported partition type: {}", TypeKindName::toName(typeKind)); \
} \
}()

namespace {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class HivePartitionFunctionBenchmark
void run(HivePartitionFunction* function) {
if (rowVectors_.find(KIND) == rowVectors_.end()) {
throw std::runtime_error(
fmt::format("Unsupported type {}.", mapTypeKindToName(KIND)));
fmt::format("Unsupported type {}.", TypeKindName::toName(KIND)));
}
function->partition(*rowVectors_[KIND], partitions_);
}
Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/common/TypeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ void checkTypeCompatibility(
VELOX_SCHEMA_MISMATCH_ERROR(fmt::format(
"{}, From Kind: {}, To Kind: {}",
exceptionMessageCreator ? exceptionMessageCreator() : "Schema mismatch",
mapTypeKindToName(from.kind()),
mapTypeKindToName(kind(to))));
TypeKindName::toName(from.kind()),
TypeKindName::toName(kind(to))));
}

if (recurse) {
Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/dwrf/reader/SelectiveDwrfReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ std::unique_ptr<SelectiveColumnReader> SelectiveDwrfReader::build(
default:
VELOX_FAIL(
"buildReader unhandled type: " +
mapTypeKindToName(fileType->type()->kind()));
std::string(TypeKindName::toName(fileType->type()->kind())));
}
}

Expand Down
4 changes: 2 additions & 2 deletions velox/dwio/dwrf/writer/ColumnWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ std::unique_ptr<BaseColumnWriter> BaseColumnWriter::create(
"MAP_FLAT_COLS contains column {}, but the root type of this column is {}."
" Column root types must be of type MAP",
type.column(),
mapTypeKindToName(type.type()->kind()));
TypeKindName::toName(type.type()->kind()));
}
const auto structColumnKeys =
context.getConfig(Config::MAP_FLAT_COLS_STRUCT_KEYS);
Expand Down Expand Up @@ -2212,7 +2212,7 @@ std::unique_ptr<BaseColumnWriter> BaseColumnWriter::create(
}
default:
VELOX_FAIL(
"not supported yet: {}", mapTypeKindToName(type.type()->kind()));
"not supported yet: {}", TypeKindName::toName(type.type()->kind()));
}
}
} // namespace facebook::velox::dwrf
2 changes: 1 addition & 1 deletion velox/dwio/parquet/reader/ParquetColumnReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ std::unique_ptr<dwio::common::SelectiveColumnReader> ParquetColumnReader::build(
default:
VELOX_FAIL(
"buildReader unhandled type: " +
mapTypeKindToName(fileType->type()->kind()));
std::string(TypeKindName::toName(fileType->type()->kind())));
}
}

Expand Down
2 changes: 1 addition & 1 deletion velox/dwio/text/writer/TextWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void TextWriter::writeCellValue(
[[fallthrough]];
default:
VELOX_NYI(
"Text writer does not support type {}", mapTypeKindToName(type));
"Text writer does not support type {}", TypeKindName::toName(type));
}

VELOX_CHECK(
Expand Down
2 changes: 1 addition & 1 deletion velox/exec/PrefixSort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ FOLLY_ALWAYS_INLINE void extractRowColumnToPrefix(
default:
VELOX_UNSUPPORTED(
"prefix-sort does not support type kind: {}",
mapTypeKindToName(typeKind));
TypeKindName::toName(typeKind));
}
}

Expand Down
58 changes: 29 additions & 29 deletions velox/exec/VectorHasher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,35 @@

namespace facebook::velox::exec {

#define VALUE_ID_TYPE_DISPATCH(TEMPLATE_FUNC, typeKind, ...) \
[&]() { \
switch (typeKind) { \
case TypeKind::BOOLEAN: { \
return TEMPLATE_FUNC<TypeKind::BOOLEAN>(__VA_ARGS__); \
} \
case TypeKind::TINYINT: { \
return TEMPLATE_FUNC<TypeKind::TINYINT>(__VA_ARGS__); \
} \
case TypeKind::SMALLINT: { \
return TEMPLATE_FUNC<TypeKind::SMALLINT>(__VA_ARGS__); \
} \
case TypeKind::INTEGER: { \
return TEMPLATE_FUNC<TypeKind::INTEGER>(__VA_ARGS__); \
} \
case TypeKind::BIGINT: { \
return TEMPLATE_FUNC<TypeKind::BIGINT>(__VA_ARGS__); \
} \
case TypeKind::VARCHAR: \
case TypeKind::VARBINARY: { \
return TEMPLATE_FUNC<TypeKind::VARCHAR>(__VA_ARGS__); \
} \
case TypeKind::TIMESTAMP: { \
return TEMPLATE_FUNC<TypeKind::TIMESTAMP>(__VA_ARGS__); \
} \
default: \
VELOX_UNREACHABLE( \
"Unsupported value ID type: ", mapTypeKindToName(typeKind)); \
} \
#define VALUE_ID_TYPE_DISPATCH(TEMPLATE_FUNC, typeKind, ...) \
[&]() { \
switch (typeKind) { \
case TypeKind::BOOLEAN: { \
return TEMPLATE_FUNC<TypeKind::BOOLEAN>(__VA_ARGS__); \
} \
case TypeKind::TINYINT: { \
return TEMPLATE_FUNC<TypeKind::TINYINT>(__VA_ARGS__); \
} \
case TypeKind::SMALLINT: { \
return TEMPLATE_FUNC<TypeKind::SMALLINT>(__VA_ARGS__); \
} \
case TypeKind::INTEGER: { \
return TEMPLATE_FUNC<TypeKind::INTEGER>(__VA_ARGS__); \
} \
case TypeKind::BIGINT: { \
return TEMPLATE_FUNC<TypeKind::BIGINT>(__VA_ARGS__); \
} \
case TypeKind::VARCHAR: \
case TypeKind::VARBINARY: { \
return TEMPLATE_FUNC<TypeKind::VARCHAR>(__VA_ARGS__); \
} \
case TypeKind::TIMESTAMP: { \
return TEMPLATE_FUNC<TypeKind::TIMESTAMP>(__VA_ARGS__); \
} \
default: \
VELOX_UNREACHABLE( \
"Unsupported value ID type: ", TypeKindName::toName(typeKind)); \
} \
}()

namespace {
Expand Down
3 changes: 2 additions & 1 deletion velox/exec/tests/utils/QueryAssertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "velox/duckdb/conversion/DuckConversion.h"
#include "velox/exec/Cursor.h"
#include "velox/exec/tests/utils/QueryAssertions.h"
#include "velox/type/Type.h"
#include "velox/vector/VariantToVector.h"
#include "velox/vector/VectorTypeUtils.h"

Expand Down Expand Up @@ -709,7 +710,7 @@ std::string toTypeString(const MaterializedRow& row) {
if (i > 0) {
out << ", ";
}
out << mapTypeKindToName(row[i].kind());
out << TypeKindName::toName(row[i].kind());
}
out << ")";
return out.str();
Expand Down
2 changes: 1 addition & 1 deletion velox/experimental/cudf/exec/ExpressionEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cudf::ast::literal makeScalarAndLiteral(
// TODO for non-numeric types too.
VELOX_NYI(
"Non-numeric types not yet implemented for kind " +
mapTypeKindToName(kind));
std::string(TypeKindName::toName(kind)));
}
}

Expand Down
4 changes: 3 additions & 1 deletion velox/experimental/cudf/exec/VeloxCudfInterop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ cudf::type_id veloxToCudfTypeId(const TypePtr& type) {
// case TypeKind::OPAQUE: return cudf::type_id::EMPTY;
// case TypeKind::INVALID: return cudf::type_id::EMPTY;
default:
CUDF_FAIL("Unsupported Velox type: " + mapTypeKindToName(type->kind()));
CUDF_FAIL(
"Unsupported Velox type: " +
std::string(TypeKindName::toName(type->kind())));
return cudf::type_id::EMPTY;
}
}
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/CheckNestedNulls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ bool checkNestedNulls(
VELOX_USER_CHECK(
!decoded.base()->containsNullAt(indices[index]),
"{} comparison not supported for values that contain nulls",
mapTypeKindToName(decoded.base()->typeKind()));
TypeKindName::toName(decoded.base()->typeKind()));
}

return false;
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/lib/Re2Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ std::shared_ptr<exec::VectorFunction> makeRe2Extract(
groupIdTypeKind == TypeKind::BIGINT,
"{} requires third argument of type INTEGER or BIGINT, but got {}",
name,
mapTypeKindToName(groupIdTypeKind));
TypeKindName::toName(groupIdTypeKind));
}

BaseVector* constantPattern = inputArgs[1].constantValue.get();
Expand Down Expand Up @@ -2360,7 +2360,7 @@ std::shared_ptr<exec::VectorFunction> makeRe2ExtractAll(
groupIdTypeKind == TypeKind::BIGINT,
"{} requires third argument of type INTEGER or BIGINT, but got {}",
name,
mapTypeKindToName(groupIdTypeKind));
TypeKindName::toName(groupIdTypeKind));
}

BaseVector* constantPattern = inputArgs[1].constantValue.get();
Expand Down
6 changes: 3 additions & 3 deletions velox/functions/lib/Slice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SliceFunction : public exec::VectorFunction {
VELOX_CHECK(
kind == TypeKind::BIGINT || kind == TypeKind::INTEGER,
"Unsupported parameter type {} to register slice function",
mapTypeKindToName(kind));
TypeKindName::toName(kind));
}

void apply(
Expand All @@ -71,7 +71,7 @@ class SliceFunction : public exec::VectorFunction {
args[1]->typeKind(),
kind_,
"Function slice() requires second argument of type {}",
mapTypeKindToName(kind_));
TypeKindName::toName(kind_));
VELOX_USER_CHECK_EQ(
args[1]->typeKind(),
args[2]->typeKind(),
Expand Down Expand Up @@ -213,7 +213,7 @@ class SliceFunction : public exec::VectorFunction {

// @param kind The type kind of start and length.
void registerSliceFunction(const std::string& prefix, TypeKind kind) {
auto kindName = exec::sanitizeName(mapTypeKindToName(kind));
auto kindName = exec::sanitizeName(std::string(TypeKindName::toName(kind)));

std::vector<std::shared_ptr<exec::FunctionSignature>> signatures = {
exec::FunctionSignatureBuilder()
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/SubscriptUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class SubscriptImpl : public exec::Subscript {
default:
VELOX_UNSUPPORTED(
"Unsupported type for element_at index {}",
mapTypeKindToName(indexArg->typeKind()));
TypeKindName::toName(indexArg->typeKind()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/aggregates/Compare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int32_t compare(
result.has_value(),
fmt::format(
"{} comparison not supported for values that contain nulls",
mapTypeKindToName(decoded.base()->typeKind())));
TypeKindName::toName(decoded.base()->typeKind())));
return result.value();
}
} // namespace facebook::velox::functions::aggregate
2 changes: 1 addition & 1 deletion velox/functions/lib/window/NthValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void registerNthValue(const std::string& name, TypeKind offsetTypeKind) {
.typeVariable("T")
.returnType("T")
.argumentType("T")
.argumentType(mapTypeKindToName(offsetTypeKind))
.argumentType(std::string(TypeKindName::toName(offsetTypeKind)))
.build(),
};

Expand Down
2 changes: 1 addition & 1 deletion velox/functions/lib/window/RowNumber.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class RowNumberFunction : public exec::WindowFunction {
void registerRowNumber(const std::string& name, TypeKind resultTypeKind) {
std::vector<exec::FunctionSignaturePtr> signatures{
exec::FunctionSignatureBuilder()
.returnType(mapTypeKindToName(resultTypeKind))
.returnType(std::string(TypeKindName::toName(resultTypeKind)))
.build(),
};

Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/MapKeysAndValues.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class MapKeysFunction : public MapKeyValueFunction {
VELOX_CHECK(
arg->typeKind() == TypeKind::MAP,
"Unsupported type for map_keys function {}",
mapTypeKindToName(arg->typeKind()));
TypeKindName::toName(arg->typeKind()));

auto mapVector = arg->as<MapVector>();
auto mapKeys = mapVector->mapKeys();
Expand Down Expand Up @@ -108,7 +108,7 @@ class MapValuesFunction : public MapKeyValueFunction {
VELOX_CHECK(
arg->typeKind() == TypeKind::MAP,
"Unsupported type for map_values function {}",
mapTypeKindToName(arg->typeKind()));
TypeKindName::toName(arg->typeKind()));

auto mapVector = arg->as<MapVector>();
auto mapValues = mapVector->mapValues();
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/prestosql/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SplitFunction : public exec::VectorFunction {
default:
VELOX_FAIL(
"Unsupported type for 'limit' argument of 'split' function: {}",
mapTypeKindToName(limitType));
TypeKindName::toName(limitType));
}
}

Expand Down
2 changes: 1 addition & 1 deletion velox/functions/prestosql/aggregates/MapAggAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ void registerMapAggAggregate(
return std::make_unique<MapAggAggregate<int32_t>>(resultType);
default:
VELOX_UNREACHABLE(
"Unexpected type {}", mapTypeKindToName(typeKind));
"Unexpected type {}", TypeKindName::toName(typeKind));
}
},
withCompanionFunctions,
Expand Down
2 changes: 1 addition & 1 deletion velox/functions/prestosql/aggregates/MapAggregateBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ std::unique_ptr<exec::Aggregate> createMapAggregate(const TypePtr& resultType) {
case TypeKind::UNKNOWN:
return std::make_unique<TAggregate<int32_t>>(resultType);
default:
VELOX_UNREACHABLE("Unexpected type {}", mapTypeKindToName(typeKind));
VELOX_UNREACHABLE("Unexpected type {}", TypeKindName::toName(typeKind));
}
}

Expand Down
4 changes: 2 additions & 2 deletions velox/functions/prestosql/aggregates/MapUnionSumAggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ std::unique_ptr<exec::Aggregate> createMapUnionSumAggregate(
return std::make_unique<MapUnionSumAggregate<K, double>>(resultType);
default:
VELOX_UNREACHABLE(
"Unexpected value type {}", mapTypeKindToName(valueKind));
"Unexpected value type {}", TypeKindName::toName(valueKind));
}
}

Expand Down Expand Up @@ -563,7 +563,7 @@ void registerMapUnionSumAggregate(
valueTypeKind, resultType);
}
VELOX_UNREACHABLE(
"Unexpected key type {}", mapTypeKindToName(keyTypeKind));
"Unexpected key type {}", TypeKindName::toName(keyTypeKind));
}
},
withCompanionFunctions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ void registerMultiMapAggAggregate(
return std::make_unique<MultiMapAggAggregate<int32_t>>(resultType);
default:
VELOX_UNREACHABLE(
"Unexpected type {}", mapTypeKindToName(typeKind));
"Unexpected type {}", TypeKindName::toName(typeKind));
}
},
withCompanionFunctions,
Expand Down
Loading
Loading