public ObjectExecution( Select query, @SuppressWarnings("unused") RuntimeMetadata metadata, ObjectExecutionFactory factory, ObjectConnection connection, ExecutionContext executionContext) throws TranslatorException { this.factory = factory; this.query = query; this.connection = connection; this.executionContext = executionContext; projects = new ArrayList<CompiledScript>(query.getDerivedColumns().size()); for (DerivedColumn dc : query.getDerivedColumns()) { ColumnReference cr = (ColumnReference) dc.getExpression(); String name = null; if (cr.getMetadataObject() != null) { Column c = cr.getMetadataObject(); name = getNameInSource(c); } else { name = cr.getName(); } if (name.equalsIgnoreCase("this")) { // $NON-NLS-1$ projects.add(null); } else { try { projects.add(scriptEngine.compile(OBJECT_NAME + "." + name)); // $NON-NLS-1$ } catch (ScriptException e) { throw new TranslatorException(e); } } } }
@Override public void visit(DerivedColumn obj) { if (obj.getExpression() instanceof Function) { visitNode(obj.getExpression()); } else { ColumnReference column = (ColumnReference) obj.getExpression(); this.selectedColumns.add(column.getMetadataObject().getName()); } }
@Override public void visit(ColumnReference obj) { this.onGoingExpression.push(obj.getMetadataObject()); }