本文整理汇总了Java中com.espertech.esper.client.EPOnDemandQueryResult类的典型用法代码示例。如果您正苦于以下问题:Java EPOnDemandQueryResult类的具体用法?Java EPOnDemandQueryResult怎么用?Java EPOnDemandQueryResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EPOnDemandQueryResult类属于com.espertech.esper.client包,在下文中一共展示了EPOnDemandQueryResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: call
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public Object call() throws Exception {
try {
long total = 0;
for (int loop = 0; loop < numRepeats; loop++) {
// Insert event into named window
sendMarketBean(threadKey, loop);
total++;
String selectQuery = "select * from MyWindow where theString='" + threadKey + "' and longPrimitive=" + loop;
EPOnDemandQueryResult queryResult = engine.executeQuery(selectQuery);
Assert.assertEquals(1, queryResult.getArray().length);
Assert.assertEquals(threadKey, queryResult.getArray()[0].get("theString"));
Assert.assertEquals((long) loop, queryResult.getArray()[0].get("longPrimitive"));
}
} catch (Exception ex) {
log.error("Error in thread " + Thread.currentThread().getId(), ex);
return false;
}
return true;
}
开发者ID:espertechinc,项目名称:esper,代码行数:21,代码来源:StmtNamedWindowQueryCallable.java
示例2: runAssertionOnDemandAndOnSelect
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionOnDemandAndOnSelect(EPServiceProvider epService) {
String[] fields = new String[]{"theString", "intPrimitive"};
epService.getEPAdministrator().createEPL("create window MyWindow#keepall as select * from SupportBean");
epService.getEPAdministrator().createEPL("insert into MyWindow select * from SupportBean");
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
epService.getEPRuntime().sendEvent(new SupportBean("E1", 2));
epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
String query = "select distinct theString, intPrimitive from MyWindow order by theString, intPrimitive";
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(query);
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", 1}, {"E1", 2}, {"E2", 2}});
EPStatement stmt = epService.getEPAdministrator().createEPL("on SupportBean_A select distinct theString, intPrimitive from MyWindow order by theString, intPrimitive asc");
SupportUpdateListener listener = new SupportUpdateListener();
stmt.addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBean_A("x"));
EPAssertionUtil.assertPropsPerRow(listener.getLastNewData(), fields, new Object[][]{{"E1", 1}, {"E1", 2}, {"E2", 2}});
stmt.destroy();
}
开发者ID:espertechinc,项目名称:esper,代码行数:24,代码来源:ExecEPLDistinct.java
示例3: run
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public void run(EPServiceProvider epService) throws Exception {
epService.getEPAdministrator().createEPL("create window W1#unique(s1) as SSB1");
epService.getEPAdministrator().createEPL("insert into W1 select * from SSB1");
epService.getEPAdministrator().createEPL("create window W2#unique(s2) as SSB2");
epService.getEPAdministrator().createEPL("insert into W2 select * from SSB2");
for (int i = 0; i < 1000; i++) {
epService.getEPRuntime().sendEvent(new SupportSimpleBeanOne("A" + i, 0, 0, 0));
epService.getEPRuntime().sendEvent(new SupportSimpleBeanTwo("A" + i, 0, 0, 0));
}
long start = System.currentTimeMillis();
for (int i = 0; i < 100; i++) {
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from W1 as w1, W2 as w2 " +
"where w1.s1 = w2.s2");
assertEquals(1000, result.getArray().length);
}
long end = System.currentTimeMillis();
long delta = end - start;
System.out.println("Delta=" + delta);
assertTrue("Delta=" + delta, delta < 1000);
}
开发者ID:espertechinc,项目名称:esper,代码行数:24,代码来源:ExecNamedWIndowFAFQueryJoinPerformance.java
示例4: runAssertionLateCreate
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionLateCreate(EPServiceProvider epService, boolean namedWindow) {
epService.getEPAdministrator().getConfiguration().addEventType("SupportBean", SupportBean.class);
epService.getEPAdministrator().getConfiguration().addEventType("SupportBean_A", SupportBean_A.class);
String stmtTextCreateOne = namedWindow ?
"create window MyInfraLC#keepall as (f1 string, f2 int, f3 string, f4 string)" :
"create table MyInfraLC as (f1 string primary key, f2 int primary key, f3 string primary key, f4 string primary key)";
epService.getEPAdministrator().createEPL(stmtTextCreateOne);
epService.getEPAdministrator().createEPL("insert into MyInfraLC(f1, f2, f3, f4) select theString, intPrimitive, '>'||theString||'<', '?'||theString||'?' from SupportBean");
epService.getEPRuntime().sendEvent(new SupportBean("E1", -4));
epService.getEPRuntime().sendEvent(new SupportBean("E1", -2));
epService.getEPRuntime().sendEvent(new SupportBean("E1", -3));
epService.getEPAdministrator().createEPL("create index MyInfraLCIndex on MyInfraLC(f2, f3, f1)");
String[] fields = "f1,f2,f3,f4".split(",");
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyInfraLC where f3='>E1<' order by f2 asc");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{
{"E1", -4, ">E1<", "?E1?"}, {"E1", -3, ">E1<", "?E1?"}, {"E1", -2, ">E1<", "?E1?"}});
epService.getEPAdministrator().destroyAllStatements();
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraLC", false);
}
开发者ID:espertechinc,项目名称:esper,代码行数:25,代码来源:ExecNWTableInfraCreateIndex.java
示例5: runAssertionIntoTableWindowSortedFromJoin
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionIntoTableWindowSortedFromJoin(EPServiceProvider epService) {
epService.getEPAdministrator().createEPL("create table MyTable(" +
"thewin window(*) @type('SupportBean')," +
"thesort sorted(intPrimitive desc) @type('SupportBean')" +
")");
epService.getEPAdministrator().createEPL("into table MyTable " +
"select window(sb.*) as thewin, sorted(sb.*) as thesort " +
"from SupportBean_S0#lastevent, SupportBean#keepall as sb");
epService.getEPRuntime().sendEvent(new SupportBean_S0(1));
SupportBean sb1 = new SupportBean("E1", 1);
epService.getEPRuntime().sendEvent(sb1);
SupportBean sb2 = new SupportBean("E2", 2);
epService.getEPRuntime().sendEvent(sb2);
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyTable");
EPAssertionUtil.assertPropsPerRow(result.getArray(), "thewin,thesort".split(","),
new Object[][]{{new SupportBean[]{sb1, sb2}, new SupportBean[]{sb2, sb1}}});
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:23,代码来源:ExecTableIntoTable.java
示例6: executeInternal
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private EPOnDemandQueryResult executeInternal(ContextPartitionSelector[] contextPartitionSelectors) {
try
{
EPPreparedQueryResult result = executeMethod.execute(contextPartitionSelectors);
return new EPQueryResultImpl(result);
}
catch (EPStatementException ex)
{
throw ex;
}
catch (Throwable t)
{
String message = "Error executing statement: " + t.getMessage();
log.error("Error executing on-demand statement '" + epl + "': " + t.getMessage(), t);
throw new EPStatementException(message, epl);
}
}
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:18,代码来源:EPPreparedQueryImpl.java
示例7: call
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public Object call() throws Exception
{
try
{
long total = 0;
for (int loop = 0; loop < numRepeats; loop++)
{
// Insert event into named window
sendMarketBean(threadKey, loop);
total++;
String selectQuery = "select * from MyWindow where theString='" + threadKey + "' and longPrimitive=" + loop;
EPOnDemandQueryResult queryResult = engine.executeQuery(selectQuery);
Assert.assertEquals(1, queryResult.getArray().length);
Assert.assertEquals(threadKey, queryResult.getArray()[0].get("theString"));
Assert.assertEquals((long)loop, queryResult.getArray()[0].get("longPrimitive"));
}
}
catch (Exception ex)
{
log.fatal("Error in thread " + Thread.currentThread().getId(), ex);
return false;
}
return true;
}
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:26,代码来源:StmtNamedWindowQueryCallable.java
示例8: testOnDemandAndOnSelect
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public void testOnDemandAndOnSelect()
{
String[] fields = new String[] {"theString", "intPrimitive"};
epService.getEPAdministrator().createEPL("create window MyWindow.win:keepall() as select * from SupportBean");
epService.getEPAdministrator().createEPL("insert into MyWindow select * from SupportBean");
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
epService.getEPRuntime().sendEvent(new SupportBean("E1", 2));
epService.getEPRuntime().sendEvent(new SupportBean("E2", 2));
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
String query = "select distinct theString, intPrimitive from MyWindow order by theString, intPrimitive";
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(query);
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", 1}, {"E1", 2}, {"E2", 2}});
EPStatement stmt = epService.getEPAdministrator().createEPL("on SupportBean_A select distinct theString, intPrimitive from MyWindow order by theString, intPrimitive asc");
stmt.addListener(listener);
epService.getEPRuntime().sendEvent(new SupportBean_A("x"));
EPAssertionUtil.assertPropsPerRow(listener.getLastNewData(), fields, new Object[][]{{"E1", 1}, {"E1", 2}, {"E2", 2}});
}
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:22,代码来源:TestDistinct.java
示例9: testPerfFAFJoin
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public void testPerfFAFJoin()
{
epService.getEPAdministrator().createEPL("create window W1.std:unique(s1) as SSB1");
epService.getEPAdministrator().createEPL("insert into W1 select * from SSB1");
epService.getEPAdministrator().createEPL("create window W2.std:unique(s2) as SSB2");
epService.getEPAdministrator().createEPL("insert into W2 select * from SSB2");
for (int i = 0; i < 1000; i++) {
epService.getEPRuntime().sendEvent(new SupportSimpleBeanOne("A" + i, 0, 0, 0));
epService.getEPRuntime().sendEvent(new SupportSimpleBeanTwo("A" + i, 0, 0, 0));
}
long start = System.currentTimeMillis();
for (int i = 0; i < 100; i++)
{
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from W1 as w1, W2 as w2 " +
"where w1.s1 = w2.s2");
assertEquals(1000, result.getArray().length);
}
long end = System.currentTimeMillis();
long delta = end - start;
System.out.println("Delta=" + delta);
assertTrue("Delta=" + delta, delta < 1000);
}
开发者ID:mobile-event-processing,项目名称:Asper,代码行数:26,代码来源:TestPerfFAFQueryJoin.java
示例10: execute
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
/**
* Executes the query and returns the result. This only works for on-demand
* queries. Live queries will return null
*
* @return
*/
public String execute() {
final StreamProcessingAdapter esper = StreamProcessingAdapter.getInstance();
if (this.isLiveQuery()) {
return null;
}
EPOnDemandQueryResult result = null;
// TODO evaluate semantic query part (if existent) for all events
// only query those events, that passed the semantic test
final EPStatementObjectModel statement = esper.getEsperAdministrator().compileEPL(this.esperQuery);
result = esper.getEsperRuntime().executeQuery(statement);
// print results
final StringBuffer buffer = new StringBuffer();
buffer.append("Number of events found: " + result.getArray().length);
final Iterator<EventBean> i = result.iterator();
while (i.hasNext()) {
buffer.append(System.getProperty("line.separator"));
final EventBean next = i.next();
if (next.getUnderlying() instanceof ElementImpl) {
final ElementImpl event = (ElementImpl) next.getUnderlying();
buffer.append("{");
for (int k = 0; k < event.getChildNodes().getLength(); k++) {
final Node node = event.getChildNodes().item(k);
buffer.append(node.getNodeName() + "=" + node.getFirstChild().getNodeValue());
if (k + 1 < event.getChildNodes().getLength()) {
buffer.append(", ");
}
}
buffer.append("}");
} else {
buffer.append(next.getUnderlying());
}
}
return buffer.toString();
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:42,代码来源:QueryWrapper.java
示例11: testWindowCreation
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
@Test
public void testWindowCreation() {
Assert.assertTrue("Window has already been created", !StreamProcessingAdapter.getInstance().hasWindow(this.eventType.getTypeName() + "Window"));
StreamProcessingAdapter.getInstance().addEventType(this.eventType);
Assert.assertTrue("Window has not been created", StreamProcessingAdapter.getInstance().hasWindow(this.eventType.getTypeName() + "Window"));
// Send Events
for (final EapEvent event : EsperTests.events) {
event.setEventType(this.eventType);
StreamProcessingAdapter.getInstance().addEvent(event);
}
final EPOnDemandQueryResult result = StreamProcessingAdapter.getInstance().getEsperRuntime().executeQuery("Select * From KinoWindow");
Assert.assertTrue("Number of events should have been 999, instead of " + result.getArray().length, result.getArray().length == 999);
}
开发者ID:bptlab,项目名称:Unicorn,代码行数:15,代码来源:EsperTests.java
示例12: runAssertionFAFCarEventAndGroupingFunc
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionFAFCarEventAndGroupingFunc(EPServiceProvider epService) {
epService.getEPAdministrator().getConfiguration().addEventType(CarEvent.class);
epService.getEPAdministrator().createEPL("create window CarWindow#keepall as CarEvent");
epService.getEPAdministrator().createEPL("insert into CarWindow select * from CarEvent");
epService.getEPRuntime().sendEvent(new CarEvent("skoda", "france", 10000));
epService.getEPRuntime().sendEvent(new CarEvent("skoda", "germany", 5000));
epService.getEPRuntime().sendEvent(new CarEvent("bmw", "france", 100));
epService.getEPRuntime().sendEvent(new CarEvent("bmw", "germany", 1000));
epService.getEPRuntime().sendEvent(new CarEvent("opel", "france", 7000));
epService.getEPRuntime().sendEvent(new CarEvent("opel", "germany", 7000));
String epl = "select name, place, sum(count), grouping(name), grouping(place), grouping_id(name, place) as gid " +
"from CarWindow group by grouping sets((name, place),name, place,())";
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(epl);
assertEquals(Integer.class, result.getEventType().getPropertyType("grouping(name)"));
assertEquals(Integer.class, result.getEventType().getPropertyType("gid"));
String[] fields = new String[]{"name", "place", "sum(count)", "grouping(name)", "grouping(place)", "gid"};
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{
{"skoda", "france", 10000, 0, 0, 0},
{"skoda", "germany", 5000, 0, 0, 0},
{"bmw", "france", 100, 0, 0, 0},
{"bmw", "germany", 1000, 0, 0, 0},
{"opel", "france", 7000, 0, 0, 0},
{"opel", "germany", 7000, 0, 0, 0},
{"skoda", null, 15000, 0, 1, 1},
{"bmw", null, 1100, 0, 1, 1},
{"opel", null, 14000, 0, 1, 1},
{null, "france", 17100, 1, 0, 2},
{null, "germany", 13000, 1, 0, 2},
{null, null, 30100, 1, 1, 3}});
epService.getEPAdministrator().destroyAllStatements();
}
开发者ID:espertechinc,项目名称:esper,代码行数:37,代码来源:ExecQuerytypeRollupGroupingFuncs.java
示例13: runAssertionFAF
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionFAF(EPServiceProvider epService, double x, double y, double width, double height, boolean expected) {
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(IndexBackingTableInfo.INDEX_CALLBACK_HOOK + "select id as c0 from MyTable where rectangle(tx, ty, tw, th).intersects(rectangle(" + x + ", " + y + ", " + width + ", " + height + "))");
SupportQueryPlanIndexHook.assertFAFAndReset("MyIdxCIFQuadTree", "EventTableQuadTreeMXCIFImpl");
if (expected) {
EPAssertionUtil.assertPropsPerRowAnyOrder(result.getArray(), "c0".split(","), new Object[][]{{"R1"}});
} else {
assertEquals(0, result.getArray().length);
}
}
开发者ID:espertechinc,项目名称:esper,代码行数:10,代码来源:ExecSpatialMXCIFQuadTreeEventIndex.java
示例14: tryAssertionCreateIndex
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void tryAssertionCreateIndex(EPServiceProvider epService, boolean namedWindow) throws Exception {
String epl = "@name('create-ctx') create context SegmentedByCustomer " +
" initiated by SupportBean_S0 s0 " +
" terminated by SupportBean_S1(p00 = p10);" +
"" +
"@name('create-infra') context SegmentedByCustomer\n" +
(namedWindow ?
"create window MyInfra#keepall as SupportBean;" :
"create table MyInfra(theString string primary key, intPrimitive int);") +
"" +
(namedWindow ?
"@name('insert-into-window') insert into MyInfra select theString, intPrimitive from SupportBean;" :
"@name('insert-into-table') context SegmentedByCustomer insert into MyInfra select theString, intPrimitive from SupportBean;") +
"" +
"@name('create-index') context SegmentedByCustomer\n" +
"create index MyIndex on MyInfra(intPrimitive);";
DeploymentResult deployed = epService.getEPAdministrator().getDeploymentAdmin().parseDeploy(epl);
epService.getEPRuntime().sendEvent(new SupportBean_S0(1, "A"));
epService.getEPRuntime().sendEvent(new SupportBean_S0(2, "B"));
epService.getEPRuntime().sendEvent(new SupportBean("E1", 1));
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyInfra where intPrimitive = 1", new ContextPartitionSelector[]{new EPContextPartitionAdminImpl.CPSelectorById(1)});
EPAssertionUtil.assertPropsPerRow(result.getArray(), "theString,intPrimitive".split(","), new Object[][]{{"E1", 1}});
epService.getEPRuntime().sendEvent(new SupportBean_S1(3, "A"));
epService.getEPAdministrator().getDeploymentAdmin().undeploy(deployed.getDeploymentId());
}
开发者ID:espertechinc,项目名称:esper,代码行数:31,代码来源:ExecContextPartitionedInfra.java
示例15: runAssertionMultipleColumnMultipleIndex
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionMultipleColumnMultipleIndex(EPServiceProvider epService, boolean namedWindow) {
String stmtTextCreateOne = namedWindow ?
"create window MyInfraMCMI#keepall as (f1 string, f2 int, f3 string, f4 string)" :
"create table MyInfraMCMI as (f1 string primary key, f2 int, f3 string, f4 string)";
epService.getEPAdministrator().createEPL(stmtTextCreateOne);
epService.getEPAdministrator().createEPL("insert into MyInfraMCMI(f1, f2, f3, f4) select theString, intPrimitive, '>'||theString||'<', '?'||theString||'?' from SupportBean");
epService.getEPAdministrator().createEPL("create index MyInfraMCMIIndex1 on MyInfraMCMI(f2, f3, f1)");
epService.getEPAdministrator().createEPL("create index MyInfraMCMIIndex2 on MyInfraMCMI(f2, f3)");
epService.getEPAdministrator().createEPL("create index MyInfraMCMIIndex3 on MyInfraMCMI(f2)");
String[] fields = "f1,f2,f3,f4".split(",");
epService.getEPRuntime().sendEvent(new SupportBean("E1", -2));
epService.getEPRuntime().sendEvent(new SupportBean("E2", -4));
epService.getEPRuntime().sendEvent(new SupportBean("E3", -3));
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f3='>E1<'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f3='>E1<' and f2=-2");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f3='>E1<' and f2=-2 and f1='E1'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f2=-2");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f1='E1'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraMCMI where f3='>E1<' and f2=-2 and f1='E1' and f4='?E1?'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
epService.getEPAdministrator().destroyAllStatements();
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraMCMI", false);
}
开发者ID:espertechinc,项目名称:esper,代码行数:37,代码来源:ExecNWTableInfraCreateIndex.java
示例16: runAssertionCompositeIndex
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionCompositeIndex(EPServiceProvider epService, boolean isNamedWindow) {
String stmtTextCreate = isNamedWindow ?
"create window MyInfraCI#keepall as (f1 string, f2 int, f3 string, f4 string)" :
"create table MyInfraCI as (f1 string primary key, f2 int, f3 string, f4 string)";
epService.getEPAdministrator().createEPL(stmtTextCreate);
epService.getEPAdministrator().createEPL("insert into MyInfraCI(f1, f2, f3, f4) select theString, intPrimitive, '>'||theString||'<', '?'||theString||'?' from SupportBean");
EPStatement indexOne = epService.getEPAdministrator().createEPL("create index MyInfraCIIndex on MyInfraCI(f2, f3, f1)");
String[] fields = "f1,f2,f3,f4".split(",");
epService.getEPRuntime().sendEvent(new SupportBean("E1", -2));
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyInfraCI where f3='>E1<'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraCI where f3='>E1<' and f2=-2");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
result = epService.getEPRuntime().executeQuery("select * from MyInfraCI where f3='>E1<' and f2=-2 and f1='E1'");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{"E1", -2, ">E1<", "?E1?"}});
indexOne.destroy();
// test SODA
String create = "create index MyInfraCIIndex on MyInfraCI(f2, f3, f1)";
EPStatementObjectModel model = epService.getEPAdministrator().compileEPL(create);
assertEquals(create, model.toEPL());
EPStatement stmt = epService.getEPAdministrator().create(model);
assertEquals(create, stmt.getText());
epService.getEPAdministrator().destroyAllStatements();
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraCI", false);
}
开发者ID:espertechinc,项目名称:esper,代码行数:34,代码来源:ExecNWTableInfraCreateIndex.java
示例17: runAssertionWidening
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionWidening(EPServiceProvider epService, boolean isNamedWindow) {
// widen to long
String stmtTextCreate = isNamedWindow ?
"create window MyInfraW#keepall as (f1 long, f2 string)" :
"create table MyInfraW as (f1 long primary key, f2 string primary key)";
epService.getEPAdministrator().createEPL(stmtTextCreate);
epService.getEPAdministrator().createEPL("insert into MyInfraW(f1, f2) select longPrimitive, theString from SupportBean");
epService.getEPAdministrator().createEPL("create index MyInfraWIndex1 on MyInfraW(f1)");
String[] fields = "f1,f2".split(",");
sendEventLong(epService, "E1", 10L);
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery("select * from MyInfraW where f1=10");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{10L, "E1"}});
// coerce to short
stmtTextCreate = isNamedWindow ?
"create window MyInfraWTwo#keepall as (f1 short, f2 string)" :
"create table MyInfraWTwo as (f1 short primary key, f2 string primary key)";
epService.getEPAdministrator().createEPL(stmtTextCreate);
epService.getEPAdministrator().createEPL("insert into MyInfraWTwo(f1, f2) select shortPrimitive, theString from SupportBean");
epService.getEPAdministrator().createEPL("create index MyInfraWTwoIndex1 on MyInfraWTwo(f1)");
sendEventShort(epService, "E1", (short) 2);
result = epService.getEPRuntime().executeQuery("select * from MyInfraWTwo where f1=2");
EPAssertionUtil.assertPropsPerRow(result.getArray(), fields, new Object[][]{{(short) 2, "E1"}});
epService.getEPAdministrator().destroyAllStatements();
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraW", false);
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraWTwo", false);
}
开发者ID:espertechinc,项目名称:esper,代码行数:33,代码来源:ExecNWTableInfraCreateIndex.java
示例18: runAssertionFAFRangePerformance
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void runAssertionFAFRangePerformance(EPServiceProvider epService, boolean namedWindow) {
// create window one
String eplCreate = namedWindow ?
"create window MyInfraRP#keepall as SupportBean" :
"create table MyInfraRP (theString string primary key, intPrimitive int primary key)";
epService.getEPAdministrator().createEPL(eplCreate);
epService.getEPAdministrator().createEPL("insert into MyInfraRP select theString, intPrimitive from SupportBean");
epService.getEPAdministrator().createEPL("create index idx1 on MyInfraRP(intPrimitive btree)");
// insert X rows
int maxRows = 10000; //for performance testing change to int maxRows = 100000;
for (int i = 0; i < maxRows; i++) {
epService.getEPRuntime().sendEvent(new SupportBean("K", i));
}
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive between 200 and 202", 603);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive between 202 and 199", 199 + 200 + 201 + 202);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive >= 200 and intPrimitive <= 202", 603);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive >= 202 and intPrimitive <= 200", null);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive > 9997", 9998 + 9999);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive >= 9997", 9997 + 9998 + 9999);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive < 5", 4 + 3 + 2 + 1);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive <= 5", 5 + 4 + 3 + 2 + 1);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive in [200:202]", 603);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive in [200:202)", 401);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive in (200:202]", 403);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive in (200:202)", 201);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive not in [3:9997]", 1 + 2 + 9998 + 9999);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive not in [3:9997)", 1 + 2 + 9997 + 9998 + 9999);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive not in (3:9997]", 1 + 2 + 3 + 9998 + 9999);
runFAFAssertion(epService, "select sum(intPrimitive) as sumi from MyInfraRP where intPrimitive not in (3:9997)", 1 + 2 + 3 + 9997 + 9998 + 9999);
// test no value returned
EPOnDemandPreparedQuery query = epService.getEPRuntime().prepareQuery("select * from MyInfraRP where intPrimitive < 0");
EPOnDemandQueryResult result = query.execute();
assertEquals(0, result.getArray().length);
epService.getEPAdministrator().destroyAllStatements();
epService.getEPAdministrator().getConfiguration().removeEventType("MyInfraRP", false);
}
开发者ID:espertechinc,项目名称:esper,代码行数:41,代码来源:ExecNWTableInfraIndexFAFPerf.java
示例19: process
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
private void process(EPOnDemandPreparedQueryParameterized q, int id) {
q.setObject(1, id);
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(q);
assertEquals("failed for id " + id, 1, result.getArray().length);
assertEquals(id, result.getArray()[0].get("p0"));
stageOutput.add(id);
numberOfOperations++;
}
开发者ID:espertechinc,项目名称:esper,代码行数:9,代码来源:ExecTableMTGroupedFAFReadFAFWriteChain.java
示例20: run
import com.espertech.esper.client.EPOnDemandQueryResult; //导入依赖的package包/类
public void run() {
log.info("Started event send for read");
// warmup
try {
Thread.sleep(100);
} catch (InterruptedException e) {
}
try {
String eplSelect = "select vartotal.cnt as c0, vartotal.sumint as c1, vartotal.avgint as c2 from MyWindow";
while (!shutdown) {
EPOnDemandQueryResult result = epService.getEPRuntime().executeQuery(eplSelect);
long count = (Long) result.getArray()[0].get("c0");
int sumint = (Integer) result.getArray()[0].get("c1");
double avgint = (Double) result.getArray()[0].get("c2");
assertEquals(2d, avgint);
assertEquals(sumint, count * 2);
numQueries++;
}
} catch (RuntimeException ex) {
log.error("Exception encountered: " + ex.getMessage(), ex);
exception = ex;
}
log.info("Completed event send for read");
}
开发者ID:espertechinc,项目名称:esper,代码行数:29,代码来源:ExecTableMTUngroupedAccessWithinRowFAFConsistency.java
注:本文中的com.espertech.esper.client.EPOnDemandQueryResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论