@Override public FunctionLibrary getFunctionLibrary() { return actualMetadata.getFunctionLibrary(); }
@Override public FunctionLibrary getFunctionLibrary() { return actualMetadata.getFunctionLibrary(); }
@Override public FunctionLibrary getFunctionLibrary() { return actualMetadata.getFunctionLibrary(); }
private void initWrapper(QueryMetadataInterface acutalMetadata) { functionLibrary = acutalMetadata.getFunctionLibrary(); this.functions.addAll(Arrays.asList(this.functionLibrary.getUserFunctions())); metadata = new BasicQueryMetadataWrapper(acutalMetadata) { @Override public FunctionLibrary getFunctionLibrary() { return functionLibrary; } }; }
static void combineLimits(PlanNode limitNode, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, Expression childLimit, Expression childOffset) { Expression minLimit = null; Expression offSet = null; if (childLimit == null) { minLimit = parentLimit; offSet = op(SourceSystemFunctions.ADD_OP, childOffset, parentOffset, metadata.getFunctionLibrary()); } else { minLimit = getMinValue(parentLimit, op(SourceSystemFunctions.SUBTRACT_OP, childLimit, parentOffset, metadata.getFunctionLibrary())); offSet = childOffset; if (offSet == null) { offSet = parentOffset; } } limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit); limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet); }
static void combineLimits(PlanNode limitNode, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, Expression childLimit, Expression childOffset) { Expression minLimit = null; Expression offSet = null; if (childLimit == null) { minLimit = parentLimit; offSet = op(SourceSystemFunctions.ADD_OP, childOffset, parentOffset, metadata.getFunctionLibrary()); } else { minLimit = getMinValue(parentLimit, op(SourceSystemFunctions.SUBTRACT_OP, childLimit, parentOffset, metadata.getFunctionLibrary())); offSet = childOffset; if (offSet == null) { offSet = parentOffset; } } limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit); limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet); }
static void combineLimits(PlanNode limitNode, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, Expression childLimit, Expression childOffset) { Expression minLimit = null; Expression offSet = null; if (childLimit == null) { minLimit = parentLimit; offSet = op(SourceSystemFunctions.ADD_OP, childOffset, parentOffset, metadata.getFunctionLibrary()); } else { minLimit = getMinValue(parentLimit, op(SourceSystemFunctions.SUBTRACT_OP, childLimit, parentOffset, metadata.getFunctionLibrary())); offSet = childOffset; if (offSet == null) { offSet = parentOffset; } } limitNode.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, minLimit); limitNode.setProperty(NodeConstants.Info.OFFSET_TUPLE_COUNT, offSet); }
public void visit(Function obj) { try { resolveFunction(obj, this.metadata.getFunctionLibrary()); if (obj.isAggregate()) { hasUserDefinedAggregate = true; } } catch(QueryResolverException e) { if (QueryPlugin.Event.TEIID30069.name().equals(e.getCode()) || QueryPlugin.Event.TEIID30067.name().equals(e.getCode())) { if (unresolvedFunctions == null) { unresolvedFunctions = new LinkedHashMap<Function, QueryResolverException>(); } unresolvedFunctions.put(obj, e); } else { handleException(e); } } catch(TeiidComponentException e) { handleException(e); } }
public void visit(Function obj) { try { resolveFunction(obj, this.metadata.getFunctionLibrary()); if (obj.isAggregate()) { hasUserDefinedAggregate = true; } } catch(QueryResolverException e) { if (QueryPlugin.Event.TEIID30069.name().equals(e.getCode()) || QueryPlugin.Event.TEIID30067.name().equals(e.getCode())) { if (unresolvedFunctions == null) { unresolvedFunctions = new LinkedHashMap<Function, QueryResolverException>(); } unresolvedFunctions.put(obj, e); } else { handleException(e); } } catch(TeiidComponentException e) { handleException(e); } }
public void visit(Function obj) { try { resolveFunction(obj, this.metadata.getFunctionLibrary()); if (obj.isAggregate()) { hasUserDefinedAggregate = true; } } catch(QueryResolverException e) { if (QueryPlugin.Event.TEIID30069.name().equals(e.getCode()) || QueryPlugin.Event.TEIID30067.name().equals(e.getCode())) { if (unresolvedFunctions == null) { unresolvedFunctions = new LinkedHashMap<Function, QueryResolverException>(); } unresolvedFunctions.put(obj, e); } else { handleException(e); } } catch(TeiidComponentException e) { handleException(e); } }
return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary()); return result; return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary());
return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary()); return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary());
return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary()); return getConversion(sourceExpression, sourceTypeName, targetTypeName, true, metadata.getFunctionLibrary());
private void addBranchLimit(PlanNode limitNode, List<PlanNode> limitNodes, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, PlanNode grandChild) { PlanNode newLimit = newLimit(limitNode); newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, parentLimit, parentOffset, metadata.getFunctionLibrary())); grandChild.addAsParent(newLimit); newLimit.setProperty(NodeConstants.Info.OUTPUT_COLS, newLimit.getFirstChild().getProperty(NodeConstants.Info.OUTPUT_COLS)); if (NodeEditor.findParent(newLimit, NodeConstants.Types.ACCESS) == null) { limitNodes.add(newLimit); } if (grandChild.getType() == NodeConstants.Types.SET_OP) { newLimit.setProperty(Info.IS_COPIED, true); } newLimit.setProperty(Info.IS_PUSHED, true); }
private void addBranchLimit(PlanNode limitNode, List<PlanNode> limitNodes, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, PlanNode grandChild) { PlanNode newLimit = newLimit(limitNode); newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, parentLimit, parentOffset, metadata.getFunctionLibrary())); grandChild.addAsParent(newLimit); newLimit.setProperty(NodeConstants.Info.OUTPUT_COLS, newLimit.getFirstChild().getProperty(NodeConstants.Info.OUTPUT_COLS)); if (NodeEditor.findParent(newLimit, NodeConstants.Types.ACCESS) == null) { limitNodes.add(newLimit); } if (grandChild.getType() == NodeConstants.Types.SET_OP) { newLimit.setProperty(Info.IS_COPIED, true); } newLimit.setProperty(Info.IS_PUSHED, true); }
private void addBranchLimit(PlanNode limitNode, List<PlanNode> limitNodes, QueryMetadataInterface metadata, Expression parentLimit, Expression parentOffset, PlanNode grandChild) { PlanNode newLimit = newLimit(limitNode); newLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, parentLimit, parentOffset, metadata.getFunctionLibrary())); grandChild.addAsParent(newLimit); newLimit.setProperty(NodeConstants.Info.OUTPUT_COLS, newLimit.getFirstChild().getProperty(NodeConstants.Info.OUTPUT_COLS)); if (NodeEditor.findParent(newLimit, NodeConstants.Types.ACCESS) == null) { limitNodes.add(newLimit); } if (grandChild.getType() == NodeConstants.Types.SET_OP) { newLimit.setProperty(Info.IS_COPIED, true); } newLimit.setProperty(Info.IS_PUSHED, true); }
private void modifyToCheckMatViewStatus(QueryMetadataInterface metadata, QueryCommand queryCommand, Set<Object> ids) throws QueryMetadataException, TeiidComponentException { for (Object viewMatadataId : ids) { String schemaName = metadata.getName(metadata.getModelID(viewMatadataId)); String viewName = metadata.getName(viewMatadataId); Expression expr1 = new Constant(schemaName); Expression expr2 = new Constant(viewName); Function status = new Function("mvstatus", new Expression[] {expr1, expr2}); //$NON-NLS-1$ status.setType(DataTypeManager.DefaultDataClasses.INTEGER); FunctionDescriptor descriptor = metadata.getFunctionLibrary().findFunction("mvstatus", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$ status.setFunctionDescriptor(descriptor); Query query = queryCommand.getProjectedQuery(); //insert first so that it gets evaluated ahead of any false predicate query.setCriteria(Criteria.combineCriteria(new CompareCriteria(status, CompareCriteria.EQ, new Constant(1)), query.getCriteria())); } }
private void modifyToCheckMatViewStatus(QueryMetadataInterface metadata, QueryCommand queryCommand, Set<Object> ids) throws QueryMetadataException, TeiidComponentException { for (Object viewMatadataId : ids) { String schemaName = metadata.getName(metadata.getModelID(viewMatadataId)); String viewName = metadata.getName(viewMatadataId); Expression expr1 = new Constant(schemaName); Expression expr2 = new Constant(viewName); Function status = new Function("mvstatus", new Expression[] {expr1, expr2}); //$NON-NLS-1$ status.setType(DataTypeManager.DefaultDataClasses.INTEGER); FunctionDescriptor descriptor = metadata.getFunctionLibrary().findFunction("mvstatus", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$ status.setFunctionDescriptor(descriptor); Query query = queryCommand.getProjectedQuery(); //insert first so that it gets evaluated ahead of any false predicate query.setCriteria(Criteria.combineCriteria(new CompareCriteria(status, CompareCriteria.EQ, new Constant(1)), query.getCriteria())); } }
private void modifyToCheckMatViewStatus(QueryMetadataInterface metadata, QueryCommand queryCommand, Set<Object> ids) throws QueryMetadataException, TeiidComponentException { for (Object viewMatadataId : ids) { String schemaName = metadata.getName(metadata.getModelID(viewMatadataId)); String viewName = metadata.getName(viewMatadataId); Expression expr1 = new Constant(schemaName); Expression expr2 = new Constant(viewName); Function status = new Function("mvstatus", new Expression[] {expr1, expr2}); //$NON-NLS-1$ status.setType(DataTypeManager.DefaultDataClasses.INTEGER); FunctionDescriptor descriptor = metadata.getFunctionLibrary().findFunction("mvstatus", new Class[] { DataTypeManager.DefaultDataClasses.STRING, DataTypeManager.DefaultDataClasses.STRING }); //$NON-NLS-1$ status.setFunctionDescriptor(descriptor); Query query = queryCommand.getProjectedQuery(); //insert first so that it gets evaluated ahead of any false predicate query.setCriteria(Criteria.combineCriteria(new CompareCriteria(status, CompareCriteria.EQ, new Constant(1)), query.getCriteria())); } }
pushedLimit.setProperty(NodeConstants.Info.MAX_TUPLE_LIMIT, op(SourceSystemFunctions.ADD_OP, limit, offset, metadata.getFunctionLibrary()));