Beispiel #1
0
 /*@NotNull*/
 public SequenceIterator getAnother() throws XPathException {
   XPathContext c2 = keyContext.newMinorContext();
   return new GroupByIterator(population.getAnother(), keyExpression, c2, collator);
 }
Beispiel #2
0
 private List<?> processRow()
     throws ExpressionEvaluationException, BlockedException, TeiidComponentException,
         TeiidProcessingException {
   List<Object> tuple = new ArrayList<Object>(projectedColumns.size());
   for (XMLColumn proColumn : projectedColumns) {
     if (proColumn.isOrdinal()) {
       if (rowCount > Integer.MAX_VALUE) {
         throw new TeiidRuntimeException(
             new TeiidProcessingException(
                 QueryPlugin.Event.TEIID31174, QueryPlugin.Util.gs(QueryPlugin.Event.TEIID31174)));
       }
       tuple.add((int) rowCount);
     } else {
       try {
         XPathExpression path = proColumn.getPathExpression();
         XPathDynamicContext dynamicContext = path.createDynamicContext(item);
         SequenceIterator pathIter = path.iterate(dynamicContext);
         Item colItem = pathIter.next();
         if (colItem == null) {
           if (proColumn.getDefaultExpression() != null) {
             tuple.add(
                 getEvaluator(Collections.emptyMap())
                     .evaluate(proColumn.getDefaultExpression(), null));
           } else {
             tuple.add(null);
           }
           continue;
         }
         if (proColumn.getSymbol().getType() == DataTypeManager.DefaultDataClasses.XML) {
           XMLType value =
               table
                   .getXQueryExpression()
                   .createXMLType(
                       pathIter.getAnother(), this.getBufferManager(), false, getContext());
           tuple.add(value);
           continue;
         }
         Item next = pathIter.next();
         if (next != null) {
           if (proColumn.getSymbol().getType().isArray()) {
             ArrayList<Object> vals = new ArrayList<Object>();
             vals.add(
                 getValue(
                     proColumn.getSymbol().getType().getComponentType(),
                     colItem,
                     this.table.getXQueryExpression().getConfig(),
                     getContext()));
             vals.add(
                 getValue(
                     proColumn.getSymbol().getType().getComponentType(),
                     next,
                     this.table.getXQueryExpression().getConfig(),
                     getContext()));
             while ((next = pathIter.next()) != null) {
               vals.add(
                   getValue(
                       proColumn.getSymbol().getType().getComponentType(),
                       next,
                       this.table.getXQueryExpression().getConfig(),
                       getContext()));
             }
             Object value =
                 new ArrayImpl(
                     vals.toArray(
                         (Object[])
                             Array.newInstance(
                                 proColumn.getSymbol().getType().getComponentType(),
                                 vals.size())));
             tuple.add(value);
             continue;
           }
           throw new TeiidProcessingException(
               QueryPlugin.Event.TEIID30171,
               QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30171, proColumn.getName()));
         }
         Object value =
             getValue(
                 proColumn.getSymbol().getType(),
                 colItem,
                 this.table.getXQueryExpression().getConfig(),
                 getContext());
         tuple.add(value);
       } catch (XPathException e) {
         throw new TeiidProcessingException(
             QueryPlugin.Event.TEIID30172,
             e,
             QueryPlugin.Util.gs(QueryPlugin.Event.TEIID30172, proColumn.getName()));
       }
     }
   }
   item = null;
   return tuple;
 }