Search in sources :

Example 6 with QueryProcessor.executeInternal

use of org.apache.cassandra.cql3.QueryProcessor.executeInternal in project cassandra by apache.

the class TriggersTest method assertUpdateIsAugmented.

private void assertUpdateIsAugmented(int key) {
    UntypedResultSet rs = QueryProcessor.executeInternal(String.format("SELECT * FROM %s.%s WHERE k=%s", ksName, cfName, key));
    assertTrue(String.format("Expected value (%s) for augmented cell v2 was not found", key), rs.one().has("v2"));
    assertEquals(999, rs.one().getInt("v2"));
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet)

Example 7 with QueryProcessor.executeInternal

use of org.apache.cassandra.cql3.QueryProcessor.executeInternal in project cassandra by apache.

the class TriggersTest method assertUpdateNotExecuted.

private void assertUpdateNotExecuted(String cf, int key) {
    UntypedResultSet rs = QueryProcessor.executeInternal(String.format("SELECT * FROM %s.%s WHERE k=%s", ksName, cf, key));
    assertTrue(rs.isEmpty());
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet)

Example 8 with QueryProcessor.executeInternal

use of org.apache.cassandra.cql3.QueryProcessor.executeInternal in project cassandra by apache.

the class LegacySSTableTest method readSimpleCounterTable.

private static void readSimpleCounterTable(String legacyVersion, String compactSuffix, String pkValue) {
    logger.debug("Read legacy_{}_simple_counter{}", legacyVersion, compactSuffix);
    UntypedResultSet rs;
    rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_simple_counter%s WHERE pk=?", legacyVersion, compactSuffix), pkValue);
    Assert.assertNotNull(rs);
    Assert.assertEquals(1, rs.size());
    Assert.assertEquals(1L, rs.one().getLong("val"));
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet)

Example 9 with QueryProcessor.executeInternal

use of org.apache.cassandra.cql3.QueryProcessor.executeInternal in project cassandra by apache.

the class LegacySSTableTest method readClusteringCounterTable.

private static void readClusteringCounterTable(String legacyVersion, String compactSuffix, String ckValue, String pkValue) {
    logger.debug("Read legacy_{}_clust_counter{}", legacyVersion, compactSuffix);
    UntypedResultSet rs;
    rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust_counter%s WHERE pk=? AND ck=?", legacyVersion, compactSuffix), pkValue, ckValue);
    Assert.assertNotNull(rs);
    Assert.assertEquals(1, rs.size());
    Assert.assertEquals(1L, rs.one().getLong("val"));
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet)

Example 10 with QueryProcessor.executeInternal

use of org.apache.cassandra.cql3.QueryProcessor.executeInternal in project cassandra by apache.

the class LegacySSTableTest method readClusteringTable.

private static void readClusteringTable(String legacyVersion, String compactSuffix, int ck, String ckValue, String pkValue) {
    logger.debug("Read legacy_{}_clust{}", legacyVersion, compactSuffix);
    UntypedResultSet rs;
    rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust%s WHERE pk=? AND ck=?", legacyVersion, compactSuffix), pkValue, ckValue);
    assertLegacyClustRows(1, rs);
    String ckValue2 = Integer.toString(ck < 10 ? 40 : ck - 1) + longString;
    String ckValue3 = Integer.toString(ck > 39 ? 10 : ck + 1) + longString;
    rs = QueryProcessor.executeInternal(String.format("SELECT val FROM legacy_tables.legacy_%s_clust%s WHERE pk=? AND ck IN (?, ?, ?)", legacyVersion, compactSuffix), pkValue, ckValue, ckValue2, ckValue3);
    assertLegacyClustRows(3, rs);
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet)

Aggregations

UntypedResultSet (org.apache.cassandra.cql3.UntypedResultSet)15 Test (org.junit.Test)7 SchemaLoader.createKeyspace (org.apache.cassandra.SchemaLoader.createKeyspace)3 ColumnFamilyStore (org.apache.cassandra.db.ColumnFamilyStore)3 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 File (java.io.File)1 Path (java.nio.file.Path)1 Range (org.apache.cassandra.dht.Range)1 Token (org.apache.cassandra.dht.Token)1 CQLSSTableWriter (org.apache.cassandra.io.sstable.CQLSSTableWriter)1 SSTableLoader (org.apache.cassandra.io.sstable.SSTableLoader)1 TableMetadataRef (org.apache.cassandra.schema.TableMetadataRef)1 OutputHandler (org.apache.cassandra.utils.OutputHandler)1