Package org.teiid.query.sql.symbol

Examples of org.teiid.query.sql.symbol.SingleElementSymbol


        }
        List<SingleElementSymbol> selectSymbols = SetQuery.getTypedProjectedSymbols(ResolverUtil.resolveElementsInGroup(inlineGroup, tma), actualTypes, tma);
        Iterator<? extends SingleElementSymbol> iter = actualSymbols.iterator();
        for (SingleElementSymbol ses : selectSymbols) {
          ses = (SingleElementSymbol)ses.clone();
          SingleElementSymbol actual = iter.next();
          if (!ses.getShortCanonicalName().equals(actual.getShortCanonicalName())) {
            if (ses instanceof AliasSymbol) {
              ((AliasSymbol)ses).setShortName(actual.getShortName());
            } else {
              ses = new AliasSymbol(actual.getShortName(), ses);
            }
          }
      select.addSymbol(ses);
    }
        query.setFrom(from);
View Full Code Here


       
        HashSet<String> uniqueNames = new HashSet<String>();
       
        for(int i = 0; i < symbols.size(); i++) {
           
            SingleElementSymbol symbol = (SingleElementSymbol)symbols.get(i);
           
            String baseName = symbol.getShortCanonicalName();
            String name = baseName;

            int exprID = 0;
            while (true) {
                if (uniqueNames.add(name)) {
View Full Code Here

      Map<ElementSymbol, ElementSymbol> symbolMap) {
    ArrayList<SingleElementSymbol> selectSymbols = new ArrayList<SingleElementSymbol>(update.getChangeList().getClauses().size());
    int i = 0;
    for (SetClause clause : update.getChangeList().getClauses()) {
      Expression ex = clause.getValue();
      SingleElementSymbol selectSymbol = null;
      if (!EvaluatableVisitor.willBecomeConstant(ex)) {
        if (!(ex instanceof SingleElementSymbol)) {
          selectSymbol = new ExpressionSymbol("expr", ex); //$NON-NLS-1$
        } else {
          selectSymbol = (SingleElementSymbol)ex;
View Full Code Here

        List<SingleElementSymbol> bindings = QueryResolver.parseBindings(modifiedNode);

        String nodeStr = (sourceNode.getActualResultSetName() + ElementSymbol.SEPARATOR).toUpperCase();
       
        for (Iterator<SingleElementSymbol> i = bindings.iterator(); i.hasNext();) {
          SingleElementSymbol ses = i.next();
          if (ses instanceof AliasSymbol) {
            ses = ((AliasSymbol)ses).getSymbol();
          }
            ElementSymbol binding = (ElementSymbol)ses;
           
View Full Code Here

                             QueryNode oldQueryNode,
                             QueryNode modifiedNode) throws TeiidComponentException {
        if (oldQueryNode.getBindings() != null) {
            List<String> bindings = new ArrayList<String>();
            for (Iterator<SingleElementSymbol> i = QueryResolver.parseBindings(oldQueryNode).iterator(); i.hasNext();) {
              SingleElementSymbol ses = i.next();
              String name = ses.getName();
              boolean useName = false;
              if (ses instanceof AliasSymbol) {
                ses = ((AliasSymbol)ses).getSymbol();
                useName = true;
              }
View Full Code Here

     * @return matched alias symbol; null otherwise.
     */
    private AliasSymbol getMachingAlias(List elementsInGroup, ElementSymbol symbol) {
       
        for(Iterator i = elementsInGroup.iterator(); i.hasNext();) {
            final SingleElementSymbol element = (SingleElementSymbol)i.next();
            if (element instanceof AliasSymbol) {
                AliasSymbol alias = (AliasSymbol)element;
                if (alias.getSymbol().equals(symbol)) {
                    return alias;
                }
View Full Code Here

      // Get list of all group by IDs
        List groupBySymbols = obj.getSymbols();
        validateSortable(groupBySymbols);
    Iterator symbolIter = groupBySymbols.iterator();
    while(symbolIter.hasNext()) {
            SingleElementSymbol symbol = (SingleElementSymbol)symbolIter.next();
            if(symbol instanceof ExpressionSymbol) {
                ExpressionSymbol exprSymbol = (ExpressionSymbol) symbol;
                Expression expr = exprSymbol.getExpression();
                if (!ValueIteratorProviderCollectorVisitor.getValueIteratorProviders(expr).isEmpty() || expr instanceof Constant || expr instanceof Reference) {
                  handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.groupby_subquery", expr), expr); //$NON-NLS-1$
View Full Code Here

     * @param symbols List of SingleElementSymbol
     */
    protected void validateSortable(List symbols) {
        Iterator iter = symbols.iterator();
        while(iter.hasNext()) {
            SingleElementSymbol symbol = (SingleElementSymbol) iter.next();
            validateSortable(symbol);
        }
    }
View Full Code Here

        if(groupBy != null || having != null || !AggregateSymbolCollectorVisitor.getAggregates(select, false).isEmpty()) {
            Set<Expression> groupSymbols = null;
            if(groupBy != null) {
                groupSymbols = new HashSet<Expression>();
                for (final Iterator iterator = groupBy.getSymbols().iterator(); iterator.hasNext();) {
                    final SingleElementSymbol element = (SingleElementSymbol)iterator.next();
                    groupSymbols.add(SymbolMap.getExpression(element));
                }
            }
           
            // Validate HAVING, if it exists
View Full Code Here

                handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.select_into_wrong_elements", new Object[] {new Integer(elementIDs.size()), new Integer(symbols.size())}), query); //$NON-NLS-1$
                return;
            }
           
            for (int symbolNum = 0; symbolNum < symbols.size(); symbolNum++) {
                SingleElementSymbol symbol = symbols.get(symbolNum);
                Object elementID = elementIDs.get(symbolNum);
                // Check if supports updates
                if (!getMetadata().elementSupports(elementID, SupportConstants.Element.UPDATE)) {
                    handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.element_updates_not_allowed", getMetadata().getFullName(elementID)), intoGroup); //$NON-NLS-1$
                }

                Class<?> symbolType = symbol.getType();
                String symbolTypeName = DataTypeManager.getDataTypeName(symbolType);
                String targetTypeName = getMetadata().getElementType(elementID);
                if (symbolTypeName.equals(targetTypeName)) {
                    continue;
                }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.symbol.SingleElementSymbol

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.