Commit Graph

2574 Commits

Author SHA1 Message Date
Avi Kivity
5198292165 tests: add function call test
Test now() function.
2015-04-01 21:06:37 +03:00
Avi Kivity
100be3660d cql3: enable function call grammar rules 2015-04-01 21:02:48 +03:00
Avi Kivity
4f3aaa988c cql3: make function_name friendlier to ANTLR
ANTLR wants default constructors, and to modify fields afterwards.
2015-04-01 21:02:00 +03:00
Avi Kivity
c2f3b90ef1 cql3: convert function_call.hh to C++ some more 2015-04-01 21:01:20 +03:00
Avi Kivity
32aadac87b db: implement abstract_type::is_compatible_with() 2015-04-01 20:58:56 +03:00
Avi Kivity
afe2ef6e39 db: implement abstract_type::equals()
At present, no overloads are needed because collections are interned, and
all other implemented data types are singletons.  Tuples and user defined
types will need an overload.
2015-04-01 20:57:37 +03:00
Avi Kivity
238ef64d5a cql3: use bytes_view when creating a map literal from the serialized form
More efficient, and easier to use (if we already have a view).
2015-04-01 20:56:31 +03:00
Avi Kivity
89b3883783 cql3: fix too eager move in functions.hh
Can't use f and move it in the same expression.
2015-04-01 20:54:54 +03:00
Avi Kivity
db1df139e2 cql3: convert functions.hh to C++ some more 2015-04-01 20:52:21 +03:00
Avi Kivity
84b0a71716 cql3: convert function_name to C++ some more (native_function bits) 2015-04-01 20:49:35 +03:00
Avi Kivity
a59d8b384f cql3: convert scalar_functions from protocol_version to serialization_format 2015-04-01 20:48:07 +03:00
Avi Kivity
03bbcf55c2 cql3: fix max() function
Registration was done with a null shared_ptr<> instead of make_shared(),
and as a result the max template wasn't even instantiated, so it did not
even build.
2015-04-01 20:17:10 +03:00
Avi Kivity
955f1ebf06 db: fix to_hex(bytes_opt)
Result was inverted.
2015-04-01 20:16:00 +03:00
Avi Kivity
874249800d cql3: provide ostream operator for assignment_testable
To prevent name clashes, we don't call the virtual function implementing
this to_string(), but rather assignment_testable_source_context(), as its
use will be error reporting.
2015-04-01 20:12:39 +03:00
Avi Kivity
c6bee5ee2e cql3: don't require a vector<> for assignment_testable::test_all()
Allow any range.  Apologies for error message spew.
2015-04-01 20:12:39 +03:00
Avi Kivity
deb21cfa7e db: export ostream operator for partition_slice 2015-04-01 20:12:39 +03:00
Avi Kivity
a9ce81a2f8 db: add ostream operator for exploded_clustering_prefix 2015-04-01 20:12:39 +03:00
Avi Kivity
bb4b303bba db: add ostream operators for atomic_cell 2015-04-01 20:12:39 +03:00
Avi Kivity
bd3aa31c18 db: make join() work on any range, not just a vector 2015-04-01 20:12:39 +03:00
Avi Kivity
2642f82d89 Merge branch 'tgrabiec/tests' of github.com:cloudius-systems/seastar-dev into db
Use cql_test_env in tests, from Tomasz.
2015-03-31 18:14:24 +03:00
Avi Kivity
62da83f416 Merge branch 'tgrabiec/fixes' of github.com:cloudius-systems/seastar-dev into db
Use cql_test_env in tests, query limit bug fix, IN restriction, from Tomasz.
2015-03-31 17:18:29 +03:00
Raphael S. Carvalho
44735a3c88 sstables: add support to write the component filter
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 17:11:00 +03:00
Raphael S. Carvalho
b3175f115d tests: sstables: move code to be reused for other components
Also, semaphore was removed because it's useless there.

Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
2015-03-31 17:11:00 +03:00
Tomasz Grabiec
7b6d340d8a tests: Convert all test cases in cql_query_test.cc to use cql_test_env
Reduces duplication.
2015-03-31 15:58:44 +02:00
Tomasz Grabiec
f73524ddaa tests: Add cql_test_env::require_column_has_value()
Copied from cql_query_test.cc.
2015-03-31 15:57:40 +02:00
Tomasz Grabiec
eddb479ec4 tests: Move CQL response assertions to cql_assertions.hh 2015-03-31 15:56:59 +02:00
Avi Kivity
4f94829792 cql3: reindent term.hh 2015-03-31 13:03:44 +03:00
Tomasz Grabiec
3da0c3035f tests: Add test for querying static row with limit and many ranges 2015-03-30 18:38:26 +02:00
Tomasz Grabiec
09cd4c4cf0 cql3: Enable 'in' restriction
Adds support for queries like this:

  select * from cf where key in (1, 2);
2015-03-30 18:38:26 +02:00
Tomasz Grabiec
9e5a02421a db: Fix static row not being populated when query limit kicks in
Spotted during code review.
2015-03-30 18:38:26 +02:00
Tomasz Grabiec
d21966ecbc Revert "tests: Use lowres_clock in time_it()"
This reverts commit e605a0368a.

lowres_clock is not updated when reactor is not running and this
variant of time_it() is not meant to be run in a rector.
2015-03-30 18:38:26 +02:00
Nadav Har'El
f49c065cd1 sstables: fix use-after-free of temporary object
The debug-mode sanitizer discovered a bug in sstable::data_read.
I had optimistically wrote this code:

     return data_stream_at(pos).read_exactly(len);

This is wrong - data_stream_at returns a temporary input_stream object,
which gets destructed immediately and doesn't live throughout the life
of read_exactly. Obviously, this object does need to live on (among other
things, it holds the buffer which read_exactly reads into).

The solution is an ugly variant of the same thing, but which allocates
memory to hold a copy of the input stream object. Because there is no
single reader (in theory we can have a hundred different reads ongoing
in parallel from the same sstable), we really have choice but to allocate
this read context somewhere. A better solution would not use an input
stream at all, but this is a different issue, already in a FIXME.

This patch fixes the sstable test failure that Jenkins reports.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-30 18:25:38 +02:00
Pekka Enberg
6b0ad02019 cql3: Remove QueryHandler class
Cassandra added support for specifying user-specified query handlers
instead of the default QueryProcessor in CASSANDRA-6659. We don't really
need that now and as we're C++, we cannot even support existing custom
query handlers. Therefore, remove the QueryHandler class and references
to it.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-30 14:49:49 +02:00
Tomasz Grabiec
58a075b657 Merge tag 'avi/collections/select/v2'
From Avi:

Wire up the query path for collections
2015-03-30 14:14:46 +02:00
Avi Kivity
f32a9ec123 tests: add collection query path tests 2015-03-30 14:28:16 +03:00
Avi Kivity
b23d23ac9c db: take into account collection tombstone when converting to value 2015-03-30 14:28:16 +03:00
Avi Kivity
18e7ea58d4 db: add collection-typed fields to system keyspace 2015-03-30 14:28:16 +03:00
Avi Kivity
126fa3cd64 transport: serialize collection types 2015-03-30 14:28:16 +03:00
Avi Kivity
9eeb35b5b3 cql3: support collections in result_set 2015-03-30 14:28:16 +03:00
Avi Kivity
56774f5e38 db: add collection_type_impl::to_bytes(collection_mutation::view) helper 2015-03-30 14:28:16 +03:00
Avi Kivity
86f378e4d7 cql3: convert result set to use serialization format rather than protocol_version 2015-03-30 14:28:16 +03:00
Avi Kivity
aab6d7a173 cql3: convert lists::discarder to C++
And wire it up.
2015-03-30 14:28:16 +03:00
Avi Kivity
a1dab20422 Merge branch 'tgrabiec/deletes' of github.com:cloudius-systems/seastar-dev into db
Delete support, from Tomasz.
2015-03-30 11:24:22 +03:00
Avi Kivity
4d65825f91 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-30 11:23:02 +03:00
Avi Kivity
7cf25ce492 distributed: fix use-after-move
distributed::stop() passes the pointer to the instance being destroyed
by reference, in an attempt to keep things clean (by nulling the pointer
after deleting it).  This is illegal, however, since the lambda is moved
in the bowels of submit_to().  In release mode this is optimized away so
the code works, but in debug mode it leads to a crash.

Fix by capturing by value instead (could also have been fixed by switching
the enclosing capture to a reference).

Credit to Gleb for identifying the problem.
2015-03-30 11:18:16 +03:00
Tomasz Grabiec
dc019c6da2 tests: Add tests for deletion scenarios 2015-03-30 09:08:26 +02:00
Tomasz Grabiec
a06f195774 tests: Add more existing tests to the automatic suite 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
ff35be339c tests: cql: Improve error reporting in with_rows() 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
51af0ad8cd to_string: Implement to_string() for std::initializer_list<> 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
14fe96c02e to_string: Implement to_string() using join() 2015-03-30 09:07:01 +02:00