Question about hoist_literals_



There is a member variable hoist_literals_ in structure CompilationOptions( mapd-core/QueryEngine/CompilationOptions.h:26 ). It seems to be used several times during code generation. Could someone tell me what’s it for?



Hi Mike,
Thanks for your interest in MapD. Literal hoisting is to hoist and store all constants used in query in input buffer to make query code as a template so e.g. every time you send a filter w/ different constant range, cached template code could be reused esp. good for saving heavy target lowering. For now we are not actively maintaining codegen w/ disabling it.


@mimc is right. For example, we want to generate the same code for SELECT COUNT(*) FROM foo WHERE c = 7 and SELECT COUNT(*) FROM foo WHERE c = 8 and save the compilation time. The right-hand side constant in the filter is read from a buffer instead of being in-lined in the generated code. The option to disable the hoisting and actually generate the values in-line is working, but it’s only exposed for ExecuteTest, not for the server (it’s --disable-literal-hoisting). The compilation time is very important for the queries generated by the UI, which happens at a very quick rate.


Thanks a lot. Your answers are helpful.