-
Notifications
You must be signed in to change notification settings - Fork 152
/
secondary_index_metadata.feature
112 lines (100 loc) · 3.54 KB
/
secondary_index_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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
Feature: Secondary Index Metadata
PHP Driver exposes the Cassandra Schema Metadata for secondary indexes.
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 INDEX IF NOT EXISTS name_index ON users(name);
"""
Scenario: Getting a index metadata
Given the following example:
"""php
<?php
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->build();
$session = $cluster->connect("simplex");
$schema = $session->schema();
$index = $schema->keyspace("simplex")->table("users")->index("name_index");
echo "Name: " . $index->name() . "\n";
echo "Kind: " . $index->kind() . "\n";
echo "Target: " . $index->target() . "\n";
echo "IsCustom: " . ($index->isCustom() ? "true" : "false") . "\n";
"""
When it is executed
Then its output should contain:
"""
Name: name_index
Kind: composites
Target: name
IsCustom: false
"""
@cassandra-version-3.0
Scenario: Getting a index metadata w/ options
Given the following example:
"""php
<?php
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->build();
$session = $cluster->connect("simplex");
$schema = $session->schema();
$index = $schema->keyspace("simplex")->table("users")->index("name_index");
echo "Name: " . $index->name() . "\n";
echo "Kind: " . $index->kind() . "\n";
echo "Target: " . $index->target() . "\n";
echo "IsCustom: " . ($index->isCustom() ? "true" : "false") . "\n";
echo "Options: " . var_export($index->options(), true) . "\n";
"""
When it is executed
Then its output should contain:
"""
Name: name_index
Kind: composites
Target: name
IsCustom: false
Options: array (
'target' => 'name',
)
"""
@cassandra-version-3.0
Scenario: Getting a custom index metadata
Given additional schema:
"""
CREATE CUSTOM INDEX name_custom_index ON users (name) USING 'org.apache.cassandra.index.internal.composites.ClusteringColumnIndex';
"""
And the following example:
"""php
<?php
$cluster = Cassandra::cluster()
->withContactPoints('127.0.0.1')
->build();
$session = $cluster->connect("simplex");
$schema = $session->schema();
$index = $schema->keyspace("simplex")->table("users")->index("name_custom_index");
echo "Name: " . $index->name() . "\n";
echo "Kind: " . $index->kind() . "\n";
echo "Target: " . $index->target() . "\n";
echo "IsCustom: " . ($index->isCustom() ? "true" : "false") . "\n";
echo "ClassName: " . $index->className() . "\n";
echo "Options: " . var_export($index->options(), true) . "\n";
"""
When it is executed
Then its output should contain:
"""
Name: name_custom_index
Kind: custom
Target: name
IsCustom: true
ClassName: org.apache.cassandra.index.internal.composites.ClusteringColumnIndex
Options: array (
'class_name' => 'org.apache.cassandra.index.internal.composites.ClusteringColumnIndex',
'target' => 'name',
)
"""