8000 Feature/internal issue #672 by Dronplane · Pull Request #11370 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

Feature/internal issue #672 #11370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d41bf1b
Tests now passes
Dronplane Mar 25, 2020
6ab67ce
More tests
Dronplane Mar 25, 2020
cd77866
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Mar 25, 2020
c0ee917
Added compression settings
Dronplane Mar 25, 2020
d988302
Fixed storage compression settings
Dronplane Mar 25, 2020
9c7e874
reworked compression setting
Dronplane Mar 26, 2020
e431072
added mock compressor
Dronplane Mar 26, 2020
2cb1112
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Mar 26, 2020
b4daac1
fixed linking
Dronplane Mar 27, 2020
63f0fac
added primarySortCompression
Dronplane Mar 29, 2020
61975a8
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Mar 29, 2020
a92ce3b
Added tests
Dronplane Mar 30, 2020
5757c47
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Mar 30, 2020
ffa1248
fix tests for mac
Dronplane Mar 30, 2020
79561da
added primarySortCompression test
Dronplane Mar 30, 2020
e0b220f
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Mar 31, 2020
62ea27b
added primarySortCompression and storedValues compression to js tests.
Dronplane Apr 1, 2020
e6a390b
8000 more tests
Dronplane Apr 1, 2020
3b60ac0
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 1, 2020
80583ba
jslint fixes
Dronplane Apr 1, 2020
8a36791
code cleanup. Jaccard function fix for empty arrays
Dronplane Apr 1, 2020
b27ab6e
Update CHANGELOG
Dronplane Apr 1, 2020
e3f7746
Code cleanup. More tests
Dronplane Apr 1, 2020
8e12b0d
test fixes
Dronplane Apr 1, 2020
8c473c0
fixed bug
Dronplane Apr 1, 2020
373a884
test
Dronplane Apr 1, 2020
91d2f42
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 1, 2020
93dd5f8
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 2, 2020
5c9c0f5
adressed review comments
Dronplane Apr 2, 2020
f14afc2
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 2, 2020
6429477
Fix after merge
Dronplane Apr 2, 2020
8edfb98
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 2, 2020
975d709
Merge branch 'devel' into feature/internal-issue-#672
Dronplane Apr 2, 2020
693cd26
fix build
Dronplane Apr 2, 2020
a8a3dd5
cleanup
Dronplane Apr 2, 2020
523072b
cleanup
Dronplane Apr 2, 2020
da4c6f8
fixed backslash
Dronplane Apr 3, 2020
eafd1cf
fix
Dronplane Apr 3, 2020
022ee7a
fix typo
Dronplane Apr 3, 2020
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
2 changes: 1 addition & 1 deletion 3rdParty/iresearch/core/index/index_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const size_t NON_UPDATE_RECORD = irs::integer_traits<size_t>::const_max; // non-

const irs::column_info_provider_t DEFAULT_COLUMN_INFO = [](const irs::string_ref&) {
// no compression, no encryption
return irs::column_info{ irs::compression::raw::type(), {}, false };
return irs::column_info{ irs::compression::none::type(), {}, false };
};

struct flush_segment_context {
Expand Down
10 changes: 5 additions & 5 deletions 3rdParty/iresearch/core/utils/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ void init() {
#ifndef IRESEARCH_DLL
lz4::init();
delta::init();
raw::init();
none::init();
#endif
}

Expand All @@ -192,16 +192,16 @@ bool visit(const std::function<bool(const string_ref&)>& visitor) {
// --SECTION-- raw implementation
// -----------------------------------------------------------------------------

/*static*/ void raw::init() {
/*static*/ void none::init() {
#ifndef IRESEARCH_DLL
// match registration below
REGISTER_COMPRESSION(raw, &raw::compressor, &raw::decompressor);
REGISTER_COMPRESSION(none, &none::compressor, &none::decompressor);
#endif
}

DEFINE_COMPRESSION_TYPE(iresearch::compression::raw);
DEFINE_COMPRESSION_TYPE(iresearch::compression::none);

REGISTER_COMPRESSION(raw, &raw::compressor, &raw::decompressor);
REGISTER_COMPRESSION(none, &none::compressor, &none::decompressor);

NS_END // compression
NS_END
2 changes: 1 addition & 1 deletion 3rdParty/iresearch/core/utils/compression.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ IRESEARCH_API bool visit(const std::function<bool(const string_ref&)>& visitor);
/// @class raw
/// @brief no compression
////////////////////////////////////////////////////////////////////////////////
struct IRESEARCH_API raw {
struct IRESEARCH_API none {
DECLARE_COMPRESSION_TYPE();

static void init();
Expand Down
4 changes: 2 additions & 2 deletions 3rdParty/iresearch/tests/index/index_column_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ TEST_P(index_column_test_case, read_write_doc_attributes_sparse_column_dense_var
// sparse_column<dense_block>
irs::index_writer::init_options options;
options.column_info = [](const irs::string_ref&) {
return irs::column_info{ irs::compression::raw::type(), irs::compression::options{}, true };
return irs::column_info{ irs::compression::none::type(), irs::compression::options{}, true };
};

static const irs::doc_id_t BLOCK_SIZE = 1024;
Expand Down Expand Up @@ -3118,7 +3118,7 @@ TEST_P(index_column_test_case, read_write_doc_attributes_sparse_column_dense_fix

irs::index_writer::init_options options;
options.column_info = [](const irs::string_ref&) {
return irs::column_info{ irs::compression::raw::type(), irs::compression::options{}, false };
return irs::column_info{ irs::compression::none::type(), irs::compression::options{}, false };
};

// border case for sparse fixed offset columns, e.g.
Expand Down
2 changes: 1 addition & 1 deletion 3rdParty/iresearch/tests/index/sorted_column_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TEST(sorted_column_test, insert_duplicates) {

writer->prepare(dir, segment);

irs::sorted_column col({ irs::compression::raw::type(), {}, true });
irs::sorted_column col({ irs::compression::none::type(), {}, true });
ASSERT_TRUE(col.empty());
ASSERT_EQ(0, col.size());
ASSERT_EQ(0, col.memory_active());
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
devel
-----
* Added JACCARD AQL function

* storedValues property is removed from arngosearch link properties output.

* Added primarySortCompression property to ArangoSearch Views

* Added compression property to ArangoSearch View storedValues

* Added INTERLEAVE AQL function.

Expand Down
2 changes: 1 addition & 1 deletion arangod/Aql/Functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5066,7 +5066,7 @@ AqlValue Functions::Jaccard(ExpressionContext* ctx, transaction::Methods* trx,
count = 0;
}

auto const jaccard = values.empty() ? 0.0 : double_t(cardinality) / values.size();
auto const jaccard = values.empty() ? 1.0 : double_t(cardinality) / values.size();

return AqlValue{AqlValueHintDouble{jaccard}};
}
Expand Down
1 change: 1 addition & 0 deletions arangod/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ add_library(arango_iresearch
IResearch/Containers.cpp IResearch/Containers.h
IResearch/IResearchAnalyzerFeature.cpp IResearch/IResearchAnalyzerFeature.h
IResearch/IResearchCommon.cpp IResearch/IResearchCommon.h
IResearch/IResearchCompression.cpp IResearch/IResearchCompression.h
IResearch/IResearchKludge.cpp IResearch/IResearchKludge.h
IResearch/IResearchLink.cpp IResearch/IResearchLink.h
IResearch/IResearchLinkCoordinator.cpp IResearch/IResearchLinkCoordinator.h
Expand Down
64 changes: 64 additions & 0 deletions arangod/IResearch/IResearchCompression.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2020 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Andrei Lobov
////////////////////////////////////////////////////////////////////////////////

#include "IResearchCompression.h"
#include "Basics/debugging.h"
#include <unordered_map>

namespace {
const std::unordered_map<
std::string,
arangodb::iresearch::ColumnCompression> COMPRESSION_CONVERT_MAP = {
{ "lz4", arangodb::iresearch::ColumnCompression::LZ4 },
{ "none", arangodb::iresearch::ColumnCompression::NONE },
#ifdef ARANGODB_USE_GOOGLE_TESTS
{ "test", arangodb::iresearch::ColumnCompression::TEST },
#endif
};
}


namespace arangodb {
namespace iresearch {

irs::string_ref columnCompressionToString(ColumnCompression c) {
for (auto const&it : COMPRESSION_CONVERT_MAP) {
if (it.second == c) {
return it.first;
}
}
TRI_ASSERT(false);
return irs::string_ref::NIL;
}

ColumnCompression columnCompressionFromString(irs::string_ref const& c) {
TRI_ASSERT(!c.null());
auto it = COMPRESSION_CONVERT_MAP.find(c);
if (it != COMPRESSION_CONVERT_MAP.end()) {
return it->second;
}
return ColumnCompression::INVALID;
}

} // namespace iresearch
} // namespace arangodb

44 changes: 44 additions & 0 deletions arangod/IResearch/IResearchCompression.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2020 ArangoDB GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Andrei Lobov
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_IRESEARCH__IRESEARCH_COMPRESSION_H
#define ARANGOD_IRESEARCH__IRESEARCH_COMPRESSION_H 1

#include "utils/string.hpp"

namespace arangodb {
namespace iresearch {

enum class ColumnCompression {
INVALID = 0,
NONE = 1,
LZ4
#ifdef ARANGODB_USE_GOOGLE_TESTS
, TEST = 999
#endif
};

irs::string_ref columnCompressionToString(ColumnCompression c);
ColumnCompression columnCompressionFromString(irs::string_ref const& c);
} // iresearch
} // arangodb

#endif // ARANGOD_IRESEARCH__IRESEARCH_COMPRESSION_H
2 changes: 1 addition & 1 deletion arangod/IResearch/IResearchFilterFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2742,7 +2742,7 @@ arangodb::Result fromFuncNgramMatch(
kludge::mangleStringField(name, analyzerPool);

auto& ngramFilter = filter->add<irs::by_ngram_similarity>();
ngramFilter.field(std::move(name)).threshold(threshold).boost(filterCtx.boost);;
ngramFilter.field(std::move(name)).threshold((float_t)threshold).boost(filterCtx.boost);;

analyzer->reset(matchValue);
irs::term_attribute const& token = *analyzer->attributes().get<irs::term_attribute>();
Expand Down
2 changes: 2 additions & 0 deletions arangod/IResearch/IResearchKludge.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ namespace arangodb {
namespace iresearch {
namespace kludge {

const std::string primarySortColumnName{ "" };

void mangleType(std::string& name);
void mangleAnalyzer(std::string& name);

Expand Down
Loading
0