private static SelectStatement prependTenantAndViewConstants(PTable table, SelectStatement select, String tenantId, Set<PColumn> addViewColumns, boolean useServerTimestamp) { if ((!table.isMultiTenant() || tenantId == null) && table.getViewIndexId() == null && addViewColumns.isEmpty() && !useServerTimestamp) { return select; } List<AliasedNode> selectNodes = newArrayListWithCapacity(select.getSelect().size() + 1 + addViewColumns.size()); if (table.getViewIndexId() != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(table.getViewIndexId()))); } if (table.isMultiTenant() && tenantId != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(tenantId))); } selectNodes.addAll(select.getSelect()); for (PColumn column : addViewColumns) { byte[] byteValue = column.getViewConstant(); Object value = column.getDataType().toObject(byteValue, 0, byteValue.length-1); selectNodes.add(new AliasedNode(null, new LiteralParseNode(value))); } if (useServerTimestamp) { PColumn rowTimestampCol = table.getPKColumns().get(table.getRowTimestampColPos()); selectNodes.add(new AliasedNode(null, getNodeForRowTimestampColumn(rowTimestampCol))); } return SelectStatement.create(select, selectNodes); }
HintNode hint = delete.getHint(); if (runOnServer && !delete.getHint().hasHint(Hint.USE_INDEX_OVER_DATA_TABLE)) { select = SelectStatement.create(select, HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE)); SelectStatement aggSelect = SelectStatement.create(SelectStatement.COUNT_ONE, delete.getHint()); RowProjector projectorToBe = ProjectionCompiler.compile(context, aggSelect, GroupBy.EMPTY_GROUP_BY); context.getAggregationManager().compile(context, GroupBy.EMPTY_GROUP_BY);
hint = HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE); select = SelectStatement.create(select, hint); .build(); SelectStatement select = SelectStatement.create(SelectStatement.COUNT_ONE, upsert.getHint()); StatementContext statementContext = queryPlan.getContext(); RowProjector aggProjectorToBe = ProjectionCompiler.compile(statementContext, select, GroupBy
private static SelectStatement prependTenantAndViewConstants(PTable table, SelectStatement select, String tenantId, Set<PColumn> addViewColumns, boolean useServerTimestamp) { if ((!table.isMultiTenant() || tenantId == null) && table.getViewIndexId() == null && addViewColumns.isEmpty() && !useServerTimestamp) { return select; } List<AliasedNode> selectNodes = newArrayListWithCapacity(select.getSelect().size() + 1 + addViewColumns.size()); if (table.getViewIndexId() != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(table.getViewIndexId()))); } if (table.isMultiTenant() && tenantId != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(tenantId))); } selectNodes.addAll(select.getSelect()); for (PColumn column : addViewColumns) { byte[] byteValue = column.getViewConstant(); Object value = column.getDataType().toObject(byteValue, 0, byteValue.length-1); selectNodes.add(new AliasedNode(null, new LiteralParseNode(value))); } if (useServerTimestamp) { PColumn rowTimestampCol = table.getPKColumns().get(table.getRowTimestampColPos()); selectNodes.add(new AliasedNode(null, getNodeForRowTimestampColumn(rowTimestampCol))); } return SelectStatement.create(select, selectNodes); }
private static SelectStatement prependTenantAndViewConstants(PTable table, SelectStatement select, String tenantId, Set<PColumn> addViewColumns, boolean useServerTimestamp) { if ((!table.isMultiTenant() || tenantId == null) && table.getViewIndexId() == null && addViewColumns.isEmpty() && !useServerTimestamp) { return select; } List<AliasedNode> selectNodes = newArrayListWithCapacity(select.getSelect().size() + 1 + addViewColumns.size()); if (table.getViewIndexId() != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(table.getViewIndexId()))); } if (table.isMultiTenant() && tenantId != null) { selectNodes.add(new AliasedNode(null, new LiteralParseNode(tenantId))); } selectNodes.addAll(select.getSelect()); for (PColumn column : addViewColumns) { byte[] byteValue = column.getViewConstant(); Object value = column.getDataType().toObject(byteValue, 0, byteValue.length-1); selectNodes.add(new AliasedNode(null, new LiteralParseNode(value))); } if (useServerTimestamp) { PColumn rowTimestampCol = table.getPKColumns().get(table.getRowTimestampColPos()); selectNodes.add(new AliasedNode(null, getNodeForRowTimestampColumn(rowTimestampCol))); } return SelectStatement.create(select, selectNodes); }
HintNode hint = delete.getHint(); if (runOnServer && !delete.getHint().hasHint(Hint.USE_INDEX_OVER_DATA_TABLE)) { select = SelectStatement.create(select, HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE)); SelectStatement aggSelect = SelectStatement.create(SelectStatement.COUNT_ONE, delete.getHint()); RowProjector projectorToBe = ProjectionCompiler.compile(context, aggSelect, GroupBy.EMPTY_GROUP_BY); context.getAggregationManager().compile(context, GroupBy.EMPTY_GROUP_BY);
HintNode hint = delete.getHint(); if (runOnServer && !delete.getHint().hasHint(Hint.USE_INDEX_OVER_DATA_TABLE)) { select = SelectStatement.create(select, HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE)); SelectStatement aggSelect = SelectStatement.create(SelectStatement.COUNT_ONE, delete.getHint()); RowProjector projectorToBe = ProjectionCompiler.compile(context, aggSelect, GroupBy.EMPTY_GROUP_BY); context.getAggregationManager().compile(context, GroupBy.EMPTY_GROUP_BY);
hint = HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE); select = SelectStatement.create(select, hint); SelectStatement select = SelectStatement.create(SelectStatement.COUNT_ONE, upsert.getHint()); StatementContext statementContext = queryPlan.getContext(); RowProjector aggProjectorToBe = ProjectionCompiler.compile(statementContext, select, GroupBy
hint = HintNode.create(hint, Hint.USE_DATA_OVER_INDEX_TABLE); select = SelectStatement.create(select, hint); .build(); SelectStatement select = SelectStatement.create(SelectStatement.COUNT_ONE, upsert.getHint()); StatementContext statementContext = queryPlan.getContext(); RowProjector aggProjectorToBe = ProjectionCompiler.compile(statementContext, select, GroupBy