houqp opened a new issue #594: URL: https://github.com/apache/arrow-datafusion/issues/594
**Is your feature request related to a problem or challenge? Please describe what you are trying to do.** Our invariants are formally documented in https://github.com/apache/arrow-datafusion/blob/master/docs/specification/invariants.md, but it's not being fully enforced across the board. During the implementation of https://github.com/apache/arrow-datafusion/pull/55, I have found couple bugs in our existing code base that could have been prevented if check for invariants more aggressively during development and in CI. **Describe the solution you'd like** One thing we could do is to insert conditional compilation asserts for invariants in places that could break the invariants. For example: * add assert to compare logical plan schema before and after each optimizer run * add assert to compare fields between logical plan and physical plan after physical planing These asserts should be turned of in production builds. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org