forked from datastax/php-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
materialized_view_metadata.feature
65 lines (60 loc) · 2.01 KB
/
materialized_view_metadata.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
@cassandra-version-3.0
Feature: Materialized View Metadata
PHP Driver exposes the Cassandra Schema Metadata for materialized views.
Background:
Given a running Cassandra cluster
And the following schema:
"""cql
CREATE KEYSPACE simplex WITH replication = {
'class': 'SimpleStrategy',
'replication_factor': 1
} AND DURABLE_WRITES = false;
USE simplex;
CREATE TABLE users (id int PRIMARY KEY, name text);
CREATE MATERIALIZED VIEW IF NOT EXISTS users_view AS SELECT name FROM users WHERE name IS NOT NULL PRIMARY KEY(name, id);
"""
Scenario: Getting a materialized view
Given the following example:
"""php
<?php
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->build();
$session = $cluster->connect("simplex");
$schema = $session->schema();
$view = $schema->keyspace("simplex")->materializedView("users_view");
echo "Name: " . $view->name() . "\n";
echo "BaseTable: " . $view->baseTable()->name() . "\n";
echo "DefaultTimeToLive: " . $view->option("default_time_to_live") . "\n";
echo "Compression: " . var_export($view->option("compression"), true) . "\n";
"""
When it is executed
Then its output should contain:
"""
Name: users_view
BaseTable: users
DefaultTimeToLive: 0
Compression: Cassandra\Map::__set_state(array(
'type' =>
Cassandra\Type\Map::__set_state(array(
'keyType' =>
Cassandra\Type\Scalar::__set_state(array(
'name' => 'varchar',
)),
'valueType' =>
Cassandra\Type\Scalar::__set_state(array(
'name' => 'varchar',
)),
)),
'keys' =>
array (
0 => 'chunk_length_in_kb',
1 => 'class',
),
'values' =>
array (
0 => '64',
1 => 'org.apache.cassandra.io.compress.LZ4Compressor',
),
))
"""