@Override protected RelationPlan visitQuery(Query node, Void context) { Optional<Double> approximationConfidence = node.getApproximate().map(Approximate::getConfidence).map(confidence -> Double.valueOf(confidence) / 100.0); PlanBuilder subPlan = new QueryPlanner(analysis, symbolAllocator, idAllocator, metadata, session, approximationConfidence).process(node, null); ImmutableList.Builder<Symbol> outputSymbols = ImmutableList.builder(); for (FieldOrExpression fieldOrExpression : analysis.getOutputExpressions(node)) { outputSymbols.add(subPlan.translate(fieldOrExpression)); } return new RelationPlan(subPlan.getRoot(), analysis.getOutputDescriptor(node), outputSymbols.build(), subPlan.getSampleWeight()); }
if (node.getApproximate().isPresent()) { String confidence = node.getApproximate().get().getConfidence(); append(indent, "APPROXIMATE AT " + confidence + " CONFIDENCE") .append('\n');
if (node.getApproximate().isPresent()) { String confidence = node.getApproximate().get().getConfidence(); append(indent, "APPROXIMATE AT " + confidence + " CONFIDENCE") .append('\n');
@Override public Node visitQuery(SqlBaseParser.QueryContext context) { Query body = (Query) visit(context.queryNoWith()); return new Query( getLocation(context), visitIfPresent(context.with(), With.class), body.getQueryBody(), body.getOrderBy(), body.getLimit(), body.getApproximate()); }
@Override protected RelationType visitQuery(Query node, AnalysisContext parentContext) { AnalysisContext context = new AnalysisContext(parentContext); if (node.getApproximate().isPresent()) { if (!experimentalSyntaxEnabled) { throw new SemanticException(NOT_SUPPORTED, node, "approximate queries are not enabled"); } context.setApproximate(true); } analyzeWith(node, context); RelationType descriptor = process(node.getQueryBody(), context); analyzeOrderBy(node, descriptor, context); // Input fields == Output fields analysis.setOutputDescriptor(node, descriptor); analysis.setOutputExpressions(node, descriptorToFields(descriptor)); analysis.setStatement(node); return descriptor; }