Skip to content

Commit

Permalink
cast null as string
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE authored and yma11 committed May 6, 2024
1 parent 1f0d7bb commit c53214e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions velox/duckdb/conversion/DuckConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ LogicalType fromVeloxType(const TypePtr& type) {
}

switch (type->kind()) {
case TypeKind::UNKNOWN:
return LogicalType::SQLNULL;
case TypeKind::BOOLEAN:
return LogicalType::BOOLEAN;
case TypeKind::TINYINT:
Expand Down
3 changes: 2 additions & 1 deletion velox/exec/tests/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ target_link_libraries(
velox_tpch_connector
velox_presto_serializer
velox_functions_prestosql
velox_aggregates)
velox_aggregates
duckdb_static)
3 changes: 3 additions & 0 deletions velox/exec/tests/utils/QueryAssertions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@ std::vector<MaterializedRow> materialize(
auto value = variant(::duckdb::Date::EpochDays(
dataChunk->GetValue(j, i).GetValue<::duckdb::date_t>()));
row.push_back(value);
} else if (typeKind == TypeKind::UNKNOWN) {
auto value = variant(TypeKind::UNKNOWN);
row.push_back(value);
} else {
auto value = VELOX_DYNAMIC_SCALAR_TYPE_DISPATCH(
variantAt, typeKind, dataChunk, i, j);
Expand Down
2 changes: 2 additions & 0 deletions velox/functions/prestosql/types/JsonType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,8 @@ simdjson::error_code appendMapKey(
using T = typename TypeTraits<kind>::NativeType;
if constexpr (std::is_same_v<T, void>) {
return simdjson::INCORRECT_TYPE;
} else if constexpr (std::is_same_v<T, UnknownValue>) {
return simdjson::EMPTY;
} else {
SIMDJSON_ASSIGN_OR_RAISE(writer.castTo<T>(), fromString<T>(value));
return simdjson::SUCCESS;
Expand Down
1 change: 1 addition & 0 deletions velox/functions/sparksql/Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ void registerFunctions(const std::string& prefix) {
exec::registerStatefulVectorFunction(
prefix + "rlike", re2SearchSignatures(), makeRLike);
// VELOX_REGISTER_VECTOR_FUNCTION(udf_regexp_split, prefix + "split");
registerRegexpReplace(prefix);
exec::registerStatefulVectorFunction(
prefix + "split", re2SplitAllSignatures(), makeRe2SplitAll);

Expand Down
4 changes: 0 additions & 4 deletions velox/type/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -1430,10 +1430,6 @@ std::shared_ptr<const OpaqueType> OPAQUE() {
return TEMPLATE_FUNC<::facebook::velox::TypeKind::TIMESTAMP>( \
__VA_ARGS__); \
} \
case ::facebook::velox::TypeKind::UNKNOWN: { \
return TEMPLATE_FUNC<::facebook::velox::TypeKind::UNKNOWN>( \
__VA_ARGS__); \
} \
default: \
VELOX_FAIL( \
"not a scalar type! kind: {}", mapTypeKindToName(typeKind)); \
Expand Down

0 comments on commit c53214e

Please sign in to comment.