当前位置: 首页>>代码示例>>Java>>正文


Java SystemKeyspace.isViewBuilt方法代码示例

本文整理汇总了Java中org.apache.cassandra.db.SystemKeyspace.isViewBuilt方法的典型用法代码示例。如果您正苦于以下问题:Java SystemKeyspace.isViewBuilt方法的具体用法?Java SystemKeyspace.isViewBuilt怎么用?Java SystemKeyspace.isViewBuilt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.db.SystemKeyspace的用法示例。


在下文中一共展示了SystemKeyspace.isViewBuilt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBuilderWidePartition

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
@Test
public void testBuilderWidePartition() throws Throwable
{
    createTable("CREATE TABLE %s (" +
                "k int, " +
                "c int, " +
                "intval int, " +
                "PRIMARY KEY (k, c))");

    execute("USE " + keyspace());
    executeNet(protocolVersion, "USE " + keyspace());


    for(int i = 0; i < 1024; i++)
        execute("INSERT INTO %s (k, c, intval) VALUES (?, ?, ?)", 0, i, 0);

    createView("mv", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE k IS NOT NULL AND c IS NOT NULL AND intval IS NOT NULL PRIMARY KEY (intval, c, k)");


    while (!SystemKeyspace.isViewBuilt(keyspace(), "mv"))
        Thread.sleep(1000);

    assertRows(execute("SELECT count(*) from %s WHERE k = ?", 0), row(1024L));
    assertRows(execute("SELECT count(*) from mv WHERE intval = ?", 0), row(1024L));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:26,代码来源:ViewTest.java

示例2: testFilterWithFunction

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
@Test
public void testFilterWithFunction() throws Throwable
{
    createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, b))");

    execute("USE " + keyspace());
    executeNet(protocolVersion, "USE " + keyspace());

    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 0, 0);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 1, 1);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 0, 2);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 1, 3);

    createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s " +
            "WHERE a = blobAsInt(intAsBlob(1)) AND b IS NOT NULL " +
            "PRIMARY KEY (a, b)");

    while (!SystemKeyspace.isViewBuilt(keyspace(), "mv_test"))
        Thread.sleep(10);

    assertRows(execute("SELECT a, b, c FROM mv_test"),
            row(1, 0, 2),
            row(1, 1, 3)
    );

    executeNet(protocolVersion, "ALTER TABLE %s RENAME a TO foo");

    assertRows(execute("SELECT foo, b, c FROM mv_test"),
            row(1, 0, 2),
            row(1, 1, 3)
    );
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:33,代码来源:ViewFilteringTest.java

示例3: testFilterWithTypecast

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
@Test
public void testFilterWithTypecast() throws Throwable
{
    createTable("CREATE TABLE %s (a int, b int, c int, PRIMARY KEY (a, b))");

    execute("USE " + keyspace());
    executeNet(protocolVersion, "USE " + keyspace());

    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 0, 0);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 0, 1, 1);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 0, 2);
    execute("INSERT INTO %s (a, b, c) VALUES (?, ?, ?)", 1, 1, 3);

    createView("mv_test", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s " +
            "WHERE a = (int) 1 AND b IS NOT NULL " +
            "PRIMARY KEY (a, b)");

    while (!SystemKeyspace.isViewBuilt(keyspace(), "mv_test"))
        Thread.sleep(10);

    assertRows(execute("SELECT a, b, c FROM mv_test"),
            row(1, 0, 2),
            row(1, 1, 3)
    );

    executeNet(protocolVersion, "ALTER TABLE %s RENAME a TO foo");

    assertRows(execute("SELECT foo, b, c FROM mv_test"),
            row(1, 0, 2),
            row(1, 1, 3)
    );
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:33,代码来源:ViewFilteringTest.java

示例4: testRangeTombstone

import org.apache.cassandra.db.SystemKeyspace; //导入方法依赖的package包/类
@Test
public void testRangeTombstone() throws Throwable
{
    createTable("CREATE TABLE %s (" +
                "k int, " +
                "asciival ascii, " +
                "bigintval bigint, " +
                "textval1 text, " +
                "textval2 text, " +
                "PRIMARY KEY((k, asciival), bigintval, textval1)" +
                ")");

    execute("USE " + keyspace());
    executeNet(protocolVersion, "USE " + keyspace());

    createView("mv_test1", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE textval2 IS NOT NULL AND k IS NOT NULL AND asciival IS NOT NULL AND bigintval IS NOT NULL AND textval1 IS NOT NULL PRIMARY KEY ((textval2, k), asciival, bigintval, textval1)");

    for (int i = 0; i < 100; i++)
        updateView("INSERT into %s (k,asciival,bigintval,textval1,textval2)VALUES(?,?,?,?,?)", 0, "foo", (long) i % 2, "bar" + i, "baz");

    Assert.assertEquals(50, execute("select * from %s where k = 0 and asciival = 'foo' and bigintval = 0").size());
    Assert.assertEquals(50, execute("select * from %s where k = 0 and asciival = 'foo' and bigintval = 1").size());

    Assert.assertEquals(100, execute("select * from mv_test1").size());

    //Check the builder works
    createView("mv_test2", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE textval2 IS NOT NULL AND k IS NOT NULL AND asciival IS NOT NULL AND bigintval IS NOT NULL AND textval1 IS NOT NULL PRIMARY KEY ((textval2, k), asciival, bigintval, textval1)");

    while (!SystemKeyspace.isViewBuilt(keyspace(), "mv_test2"))
        Thread.sleep(10);

    Assert.assertEquals(100, execute("select * from mv_test2").size());

    createView("mv_test3", "CREATE MATERIALIZED VIEW %s AS SELECT * FROM %%s WHERE textval2 IS NOT NULL AND k IS NOT NULL AND asciival IS NOT NULL AND bigintval IS NOT NULL AND textval1 IS NOT NULL PRIMARY KEY ((textval2, k), bigintval, textval1, asciival)");

    while (!SystemKeyspace.isViewBuilt(keyspace(), "mv_test3"))
        Thread.sleep(10);

    Assert.assertEquals(100, execute("select * from mv_test3").size());
    Assert.assertEquals(100, execute("select asciival from mv_test3 where textval2 = ? and k = ?", "baz", 0).size());

    //Write a RT and verify the data is removed from index
    updateView("DELETE FROM %s WHERE k = ? AND asciival = ? and bigintval = ?", 0, "foo", 0L);

    Assert.assertEquals(50, execute("select asciival from mv_test3 where textval2 = ? and k = ?", "baz", 0).size());
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:47,代码来源:ViewTest.java


注:本文中的org.apache.cassandra.db.SystemKeyspace.isViewBuilt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。