use of org.teiid.query.analysis.AnalysisRecord in project teiid by teiid.
the class TestMaterialization method testMaterializedTransformationLoading.
@Ignore("we no longer auto detect this case, if we need this logic it will have to be added to the rewriter since it changes select into to an insert")
@Test
public void testMaterializedTransformationLoading() throws Exception {
// $NON-NLS-1$
String userSql = "SELECT MATVIEW.E1 INTO MatTable.MatStage FROM MATVIEW";
QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
// $NON-NLS-1$
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] { "SELECT g_0.x FROM MatSrc.MatSrc AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING);
Collection<Annotation> annotations = analysis.getAnnotations();
// $NON-NLS-1$
assertNotNull("Expected annotations but got none", annotations);
// $NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
// $NON-NLS-1$
assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW);
}
use of org.teiid.query.analysis.AnalysisRecord in project teiid by teiid.
the class TestMaterialization method testManagedMaterializedTransformation.
@Test
public void testManagedMaterializedTransformation() throws Exception {
// $NON-NLS-1$
String userSql = "SELECT * FROM ManagedMatView";
QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
RelationalPlan plan = (RelationalPlan) TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] { // $NON-NLS-1$
"SELECT g_0.e1 FROM MatTable.MatTable AS g_0 WHERE mvstatus('MatView', 'ManagedMatView') = 1" }, ComparisonMode.EXACT_COMMAND_STRING);
Collection<Annotation> annotations = analysis.getAnnotations();
// $NON-NLS-1$
assertNotNull("Expected annotations but got none", annotations);
// $NON-NLS-1$
assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW);
}
use of org.teiid.query.analysis.AnalysisRecord in project teiid by teiid.
the class TestMaterialization method testMaterializedTransformationNoCache.
@Test
public void testMaterializedTransformationNoCache() throws Exception {
// $NON-NLS-1$
String userSql = "SELECT MATVIEW.E1 FROM MATVIEW OPTION NOCACHE MatView.MatView";
QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
// $NON-NLS-1$
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] { "SELECT g_0.x FROM MatSrc.MatSrc AS g_0" }, ComparisonMode.EXACT_COMMAND_STRING);
Collection<Annotation> annotations = analysis.getAnnotations();
// $NON-NLS-1$
assertNotNull("Expected annotations but got none", annotations);
// $NON-NLS-1$
assertTrue("Expected one annotation", annotations.size() == 1);
// $NON-NLS-1$
assertEquals("Expected catagory mat view", annotations.iterator().next().getCategory(), Annotation.MATERIALIZED_VIEW);
}
use of org.teiid.query.analysis.AnalysisRecord in project teiid by teiid.
the class TestMaterialization method testNoCacheCascade.
@Test
public void testNoCacheCascade() throws Exception {
// $NON-NLS-1$
String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache";
QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
// $NON-NLS-1$
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] { "SELECT g_0.x FROM MatSrc.MatSrc AS g_0 WHERE g_0.x = '1'" }, ComparisonMode.EXACT_COMMAND_STRING);
}
use of org.teiid.query.analysis.AnalysisRecord in project teiid by teiid.
the class TestMaterialization method testTableNoCacheDoesntCascade.
@Test
public void testTableNoCacheDoesntCascade() throws Exception {
// $NON-NLS-1$
String userSql = "SELECT MATVIEW1.E1 FROM MATVIEW1 option nocache matview.matview1";
QueryMetadataInterface metadata = RealMetadataFactory.exampleMaterializedView();
AnalysisRecord analysis = new AnalysisRecord(true, DEBUG);
Command command = helpGetCommand(userSql, metadata, null);
// $NON-NLS-1$
TestOptimizer.helpPlanCommand(command, metadata, getGenericFinder(), analysis, new String[] { "SELECT g_0.e1 FROM MatTable.MatTable AS g_0 WHERE g_0.e1 = '1'" }, ComparisonMode.EXACT_COMMAND_STRING);
}
Aggregations