public static List<Expression> getUpdateCommandSymbol() { if (updateCommandSymbol == null ) { ElementSymbol symbol = new ElementSymbol("Count"); //$NON-NLS-1$ symbol.setType(DataTypeManager.DefaultDataClasses.INTEGER); updateCommandSymbol = Arrays.asList((Expression)symbol); } return updateCommandSymbol; }
/** * Get list of resolved elements describing output columns for this plan. * @return List of SingleElementSymbol */ public List getOutputElements() { ArrayList output = new ArrayList(1); ElementSymbol xml = new ElementSymbol("xml"); //$NON-NLS-1$ xml.setType(DataTypeManager.DefaultDataClasses.XML); output.add(xml); return output; }
public static List<Expression> getUpdateCommandSymbol() { if (updateCommandSymbol == null ) { ElementSymbol symbol = new ElementSymbol("Count"); //$NON-NLS-1$ symbol.setType(DataTypeManager.DefaultDataClasses.INTEGER); updateCommandSymbol = Arrays.asList((Expression)symbol); } return updateCommandSymbol; }
static String getNewSymbolName(String newGroupName, ElementSymbol elementSymbol, Map symbolMap) { int index = 1; String newSymbolName = elementSymbol.getShortName(); while (symbolMap.values().contains(new ElementSymbol(newGroupName + Symbol.SEPARATOR + newSymbolName))) { newSymbolName = elementSymbol.getShortName() + "_" + index++; //$NON-NLS-1$ } return newSymbolName; }
private static Expression mapExpression(GroupSymbol varGroup, ArrayList<Expression> selectSymbols, int i, Expression ex) { String name = "s_" +i; //$NON-NLS-1$ selectSymbols.add(new AliasSymbol(name, ex)); ex = new ElementSymbol(name, varGroup.clone()); return ex; }
private static Expression mapExpression(GroupSymbol varGroup, ArrayList<Expression> selectSymbols, int i, Expression ex) { String name = "s_" +i; //$NON-NLS-1$ selectSymbols.add(new AliasSymbol(name, ex)); ex = new ElementSymbol(name, varGroup.clone()); return ex; }
/** * Constructor used when constructing a parameter during execution. In this case we * know what the parameter is being filled with but no metadata about the parameter. * * @param index the positional index of this parameter * @param value the Value of this parameter */ public SPParameter(int index, Expression expression){ setIndex(index); setExpression(expression); this.parameterSymbol = new ElementSymbol(""); //$NON-NLS-1$ }
private ElementSymbol getImplicitPartitionColumn(QueryMetadataInterface metadata, PlanNode node) throws TeiidComponentException, QueryMetadataException { GroupSymbol gs = node.getGroups().iterator().next(); Object modelId = getEffectiveModelId(metadata, gs); String name = metadata.getExtensionProperty(modelId, IMPLICIT_PARTITION_COLUMN_NAME, true); if (name != null) { return new ElementSymbol(name, gs); } return null; }
private ElementSymbol getImplicitPartitionColumn(QueryMetadataInterface metadata, PlanNode node) throws TeiidComponentException, QueryMetadataException { GroupSymbol gs = node.getGroups().iterator().next(); Object modelId = getEffectiveModelId(metadata, gs); String name = metadata.getExtensionProperty(modelId, IMPLICIT_PARTITION_COLUMN_NAME, true); if (name != null) { return new ElementSymbol(name, gs); } return null; }
/** * Set full parameter name * @param name Parameter name */ public void setName(String name) { ElementSymbol es = new ElementSymbol(name); es.setMetadataID(parameterSymbol.getMetadataID()); es.setType(parameterSymbol.getType()); this.parameterSymbol = es; }
@Override public void visit(UriResourcePrimitiveProperty info) { String propertyName = info.getProperty().getName(); ElementSymbol es = new ElementSymbol(propertyName, this.context.getGroupSymbol()); this.context.addProjectedColumn(propertyName, es); this.selectionComplete = true; }
@Test public void testElementsInCritieria1() throws Exception { String criteria = "e1 = '1' and ((e1 = '2' OR e1 = '4') AND e2 = 3) or e2 is null"; //$NON-NLS-1$ Set<ElementSymbol> expected = new HashSet<ElementSymbol>(Arrays.asList(new ElementSymbol("e2"))); //$NON-NLS-1$ assertEquals(expected, RulePushSelectCriteria.getElementsIncriteria(QueryParser.getQueryParser().parseCriteria(criteria))); }
public static ElementSymbol helpExample(String groupName, String elementName) { ElementSymbol symbol = new ElementSymbol(elementName); symbol.setType(String.class); symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName)); return symbol; }
@Test public void testSupportsAggregate10() throws Exception { BasicSourceCapabilities caps = new BasicSourceCapabilities(); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_AVG, true); AggregateSymbol aggregate = new AggregateSymbol(NonReserved.AVG, false, new ElementSymbol("x")); //$NON-NLS-1$ //$NON-NLS-2$ helpTestSupportsAggregateFunction(caps, aggregate, true); }
@Test public void testSupportsAggregate4() throws Exception { BasicSourceCapabilities caps = new BasicSourceCapabilities(); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, false); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, true); AggregateSymbol aggregate = new AggregateSymbol(NonReserved.COUNT, false, new ElementSymbol("x")); //$NON-NLS-1$ //$NON-NLS-2$ helpTestSupportsAggregateFunction(caps, aggregate, false); }
@Test public void testSupportsAggregate6() throws Exception { BasicSourceCapabilities caps = new BasicSourceCapabilities(); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES, true); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT, true); caps.setCapabilitySupport(Capability.QUERY_AGGREGATES_COUNT_STAR, false); AggregateSymbol aggregate = new AggregateSymbol(NonReserved.COUNT, false, new ElementSymbol("x")); //$NON-NLS-1$ //$NON-NLS-2$ helpTestSupportsAggregateFunction(caps, aggregate, true); }
@Test public void testXmlSerialize1() throws Exception { XMLSerialize f = new XMLSerialize(); f.setExpression(new ElementSymbol("x")); f.setTypeString("CLOB"); helpTestExpression("xmlserialize(x as CLOB)", "XMLSERIALIZE(x AS CLOB)", f); }
@Override protected void addAllColumns(boolean onlyPK) { for (final Column column : procedure.getResultSet().getColumns()) { if (column.isSelectable()) { EdmReturnType returnType = procedureReturn.getReturnType(); EdmComplexType complexType = (EdmComplexType)returnType.getType(); EdmPropertyImpl edmProperty = (EdmPropertyImpl)complexType.getProperty(column.getName()); addProjectedColumn(new ElementSymbol(column.getName(), getGroupSymbol()), edmProperty.getType(), edmProperty, edmProperty.isCollection()); } } }
@Test public void testXmlSerialize() throws Exception { XMLSerialize f = new XMLSerialize(); f.setDocument(true); f.setExpression(new ElementSymbol("x")); f.setTypeString("CLOB"); helpTestExpression("xmlserialize(document x as CLOB)", "XMLSERIALIZE(DOCUMENT x AS CLOB)", f); }
@Test public void testXmlParse() throws Exception { XMLParse f = new XMLParse(); f.setDocument(true); f.setExpression(new ElementSymbol("x")); f.setWellFormed(true); helpTestExpression("xmlparse(document x wellformed)", "XMLPARSE(DOCUMENT x WELLFORMED)", f); }