private ElementSymbol exceptionSymbol(GroupSymbol gs, int pos) { ElementSymbol es = UpdateProcedureResolver.exceptionGroup.get(pos).clone(); es.setGroupSymbol(gs); return es; }
private ElementSymbol exceptionSymbol(GroupSymbol gs, int pos) { ElementSymbol es = UpdateProcedureResolver.exceptionGroup.get(pos).clone(); es.setGroupSymbol(gs); return es; }
public static Map<ElementSymbol, List<Set<Constant>>> remapPartitionInfo( GroupSymbol group, Map<ElementSymbol, List<Set<Constant>>> partitionInfo) { Map<ElementSymbol, List<Set<Constant>>> aliasedPartitionInfo = new LinkedHashMap<ElementSymbol, List<Set<Constant>>>(); for (Map.Entry<ElementSymbol, List<Set<Constant>>> entry : partitionInfo.entrySet()) { ElementSymbol es = entry.getKey().clone(); es.setGroupSymbol(group.clone()); aliasedPartitionInfo.put(es, entry.getValue()); } return aliasedPartitionInfo; }
public static Map<ElementSymbol, List<Set<Constant>>> remapPartitionInfo( GroupSymbol group, Map<ElementSymbol, List<Set<Constant>>> partitionInfo) { Map<ElementSymbol, List<Set<Constant>>> aliasedPartitionInfo = new LinkedHashMap<ElementSymbol, List<Set<Constant>>>(); for (Map.Entry<ElementSymbol, List<Set<Constant>>> entry : partitionInfo.entrySet()) { ElementSymbol es = entry.getKey().clone(); es.setGroupSymbol(group.clone()); aliasedPartitionInfo.put(es, entry.getValue()); } return aliasedPartitionInfo; }
public Expression replaceExpression(Expression element) { if (element instanceof ElementSymbol) { ElementSymbol es = (ElementSymbol)element; if (es.getGroupSymbol().getMetadataID() == gid) { es.setGroupSymbol(newGroup); } } return element; } };
/** Short element from aliased group: "c" */ public static final ElementSymbol sampleElement3() { ElementSymbol element = new ElementSymbol("gg.c", false); //$NON-NLS-1$ element.setGroupSymbol(sampleGroup2()); return element; }
/** Long element from unaliased group: "m.g.c" */ public static final ElementSymbol sampleElement2() { ElementSymbol element = new ElementSymbol("m.g.c"); //$NON-NLS-1$ element.setGroupSymbol(sampleGroup1()); return element; }
/** Short element from unaliased group: "c" */ public static final ElementSymbol sampleElement1() { ElementSymbol element = new ElementSymbol("m.g.c", false); //$NON-NLS-1$ element.setGroupSymbol(sampleGroup1()); return element; }
/** Long element from aliased group: "gg.c" */ public static final ElementSymbol sampleElement4() { ElementSymbol element = new ElementSymbol("gg.c"); //$NON-NLS-1$ element.setGroupSymbol(sampleGroup2()); return element; }
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 testEquals13() { ElementSymbol es1 = new ElementSymbol("abcd"); //$NON-NLS-1$ es1.setGroupSymbol(sampleGroup1()); ElementSymbol es2 = new ElementSymbol("AbCd"); //$NON-NLS-1$ es2.setGroupSymbol(sampleGroup1()); helpEquals(es1, es2, false); }
public static ElementSymbol helpExample(String groupName, String elementName, Object metadataID) { ElementSymbol symbol = new ElementSymbol(elementName); symbol.setGroupSymbol(TestGroupImpl.helpExample(groupName)); symbol.setType(Integer.class); symbol.setMetadataID(metadataID); return symbol; }
public ElementSymbol getElementSymbolWithGroupAlias(int groupNum, int elementNum, String alias) throws Exception { String id = "pm1.g" + groupNum + ".e" + elementNum; //$NON-NLS-1$ //$NON-NLS-2$ ElementSymbol es = new ElementSymbol(id); es.setMetadataID(this.metadata.getElementID(id)); es.setGroupSymbol(getPhysicalGroupWithAlias(groupNum, alias)); return es; }
@Test public void testElementSymbol5() { ElementSymbol es = new ElementSymbol("m.g.select", false); //$NON-NLS-1$ es.setGroupSymbol(new GroupSymbol("m.g")); //$NON-NLS-1$ helpTest(es, "\"select\""); //$NON-NLS-1$ }
@Test public void testElementSymbol3() { ElementSymbol es = new ElementSymbol("m.g.elem", true); //$NON-NLS-1$ es.setGroupSymbol(new GroupSymbol("m.g")); //$NON-NLS-1$ helpTest(es, "m.g.elem"); //$NON-NLS-1$ }
@Test public void testElementSymbol2() { ElementSymbol es = new ElementSymbol("elem", false); //$NON-NLS-1$ es.setGroupSymbol(new GroupSymbol("m.g")); //$NON-NLS-1$ helpTest(es, "elem"); //$NON-NLS-1$ }
@Test public void testEqualsWithAndWithoutGroupSymbol() { ElementSymbol e1 = new ElementSymbol("x.y"); ElementSymbol e2 = new ElementSymbol("y"); e2.setGroupSymbol(new GroupSymbol("x")); helpEquals(e1, e2, true); }
@Test public void testRewriteInCriteriaWithNoValues() throws Exception { ElementSymbol e1 = new ElementSymbol("e1"); e1.setGroupSymbol(new GroupSymbol("g1")); SetCriteria crit = new SetCriteria(e1, Collections.EMPTY_LIST); //$NON-NLS-1$ Criteria actual = QueryRewriter.rewriteCriteria(crit, null, null); assertEquals(QueryRewriter.FALSE_CRITERIA, actual); crit.setNegated(true); actual = QueryRewriter.rewriteCriteria(crit, null, null); assertEquals(QueryRewriter.TRUE_CRITERIA, actual); }
@Test public void testCriteria1() { CompareCriteria expected = new CompareCriteria(); ElementSymbol es = new ElementSymbol("pm1.g1.e1"); //$NON-NLS-1$ GroupSymbol gs = new GroupSymbol("pm1.g1"); //$NON-NLS-1$ es.setGroupSymbol(gs); expected.setLeftExpression(es); expected.setOperator(CompareCriteria.EQ); expected.setRightExpression(new Constant("abc")); //$NON-NLS-1$ Criteria actual = helpResolveCriteria("pm1.g1.e1 = 'abc'"); //$NON-NLS-1$ assertEquals("Did not match expected criteria", expected, actual); //$NON-NLS-1$ }
/** * Ensures that views are named with v_ even without metadata */ @Test public void testViewAliasing() throws Exception { String sql = "select y.e1 from (select pm1.g1.e1 from pm1.g1) y"; //$NON-NLS-1$ Query command = (Query)QueryParser.getQueryParser().parseCommand(sql); ((ElementSymbol)command.getSelect().getSymbol(0)).setGroupSymbol(new GroupSymbol("y")); //$NON-NLS-1$ command.acceptVisitor(new AliasGenerator(true)); assertEquals("SELECT v_0.c_0 FROM (SELECT g_0.e1 AS c_0 FROM pm1.g1 AS g_0) AS v_0", command.toString()); //$NON-NLS-1$ }