Search in sources :

Example 1 with DerivedColumn

use of org.teiid.query.sql.symbol.DerivedColumn in project teiid by teiid.

the class TextAgg method buildResult.

private FileStoreInputStreamFactory buildResult(CommandContext context) throws TeiidProcessingException {
    try {
        // $NON-NLS-1$
        FileStore fs = context.getBufferManager().createFileStore("textagg");
        FileStoreInputStreamFactory fisf = new FileStoreInputStreamFactory(fs, textLine.getEncoding() == null ? Streamable.ENCODING : textLine.getEncoding());
        Writer w = fisf.getWriter();
        if (textLine.isIncludeHeader()) {
            Object[] header = TextLine.evaluate(textLine.getExpressions(), new TextLine.ValueExtractor<DerivedColumn>() {

                public Object getValue(DerivedColumn t) {
                    if (t.getAlias() == null && t.getExpression() instanceof ElementSymbol) {
                        return ((ElementSymbol) t.getExpression()).getShortName();
                    }
                    return t.getAlias();
                }
            }, textLine);
            writeList(w, header);
        }
        w.flush();
        return fisf;
    } catch (IOException e) {
        throw new TeiidProcessingException(QueryPlugin.Event.TEIID30420, e);
    }
}
Also used : ElementSymbol(org.teiid.query.sql.symbol.ElementSymbol) FileStore(org.teiid.common.buffer.FileStore) FileStoreInputStreamFactory(org.teiid.common.buffer.FileStoreInputStreamFactory) TextLine(org.teiid.query.sql.symbol.TextLine) IOException(java.io.IOException) DerivedColumn(org.teiid.query.sql.symbol.DerivedColumn) Writer(java.io.Writer) TeiidProcessingException(org.teiid.core.TeiidProcessingException)

Example 2 with DerivedColumn

use of org.teiid.query.sql.symbol.DerivedColumn in project teiid by teiid.

the class XMLTable method cloneDirect.

@Override
protected XMLTable cloneDirect() {
    XMLTable clone = new XMLTable();
    this.copy(clone);
    for (XMLColumn column : columns) {
        clone.getColumns().add(column.clone());
    }
    if (this.namespaces != null) {
        clone.namespaces = this.namespaces.clone();
    }
    if (this.passing != null) {
        for (DerivedColumn col : this.passing) {
            clone.passing.add(col.clone());
        }
    }
    clone.xquery = this.xquery;
    if (this.xqueryExpression != null) {
        clone.xqueryExpression = this.xqueryExpression.clone();
    }
    clone.usingDefaultColumn = usingDefaultColumn;
    return clone;
}
Also used : DerivedColumn(org.teiid.query.sql.symbol.DerivedColumn)

Example 3 with DerivedColumn

use of org.teiid.query.sql.symbol.DerivedColumn in project teiid by teiid.

the class ObjectTable method cloneDirect.

@Override
protected ObjectTable cloneDirect() {
    ObjectTable clone = new ObjectTable();
    this.copy(clone);
    for (ObjectColumn column : columns) {
        clone.getColumns().add(column.clone());
    }
    if (this.passing != null) {
        for (DerivedColumn col : this.passing) {
            clone.passing.add(col.clone());
        }
    }
    clone.rowScript = this.rowScript;
    clone.compiledScript = this.compiledScript;
    clone.scriptingLanguage = this.scriptingLanguage;
    return clone;
}
Also used : DerivedColumn(org.teiid.query.sql.symbol.DerivedColumn)

Aggregations

DerivedColumn (org.teiid.query.sql.symbol.DerivedColumn)3 IOException (java.io.IOException)1 Writer (java.io.Writer)1 FileStore (org.teiid.common.buffer.FileStore)1 FileStoreInputStreamFactory (org.teiid.common.buffer.FileStoreInputStreamFactory)1 TeiidProcessingException (org.teiid.core.TeiidProcessingException)1 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)1 TextLine (org.teiid.query.sql.symbol.TextLine)1