Daniel Becker has uploaded this change for review. ( http://gerrit.cloudera.org:8080/19101
Change subject: IMPALA-11643: Implement ColumnType::ToIR() for non-scalar types ...................................................................... IMPALA-11643: Implement ColumnType::ToIR() for non-scalar types Currently ColumnType::ToIR() is only implemented for scalar types. The reason why structs are not supported is that information about the children is stored in std::vectors, which are difficult to deal with in LLVM code. As the layout of std::vector depends on the compiler and can change (and is also quite complicated), we shouldn't touch it from hand-crafted LLVM code directly, only through IR functions (functions compiled from C++ to LLVM). The solution chosen by this change is to add an IR function that takes a ColumnType* and the next element for each of the three vectors (the vectors have the same length), then inserts the elements into the vectors. We first construct the non-vector parts of ColumnType in LLVM as before, then call this function from hand-crafted LLVM code repeatedly to insert the necessary elements into the vectors. However, the resulting value is no longer an llvm::ConstantStruct*, which is the return type of ColumnType::ToIR(). Some callers depend on the result being a constant, so we can't change the return type in these cases. Therefore, instead of a single ColumnType::ToIR() function, we will have two functions: - ColumnType::ToIRConstant(): largely equivalent to the old ToIR() - returns an llvm::ConstantStruct* and is only valid for non-struct types - ColumnType::ToIR(): a general function that supports all types and returns llvm::Value*. Creating a function that supports all types and returns a constant is not possible without meddling with the internals of std::vector from LLVM code. Change-Id: If2db6d5c411596228b978129dd74fc3a6c0678bf --- M be/src/codegen/codegen-anyval.cc M be/src/codegen/gen_ir_descriptions.py M be/src/codegen/impala-ir.cc M be/src/codegen/llvm-codegen-test.cc A be/src/codegen/llvm-codegen-test.h M be/src/codegen/llvm-codegen.h M be/src/exec/filter-context.cc M be/src/exprs/hive-udf-call.cc M be/src/exprs/kudu-partition-expr.cc M be/src/runtime/CMakeLists.txt M be/src/runtime/krpc-data-stream-sender.cc A be/src/runtime/types-ir.cc M be/src/runtime/types.cc M be/src/runtime/types.h 14 files changed, 365 insertions(+), 108 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/01/19101/2 -- To view, visit http://gerrit.cloudera.org:8080/19101 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: If2db6d5c411596228b978129dd74fc3a6c0678bf Gerrit-Change-Number: 19101 Gerrit-PatchSet: 2 Gerrit-Owner: Daniel Becker <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]>
