Analyzer extends AbstractNodeVisitor<LogicalPlan, AnalysisContext> { public LogicalPlan analyze(UnresolvedPlan unresolved, AnalysisContext context) { return unresolved.accept(this, context); } Analyzer(
      ExpressionAnalyzer expressionAnalyzer,
      StorageEngine storageEngine); LogicalPlan analyze(UnresolvedPlan unresolved, AnalysisContext context); @Override LogicalPlan visitRelation(Relation node, AnalysisContext context); @Override LogicalPlan visitFilter(Filter node, AnalysisContext context); @Override LogicalPlan visitRename(Rename node, AnalysisContext context); @Override LogicalPlan visitAggregation(Aggregation node, AnalysisContext context); @Override LogicalPlan visitRareTopN(RareTopN node, AnalysisContext context); @Override LogicalPlan visitProject(Project node, AnalysisContext context); @Override LogicalPlan visitEval(Eval node, AnalysisContext context); @Override LogicalPlan visitSort(Sort node, AnalysisContext context); @Override LogicalPlan visitDedupe(Dedupe node, AnalysisContext context); @Override LogicalPlan visitValues(Values node, AnalysisContext context);  }
@Test public void rename_to_invalid_expression() { SemanticCheckException exception = assertThrows( SemanticCheckException.class, () -> analyze( AstDSL.rename( AstDSL.agg( AstDSL.relation("schema"), AstDSL.exprList( AstDSL.alias("avg(integer_value)", AstDSL.aggregate("avg", field( "integer_value")))), Collections.emptyList(), ImmutableList.of(), AstDSL.defaultStatsArgs()), AstDSL.map( AstDSL.aggregate("avg", field("integer_value")), AstDSL.aggregate("avg", field("integer_value")))))); assertEquals( "the target expected to be field, but is avg(Field(field=integer_value, fieldArgs=[]))", exception.getMessage()); }
@Disabled("the project/remove command should shrink the type env") @Test public void project_source_change_type_env() { SemanticCheckException exception = assertThrows( SemanticCheckException.class, () -> analyze( AstDSL.projectWithArg( AstDSL.projectWithArg( AstDSL.relation("schema"), AstDSL.defaultFieldsArgs(), AstDSL.field("integer_value"), AstDSL.field("double_value")), AstDSL.defaultFieldsArgs(), AstDSL.field("float_value")))); }