QuotedID attribute = idfac.createAttributeID(columnName); attributes.add(attribute);
QuotedID attribute = idfac.createAttributeID(columnName); attributes.add(attribute);
public QuotedID getSelectItemAliasedId(SelectExpressionItem si) { if (si.getAlias() != null && si.getAlias().getName() != null) { return idfac.createAttributeID(si.getAlias().getName()); } else if (si.getExpression() instanceof Column) { return idfac.createAttributeID(((Column)si.getExpression()).getColumnName()); } else throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", si); }
public QuotedID getSelectItemAliasedId(SelectExpressionItem si) { if (si.getAlias() != null && si.getAlias().getName() != null) { return idfac.createAttributeID(si.getAlias().getName()); } else if (si.getExpression() instanceof Column) { return idfac.createAttributeID(((Column)si.getExpression()).getColumnName()); } else throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", si); }
@Override public void visit(Column expression) { QuotedID column = idfac.createAttributeID(expression.getColumnName()); Table table = expression.getTable(); RelationID relation = (table != null) && (table.getName() != null) ? idfac.createRelationID(table.getSchemaName(), table.getName()) : null; QualifiedAttributeID qa = new QualifiedAttributeID(relation, column); Term var = attributes.get(qa); if (var == null) { // can be // - a CONSTANT or // - a PSEUDO-COLUMN like ROWID, ROWNUM or // - a FUNCTION without arguments like USER, CURRENT_DATE if (column.equals(idfac.createAttributeID("true"))) result = termFactory.getBooleanConstant(true); else if (column.equals(idfac.createAttributeID("false"))) result = termFactory.getBooleanConstant(false); else throw new UnsupportedSelectQueryRuntimeException("Unable to find attribute name ", expression); } else { // if it is an attribute name (qualified or not) result = var; } }
@Override public void visit(Column expression) { QuotedID column = idfac.createAttributeID(expression.getColumnName()); Table table = expression.getTable(); RelationID relation = (table != null) && (table.getName() != null) ? idfac.createRelationID(table.getSchemaName(), table.getName()) : null; QualifiedAttributeID qa = new QualifiedAttributeID(relation, column); Term var = attributes.get(qa); if (var == null) { // can be // - a CONSTANT or // - a PSEUDO-COLUMN like ROWID, ROWNUM or // - a FUNCTION without arguments like USER, CURRENT_DATE if (column.equals(idfac.createAttributeID("true"))) result = TERM_FACTORY.getBooleanConstant(true); else if (column.equals(idfac.createAttributeID("false"))) result = TERM_FACTORY.getBooleanConstant(false); else throw new UnsupportedSelectQueryRuntimeException("Unable to find attribute name ", expression); } else { // if it is an attribute name (qualified or not) result = var; } }
if (term instanceof Variable) { Variable var = (Variable) term; QuotedID attribute = idfac.createAttributeID(var.getName()); newTerm = attributes.get(new QualifiedAttributeID(null, attribute));
if (term instanceof Variable) { Variable var = (Variable) term; QuotedID attribute = idfac.createAttributeID(var.getName()); newTerm = attributes.get(new QualifiedAttributeID(null, attribute));
QuotedID pkAttrId = idfac.createAttributeID(pkAttrs[i]); Attribute pkAttr = pkTable.getAttribute(pkAttrId); if (pkAttr == null) { break; QuotedID fkAttrId = idfac.createAttributeID(fkAttrs[i]); Attribute fkAttr = fkTable.getAttribute(fkAttrId); if (fkAttr == null) {
QuotedID pkAttrId = idfac.createAttributeID(pkAttrs[i]); Attribute pkAttr = pkTable.getAttribute(pkAttrId); if (pkAttr == null) { break; QuotedID fkAttrId = idfac.createAttributeID(fkAttrs[i]); Attribute fkAttr = fkTable.getAttribute(fkAttrId); if (fkAttr == null) {
if (expr instanceof Column) { Column column = (Column) expr; QuotedID id = idfac.createAttributeID(column.getColumnName()); Table table = column.getTable(); QualifiedAttributeID attr = (table == null || table.getName() == null) QuotedID name = (columnAlias == null || columnAlias.getName() == null) ? id : idfac.createAttributeID(columnAlias.getName()); throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", selectExpressionItem); QuotedID name = idfac.createAttributeID(columnAlias.getName());
String[] attrs = uc[1].split(","); for (String attr : attrs) { QuotedID attrId = idfac.createAttributeID(attr); Attribute attribute = td.getAttribute(attrId); if (attribute == null) {
if (expr instanceof Column) { Column column = (Column) expr; QuotedID id = idfac.createAttributeID(column.getColumnName()); Table table = column.getTable(); QualifiedAttributeID attr = (table == null || table.getName() == null) QuotedID name = (columnAlias == null || columnAlias.getName() == null) ? id : idfac.createAttributeID(columnAlias.getName()); throw new InvalidSelectQueryRuntimeException("Complex expression in SELECT must have an alias", selectExpressionItem); QuotedID name = idfac.createAttributeID(columnAlias.getName());
String[] attrs = uc[1].split(","); for (String attr : attrs) { QuotedID attrId = idfac.createAttributeID(attr); Attribute attribute = td.getAttribute(attrId); if (attribute == null) {
@Override public void visit(SelectExpressionItem selectExpressionItem) { Expression expr = selectExpressionItem.getExpression(); QuotedID name = getSelectItemAliasedId(selectExpressionItem); final Term var; if (expr instanceof Column) { Column column = (Column) expr; QuotedID columnId = idfac.createAttributeID(column.getColumnName()); Table table = column.getTable(); RelationID tableId = (table == null || table.getName() == null) ? null : idfac.createRelationID(table.getSchemaName(), table.getName()); QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId); var = attributes.get(attr); if (var == null) throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem); } else { // whether the complex expression has an alias already been checked var = createVariable(name); } map = ImmutableMap.of(new QualifiedAttributeID(null, name), var); } }
@Override public void visit(SelectExpressionItem selectExpressionItem) { Expression expr = selectExpressionItem.getExpression(); QuotedID name = getSelectItemAliasedId(selectExpressionItem); final Term var; if (expr instanceof Column) { Column column = (Column) expr; QuotedID columnId = idfac.createAttributeID(column.getColumnName()); Table table = column.getTable(); RelationID tableId = (table == null || table.getName() == null) ? null : idfac.createRelationID(table.getSchemaName(), table.getName()); QualifiedAttributeID attr = new QualifiedAttributeID(tableId, columnId); var = attributes.get(attr); if (var == null) throw new InvalidSelectQueryRuntimeException("Column not found", selectExpressionItem); } else { // whether the complex expression has an alias already been checked var = createVariable(name); } map = ImmutableMap.of(new QualifiedAttributeID(null, name), var); } }
return RAExpressionAttributes.joinUsing(left, right, join.getUsingColumns().stream() .map(c -> idfac.createAttributeID(c.getColumnName())) .collect(ImmutableCollectors.toSet()));
return RAExpressionAttributes.joinUsing(left, right, join.getUsingColumns().stream() .map(c -> idfac.createAttributeID(c.getColumnName())) .collect(ImmutableCollectors.toSet()));
return RAExpression.joinUsing(left, right, join.getUsingColumns().stream() .map(p -> idfac.createAttributeID(p.getColumnName())) .collect(ImmutableCollectors.toSet()), termFactory);
return RAExpression.joinUsing(left, right, join.getUsingColumns().stream() .map(p -> idfac.createAttributeID(p.getColumnName())) .collect(ImmutableCollectors.toSet()));