Search in sources :

Example 1 with BasicQueryMetadataWrapper

use of org.teiid.query.metadata.BasicQueryMetadataWrapper in project teiid by teiid.

the class TranslationUtility method initWrapper.

private void initWrapper(QueryMetadataInterface acutalMetadata) {
    functionLibrary = acutalMetadata.getFunctionLibrary();
    this.functions.addAll(Arrays.asList(this.functionLibrary.getUserFunctions()));
    metadata = new BasicQueryMetadataWrapper(acutalMetadata) {

        @Override
        public FunctionLibrary getFunctionLibrary() {
            return functionLibrary;
        }
    };
}
Also used : BasicQueryMetadataWrapper(org.teiid.query.metadata.BasicQueryMetadataWrapper) FunctionLibrary(org.teiid.query.function.FunctionLibrary)

Example 2 with BasicQueryMetadataWrapper

use of org.teiid.query.metadata.BasicQueryMetadataWrapper in project teiid by teiid.

the class TestElementSymbolOptimizer method helpTestOptimize.

public void helpTestOptimize(String sql, QueryMetadataInterface metadata, String expected) throws QueryMetadataException, TeiidComponentException, QueryParserException, QueryResolverException {
    Command command = helpResolve(sql, new BasicQueryMetadataWrapper(metadata) {

        @Override
        public boolean findShortName() {
            return true;
        }
    });
    String actual = command.toString();
    // $NON-NLS-1$
    assertEquals("Expected different optimized string", expected, actual);
}
Also used : BasicQueryMetadataWrapper(org.teiid.query.metadata.BasicQueryMetadataWrapper) Command(org.teiid.query.sql.lang.Command)

Example 3 with BasicQueryMetadataWrapper

use of org.teiid.query.metadata.BasicQueryMetadataWrapper in project teiid by teiid.

the class TestElementSymbolOptimizer method testOutputNames.

@Test
public void testOutputNames() throws Exception {
    String sql = "select PM1.g1.e1, e2 FROM Pm1.G1";
    Command command = QueryParser.getQueryParser().parseCommand(sql);
    QueryMetadataInterface metadata = new BasicQueryMetadataWrapper(RealMetadataFactory.example1Cached()) {

        public boolean useOutputName() {
            return false;
        }
    };
    QueryResolver.resolveCommand(command, metadata);
    assertEquals("SELECT pm1.g1.e1, pm1.g1.e2 FROM pm1.g1", command.toString());
}
Also used : BasicQueryMetadataWrapper(org.teiid.query.metadata.BasicQueryMetadataWrapper) Command(org.teiid.query.sql.lang.Command) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) Test(org.junit.Test)

Aggregations

BasicQueryMetadataWrapper (org.teiid.query.metadata.BasicQueryMetadataWrapper)3 Command (org.teiid.query.sql.lang.Command)2 Test (org.junit.Test)1 FunctionLibrary (org.teiid.query.function.FunctionLibrary)1 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)1