Skip to content
Draft
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
3 changes: 2 additions & 1 deletion .github/workflows/build_pyvelox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [8-core-ubuntu, macos-13, macos-14]
os: [8-core-ubuntu, macos-15-intel, macos-15]
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
Expand Down Expand Up @@ -83,6 +83,7 @@ jobs:
echo "CMAKE_PREFIX_PATH=$INSTALL_PREFIX" >> $GITHUB_ENV
echo "INSTALL_PREFIX=$INSTALL_PREFIX" >> $GITHUB_ENV
echo "DYLD_LIBRARY_PATH=$INSTALL_PREFIX/lib:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
echo "$INSTALL_PREFIX/bin" >> "$GITHUB_PATH"

source scripts/setup-macos.sh
install_build_prerequisites
Expand Down
4 changes: 2 additions & 2 deletions velox/expression/VectorReaders.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct ConstantVectorReader {

std::optional<exec_in_t> value;

explicit ConstantVectorReader<T>(ConstantVector<exec_in_t>& vector) {
explicit ConstantVectorReader(ConstantVector<exec_in_t>& vector) {
if (!vector.isNullAt(0)) {
value = *vector.rawValues();
}
Expand Down Expand Up @@ -160,7 +160,7 @@ struct FlatVectorReader {
const exec_in_t* values;
FlatVector<exec_in_t>* vector;

explicit FlatVectorReader<T>(FlatVector<exec_in_t>& baseVector)
explicit FlatVectorReader(FlatVector<exec_in_t>& baseVector)
: values(baseVector.rawValues()), vector(&baseVector) {}

exec_in_t operator[](vector_size_t offset) const {
Expand Down
31 changes: 18 additions & 13 deletions velox/functions/sparksql/tests/ToJsonTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
#include "velox/common/base/tests/GTestUtils.h"
#include "velox/common/testutil/OptionalEmpty.h"
#include "velox/functions/sparksql/tests/JsonTestUtil.h"

using namespace facebook::velox::test;
Expand Down Expand Up @@ -53,9 +54,9 @@ TEST_F(ToJsonTest, basicStruct) {

TEST_F(ToJsonTest, basicArray) {
auto input = makeNullableArrayVector<int64_t>(
{{{1}},
{{2, std::nullopt, 3}},
{std::vector<std::optional<int64_t>>{}},
{std::vector<std::optional<int64_t>>{1},
std::vector<std::optional<int64_t>>{2, std::nullopt, 3},
common::testutil::optionalEmpty,
std::nullopt});
auto expected = makeNullableFlatVector<std::string>(
{R"([1])", R"([2,null,3])", R"([])", std::nullopt});
Expand All @@ -65,20 +66,24 @@ TEST_F(ToJsonTest, basicArray) {
TEST_F(ToJsonTest, basicMap) {
// MAP(VARCHAR, BIGINT)
auto input = makeNullableMapVector<std::string, int64_t>(
{{{{"a", 1}, {"b", 2}, {"c", 3}}},
{std::vector<std::pair<std::string, std::optional<int64_t>>>{
{"a", 1}, {"b", 2}, {"c", 3}},
std::nullopt,
{std::vector<std::pair<std::string, std::optional<int64_t>>>{}},
{{{"a", 1}, {"b", std::nullopt}}}});
common::testutil::optionalEmpty,
std::vector<std::pair<std::string, std::optional<int64_t>>>{
{"a", 1}, {"b", std::nullopt}}});
auto expected = makeNullableFlatVector<std::string>(
{R"({"a":1,"b":2,"c":3})", std::nullopt, R"({})", R"({"a":1,"b":null})"});
testToJson(input, expected);

// MAP(BIGINT, VARCHAR)
input = makeNullableMapVector<int64_t, std::string>(
{{{{1, "a"}, {2, "b"}, {3, "c"}}},
{std::vector<std::pair<int64_t, std::optional<std::string>>>{
{1, "a"}, {2, "b"}, {3, "c"}},
std::nullopt,
{std::vector<std::pair<int64_t, std::optional<std::string>>>{}},
{{{1, "a"}, {2, std::nullopt}}}});
common::testutil::optionalEmpty,
std::vector<std::pair<int64_t, std::optional<std::string>>>{
{1, "a"}, {2, std::nullopt}}});
expected = makeNullableFlatVector<std::string>(
{R"({"1":"a","2":"b","3":"c"})",
std::nullopt,
Expand Down Expand Up @@ -284,10 +289,10 @@ TEST_F(ToJsonTest, nestedMap) {
auto data1 = makeNullableFlatVector<int32_t>(
{0, 18321, -25567, 2932896, std::nullopt}, DateType::get());
auto data2 = makeNullableArrayVector<std::string>(
{{{"a", "b", std::nullopt}},
{std::vector<std::optional<std::string>>{}},
{{"d", "e"}},
{{"f", std::nullopt, "h"}},
{std::vector<std::optional<std::string>>{"a", "b", std::nullopt},
common::testutil::optionalEmpty,
std::vector<std::optional<std::string>>{"d", "e"},
std::vector<std::optional<std::string>>{"f", std::nullopt, "h"},
std::nullopt});
auto data3 = makeNullableFlatVector<double>(
{1.0, kNaNDouble, kInfDouble, -kInfDouble, std::nullopt});
Expand Down
21 changes: 9 additions & 12 deletions velox/vector/tests/FlatMapVectorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "velox/common/base/VeloxException.h"
#include "velox/common/base/tests/GTestUtils.h"
#include "velox/common/memory/Memory.h"
#include "velox/common/testutil/OptionalEmpty.h"
#include "velox/vector/tests/utils/VectorMaker.h"
#include "velox/vector/tests/utils/VectorTestBase.h"

Expand Down Expand Up @@ -443,17 +443,14 @@ TEST_F(FlatMapVectorTest, sortedKeyIndices) {
}

TEST_F(FlatMapVectorTest, toString) {
auto vector = maker_.flatMapVectorNullable<int64_t, int64_t>({
std::optional{std::vector<std::pair<int64_t, std::optional<int64_t>>>{}},
std::optional<std::vector<std::pair<int64_t, std::optional<int64_t>>>>{
std::nullopt},
std::optional<std::vector<std::pair<int64_t, std::optional<int64_t>>>>{
{{1, {0}}}},
std::optional<std::vector<std::pair<int64_t, std::optional<int64_t>>>>{
{{1, {1}}, {2, {std::nullopt}}}},
std::optional<std::vector<std::pair<int64_t, std::optional<int64_t>>>>{
{{0, {0}}, {1, {1}}, {2, {2}}, {3, {3}}, {4, {4}}, {5, {5}}}},
});
auto vector = maker_.flatMapVectorNullable<int64_t, int64_t>(
{common::testutil::optionalEmpty,
std::nullopt,
std::vector<std::pair<int64_t, std::optional<int64_t>>>{{1, 0}},
std::vector<std::pair<int64_t, std::optional<int64_t>>>{
{1, 1}, {2, std::nullopt}},
std::vector<std::pair<int64_t, std::optional<int64_t>>>{
{0, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}});

EXPECT_EQ(
vector->toString(), "[FLAT_MAP MAP<BIGINT,BIGINT>: 5 elements, 1 nulls]");
Expand Down
Loading