Skip to content

Commit

Permalink
rebase to 2023/3/29
Browse files Browse the repository at this point in the history
  • Loading branch information
zhejiangxiaomai committed Mar 30, 2023
1 parent 462979e commit 4c6521e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ void registerSimpleFunctions(const std::string& prefix) {
registerFunction<YearFunction, int32_t, Date>({prefix + "year"});
registerFunction<YearFunction, int32_t, TimestampWithTimezone>(
{prefix + "year"});
registerFunction<YearFunction, int64_t, Timestamp>({prefix + "year"});
registerFunction<YearFunction, int64_t, Date>({prefix + "year"});
registerFunction<YearFunction, int64_t, TimestampWithTimezone>(
{prefix + "year"});
registerFunction<WeekFunction, int64_t, Timestamp>(
{prefix + "week", prefix + "week_of_year"});
registerFunction<WeekFunction, int64_t, Date>(
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/sparksql/MightContain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class BloomFilterMightContainFunction final : public exec::VectorFunction {
HashStringAllocator allocator{context.pool()};
if (serialized->isConstantMapping()) {
BloomFilter output{StlAllocator<uint64_t>(&allocator)};
output.merge(serialized->valueAt<StringView>(0).data());
output.merge(serialized->valueAt<StringView>(0).str().c_str());
rows.applyToSelected([&](int row) {
auto contain = output.mayContain(
folly::hasher<int64_t>()(value->valueAt<int64_t>(row)));
Expand All @@ -58,7 +58,7 @@ class BloomFilterMightContainFunction final : public exec::VectorFunction {

rows.applyToSelected([&](int row) {
BloomFilter output{StlAllocator<uint64_t>(&allocator)};
output.merge(serialized->valueAt<StringView>(0).data());
output.merge(serialized->valueAt<StringView>(0).str().c_str());
auto contain = output.mayContain(
folly::hasher<int64_t>()(value->valueAt<int64_t>(row)));
result.set(row, contain);
Expand Down
3 changes: 3 additions & 0 deletions velox/functions/sparksql/Register.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ static void workAroundRegistrationMacro(const std::string& prefix) {
udf_array_intersect, prefix + "array_intersect");
// This is the semantics of spark.sql.ansi.enabled = false.
VELOX_REGISTER_VECTOR_FUNCTION(udf_element_at, prefix + "element_at");
VELOX_REGISTER_VECTOR_FUNCTION(udf_concat_row, prefix + "named_struct");
VELOX_REGISTER_VECTOR_FUNCTION(
udf_map_allow_duplicates, prefix + "map_from_arrays");
// String functions.
Expand Down Expand Up @@ -117,6 +118,8 @@ void registerFunctions(const std::string& prefix) {
prefix + "greatest", greatestSignatures(), makeGreatest);
exec::registerStatefulVectorFunction(
prefix + "hash", hashSignatures(), makeHash);
exec::registerStatefulVectorFunction(
prefix + "murmur3hash", hashSignatures(), makeHash);
exec::registerStatefulVectorFunction(
prefix + "xxhash64", xxhash64Signatures(), makeXxHash64);
VELOX_REGISTER_VECTOR_FUNCTION(udf_map, prefix + "map");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class BloomFilterAggAggregate : public exec::Aggregate {
continue;
}
if (StringView::isInline(size)) {
StringView serialized(size);
char buffer[StringView::kInlineSize];
StringView serialized = StringView(buffer, size);
accumulator->serialize(serialized);
flatResult->setNoCopy(i, serialized);
} else {
Expand Down
4 changes: 2 additions & 2 deletions velox/type/DecimalUtilOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class DecimalUtilOp {

inline static int128_t ConvertToInt128(int256_t in) {
int128_t result;
int128_t INT128_MAX = int128_t(int128_t(-1L)) >> 1;
int128_t INT128_MAX_TMP = int128_t(int128_t(-1L)) >> 1;
constexpr int256_t UINT128_MASK = std::numeric_limits<uint128_t>::max();

int256_t in_abs = abs(in);
Expand All @@ -80,7 +80,7 @@ class DecimalUtilOp {
if (in_abs > 0) {
// we've shifted in by 128-bit, so nothing should be left.
VELOX_FAIL("in_abs overflow");
} else if (unsignResult > INT128_MAX) {
} else if (unsignResult > INT128_MAX_TMP) {
// the high-bit must not be set (signed 128-bit).
VELOX_FAIL("in_abs > int128 max");
} else {
Expand Down

0 comments on commit 4c6521e

Please sign in to comment.