Skip to content

Commit 71bf6e6

Browse files
committed
PARQUET-468: Use thirdparty Thrift compiler to compile parquet.thrift at make time
This also adds a `#define` working around the googletest incompatibility described in PARQUET-470. Author: Wes McKinney <[email protected]> Closes apache#55 from wesm/PARQUET-468 and squashes the following commits: e0338df [Wes McKinney] Auto-generate Thrift C++ bindings from environment Thrift compiler. Add #define workaround for Thrift >= 0.9.2 std::tuple conflict with googletest
1 parent 97edf9a commit 71bf6e6

File tree

9 files changed

+584
-3451
lines changed

9 files changed

+584
-3451
lines changed

cpp/src/parquet/column/column-reader-test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
#include <gtest/gtest.h>
19+
1820
#include <algorithm>
1921
#include <cstdint>
2022
#include <cstdlib>
2123
#include <memory>
2224
#include <string>
2325
#include <vector>
2426

25-
#include <gtest/gtest.h>
26-
2727
#include "parquet/types.h"
2828
#include "parquet/column/page.h"
2929
#include "parquet/column/reader.h"

cpp/src/parquet/schema/schema-converter-test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18+
#include <gtest/gtest.h>
19+
1820
#include <cstdlib>
1921
#include <memory>
2022
#include <string>
2123
#include <vector>
2224

23-
#include <gtest/gtest.h>
24-
2525
#include "parquet/exception.h"
2626
#include "parquet/schema/converter.h"
2727
#include "parquet/schema/test-util.h"

cpp/src/parquet/thrift/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
parquet_constants.*
2+
parquet_types.*

cpp/src/parquet/thrift/CMakeLists.txt

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,34 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
add_library(parquet_thrift STATIC
18+
set(THRIFT_SRCS
1919
parquet_constants.cpp
20-
parquet_types.cpp
20+
parquet_types.cpp)
21+
22+
add_library(parquet_thrift STATIC
23+
${THRIFT_SRCS}
2124
)
25+
2226
set_target_properties(parquet_thrift
2327
PROPERTIES
2428
LIBRARY_OUTPUT_DIRECTORY "${BUILD_OUTPUT_ROOT_DIRECTORY}")
29+
set_source_files_properties(${THRIFT_SRCS} PROPERTIES GENERATED TRUE)
30+
31+
# List of thrift output targets
32+
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/src/parquet/thrift)
33+
set(THRIFT_OUTPUT_FILES "${OUTPUT_DIR}/parquet_types.cpp")
34+
set(THRIFT_OUTPUT_FILES ${THRIFT_OUTPUT_FILES} "${OUTPUT_DIR}/parquet_types.h")
35+
set(THRIFT_OUTPUT_FILES ${THRIFT_OUTPUT_FILES} "${OUTPUT_DIR}/parquet_constants.cpp")
36+
set(THRIFT_OUTPUT_FILES ${THRIFT_OUTPUT_FILES} "${OUTPUT_DIR}/parquet_constants.h")
2537

38+
get_filename_component(ABS_PARQUET_THRIFT parquet.thrift ABSOLUTE)
2639

27-
# Headers: thrift
28-
install(FILES
29-
parquet_types.h
30-
parquet_constants.h
31-
util.h
32-
DESTINATION include/parquet/thrift)
40+
add_custom_command(
41+
OUTPUT ${THRIFT_OUTPUT_FILES}
42+
COMMAND ${THRIFT_COMPILER} --gen cpp -out ${OUTPUT_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/parquet.thrift
43+
DEPENDS ${ABS_PARQUET_THRIFT}
44+
COMMENT "Running thrift compiler on parquet.thrift"
45+
VERBATIM
46+
)
3347

3448
ADD_PARQUET_TEST(serializer-test)

0 commit comments

Comments
 (0)