MultiInsertStatementAnalyzer extends BaseAnalyzer { @Override public AnalyzeContext analyze() throws SemanticAnalyzerException { fromAnalyzer(); parallelAnalyzer(); dataSourceQueryArgumentsAnalyzer(); for (MultiInsertContext select : multiInsertContext.getInserts()) { SemanticAnalyzer analyzer = SemanticAnalyzerFactory.createAnalyzer(select, getAllSchemas()); MultiInsertAnalyzer mAnalzyer = (MultiInsertAnalyzer)analyzer; mAnalzyer.setFromAnalyzeContext(context.getFrom()); context.getMultiSelectBodyAnalyzeContexts().add((MultiInsertAnalyzeContext)mAnalzyer.analyze()); } validateSelectStatement(); return context; } MultiInsertStatementAnalyzer(ParseContext parseContext); @Override AnalyzeContext analyze();  }
@Test public void testSimpleSelect1() throws Exception { String sql = "FROM s1 INSERT INTO STREAM s1 SELECT * " + "INSERT INTO STREAM s2 SELECT id " + "INSERT INTO STREAM s3 SELECT id, name WHERE id > 10"; SemanticAnalyzer analyzer = SemanticAnalyzerFactory.createAnalyzer(parser.parse(sql), initSchemas()); analyzer.analyze(); org.junit.Assert.assertEquals(1, 1); }
@Test public void testSimpleSelect2() throws Exception { String sql = "FROM ( SELECT * FROM s1 ) INSERT INTO STREAM s1 SELECT * " + "INSERT INTO STREAM s2 SELECT id " + "INSERT INTO STREAM s3 SELECT id, name WHERE id > 10"; SemanticAnalyzer analyzer = SemanticAnalyzerFactory.createAnalyzer(parser.parse(sql), initSchemas()); analyzer.analyze(); org.junit.Assert.assertEquals(1, 1); }
@Test public void testSimpleSelect3() throws Exception { String sql = "FROM ( SELECT * FROM s1 )[RANGE 1 SECONDS SLIDE ] " + "INSERT INTO STREAM s1 SELECT * " + "INSERT INTO STREAM s2 SELECT id " + "INSERT INTO STREAM s3 SELECT id, name WHERE id > 10"; SemanticAnalyzer analyzer = SemanticAnalyzerFactory.createAnalyzer(parser.parse(sql), initSchemas()); try { analyzer.analyze(); fail("multi insert test cast window test failed."); } catch (SemanticAnalyzerException e) { org.junit.Assert.assertEquals(1, 1); } }
@Test public void testSimpleSelect4() throws Exception { String sql = "FROM " + " ( SELECT count(id) as id, 'sss' as name " + " FROM s1( id > 5 )[RANGE 1 SECONDS SLIDE ] GROUP BY name ) " + "INSERT INTO STREAM s1 SELECT count(*) group by id " + "INSERT INTO STREAM s2 SELECT id " + "INSERT INTO STREAM s3 SELECT id, name WHERE id > 10"; SemanticAnalyzer analyzer = SemanticAnalyzerFactory.createAnalyzer(parser.parse(sql), initSchemas()); try { analyzer.analyze(); fail("multi insert test cast group by test failed."); } catch (SemanticAnalyzerException e) { org.junit.Assert.assertEquals(1, 1); } }