From 7593fde1bc2d4378e6d5c3709bcc4091d5690cb5 Mon Sep 17 00:00:00 2001 From: slinkydeveloper Date: Tue, 28 Sep 2021 10:59:11 +0200 Subject: [PATCH] [hotfix] Add a docs page with module specific guides for flink contributors Signed-off-by: slinkydeveloper --- .../docs/flinkDev/module_specific_guides.md | 57 +++++++++++++++++++ .../src/test/resources/log4j2-test.properties | 7 +++ 2 files changed, 64 insertions(+) create mode 100644 docs/content/docs/flinkDev/module_specific_guides.md diff --git a/docs/content/docs/flinkDev/module_specific_guides.md b/docs/content/docs/flinkDev/module_specific_guides.md new file mode 100644 index 0000000000000..9ddfaa7c4d100 --- /dev/null +++ b/docs/content/docs/flinkDev/module_specific_guides.md @@ -0,0 +1,57 @@ +--- +title: "Module specific guides" +weight: 22 +type: docs +aliases: +- /flinkDev/module_specific_guides.html +- /internals/module_specific_guides.html +--- + + +# Module specific guides + +This page includes a list of guides, tips and tricks for contributing to specific Flink modules. + +## Flink Table/SQL + +### Debug the planner + +When working on planner rules, It's useful to investigate which rules are applied, in which order and what transformation every rule generates. +In order to find out these details when running a planner test, you can enable the Calcite planner logging in debug mode adding the following lines to the log configuration in `flink-table/flink-table-planner/src/test/resources/log4j2-test.properties`: + +``` +loggers = testlogger +logger.testlogger.name = org.apache.calcite.plan +logger.testlogger.level = DEBUG +logger.testlogger.appenderRefs = TestLogger +``` + +This is a sample output: + +``` +[...] +3855 [main] DEBUG org.apache.calcite.plan.RelOptPlanner [] - call#1: Apply rule [FlinkJoinPushExpressionsRule] to [rel#40:LogicalJoin.NONE.any.None: 0.[NONE].[NONE](left=HepRelVertex#34,right=HepRelVertex#39,condition=AND(=($0, $5), >=($3, -($8, 3600000:INTERVAL HOUR)), <=($3, +($8, 3600000:INTERVAL HOUR))),joinType=inner)] +3855 [main] DEBUG org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary [] - Rule Attempts Info for HepPlanner +3856 [main] DEBUG org.apache.calcite.plan.AbstractRelOptPlanner.rule_execution_summary [] - +Rules Attempts Time (us) +FlinkJoinPushExpressionsRule 1 143 +* Total 1 143 +[...] +``` diff --git a/flink-table/flink-table-planner/src/test/resources/log4j2-test.properties b/flink-table/flink-table-planner/src/test/resources/log4j2-test.properties index 835c2ec9a3d02..d20d7ec392377 100644 --- a/flink-table/flink-table-planner/src/test/resources/log4j2-test.properties +++ b/flink-table/flink-table-planner/src/test/resources/log4j2-test.properties @@ -21,8 +21,15 @@ rootLogger.level = OFF rootLogger.appenderRef.test.ref = TestLogger +appenders = testlogger appender.testlogger.name = TestLogger appender.testlogger.type = CONSOLE appender.testlogger.target = SYSTEM_ERR appender.testlogger.layout.type = PatternLayout appender.testlogger.layout.pattern = %-4r [%t] %-5p %c %x - %m%n + +# Uncomment the following lines to debug the planning +#loggers = testlogger +#logger.testlogger.name = org.apache.calcite.plan +#logger.testlogger.level = DEBUG +#logger.testlogger.appenderRefs = TestLogger