You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by "Wang Hao (JIRA)" <ji...@apache.org> on 2019/05/10 11:19:00 UTC
[jira] [Updated] (CARBONDATA-3379) thrift file-format support
generate c++ code
[ https://issues.apache.org/jira/browse/CARBONDATA-3379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Wang Hao updated CARBONDATA-3379:
---------------------------------
Description:
Using thrift compiler to generate c++ code for file-format and complie with g++ .
like this,
{code}
thrift --gen cpp carbondata.thrift
g++ -O0 -g ./gen-cpp/carbondata_constants.cpp -c -I$THRIFT_INSTALL_PATH/include/ -I$BOOST_INSTALL_PATH/include/
{code}
It have 2 problem,
1. In the carbondata.thrift, *DataChunk3* depending on *LocalDictionaryChunk*, *LocalDictionaryChunk* depending on *LocalDictionaryChunkMeta*.
the order of these struct declaration
{code:java}
struct DataChunk3{
...
}
...
struct LocalDictionaryChunk {
...
}
struct LocalDictionaryChunkMeta{
...
}
{code}
when generate c++ code and compile, it make a 'has incomplete type' error
{code}
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:667:24: error: field 'local_dictionary' has incomplete type 'LocalDictionaryChunk'
LocalDictionaryChunk local_dictionary;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:84:7: note: forward declaration of 'class LocalDictionaryChunk'
class LocalDictionaryChunk;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:1245:28: error: field 'dictionary_meta' has incomplete type 'LocalDictionaryChunkMeta'
LocalDictionaryChunkMeta dictionary_meta;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:86:7: note: forward declaration of 'class LocalDictionaryChunkMeta'
class LocalDictionaryChunkMeta;
^
{code}
if adjust the order of there these struct declaration like below, the generate c++ code will compiled correctly
{code:java}
struct LocalDictionaryChunkMeta{
...
}
struct LocalDictionaryChunk {
...
}
struct DataChunk3{
...
}
{code}
2. In all thrift file-format, it only define java namespace
{code}
namespace java org.apache.carbondata.format
{code}
It better add a cpp namespace make the generate c++ code have cpp namespace
{code}
namespace java org.apache.carbondata.format
namespace cpp carbondata.format
{code}
was:
Using thrift compiler to generate c++ code for file-format and complie with g++ .
like this,
{code:sh}
thrift --gen cpp carbondata.thrift
g++ -O0 -g ./gen-cpp/carbondata_constants.cpp -c -I$THRIFT_INSTALL_PATH/include/ -I$BOOST_INSTALL_PATH/include/
{code}
It have 2 problem,
1. In the carbondata.thrift, *DataChunk3 depending on *LocalDictionaryChunk, *LocalDictionaryChunk depending on *LocalDictionaryChunkMeta.
the order of these struct declaration
{code:java}
struct DataChunk3{
...
}
...
struct LocalDictionaryChunk {
...
}
struct LocalDictionaryChunkMeta{
...
}
{code}
when generate c++ code and compile, it make a 'has incomplete type' error
{code:sh}
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:667:24: error: field 'local_dictionary' has incomplete type 'LocalDictionaryChunk'
LocalDictionaryChunk local_dictionary;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:84:7: note: forward declaration of 'class LocalDictionaryChunk'
class LocalDictionaryChunk;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:1245:28: error: field 'dictionary_meta' has incomplete type 'LocalDictionaryChunkMeta'
LocalDictionaryChunkMeta dictionary_meta;
^
In file included from ./gen-cpp/carbondata_constants.h:10:0,
from ./gen-cpp/carbondata_constants.cpp:7:
./gen-cpp/carbondata_types.h:86:7: note: forward declaration of 'class LocalDictionaryChunkMeta'
class LocalDictionaryChunkMeta;
^
{code}
if adjust the order of there these struct declaration like below, the generate c++ code will compiled correctly
{code:java}
struct LocalDictionaryChunkMeta{
...
}
struct LocalDictionaryChunk {
...
}
struct DataChunk3{
...
}
{code}
2. In all thrift file-format, it only define java namespace
{code:sh}
namespace java org.apache.carbondata.format
{code}
It better add a cpp namespace make the generate c++ code have cpp namespace
{code:sh}
namespace java org.apache.carbondata.format
namespace cpp carbondata.format
{code}
> thrift file-format support generate c++ code
> --------------------------------------------
>
> Key: CARBONDATA-3379
> URL: https://issues.apache.org/jira/browse/CARBONDATA-3379
> Project: CarbonData
> Issue Type: Improvement
> Components: file-format
> Environment: SUSE Linux Enterprise Server 11 (x86_64)
> gcc 5.4
> thrift 0.9.3
> Reporter: Wang Hao
> Priority: Major
>
> Using thrift compiler to generate c++ code for file-format and complie with g++ .
> like this,
> {code}
> thrift --gen cpp carbondata.thrift
> g++ -O0 -g ./gen-cpp/carbondata_constants.cpp -c -I$THRIFT_INSTALL_PATH/include/ -I$BOOST_INSTALL_PATH/include/
> {code}
> It have 2 problem,
> 1. In the carbondata.thrift, *DataChunk3* depending on *LocalDictionaryChunk*, *LocalDictionaryChunk* depending on *LocalDictionaryChunkMeta*.
> the order of these struct declaration
> {code:java}
> struct DataChunk3{
> ...
> }
> ...
> struct LocalDictionaryChunk {
> ...
> }
> struct LocalDictionaryChunkMeta{
> ...
> }
> {code}
> when generate c++ code and compile, it make a 'has incomplete type' error
> {code}
> In file included from ./gen-cpp/carbondata_constants.h:10:0,
> from ./gen-cpp/carbondata_constants.cpp:7:
> ./gen-cpp/carbondata_types.h:667:24: error: field 'local_dictionary' has incomplete type 'LocalDictionaryChunk'
> LocalDictionaryChunk local_dictionary;
> ^
> In file included from ./gen-cpp/carbondata_constants.h:10:0,
> from ./gen-cpp/carbondata_constants.cpp:7:
> ./gen-cpp/carbondata_types.h:84:7: note: forward declaration of 'class LocalDictionaryChunk'
> class LocalDictionaryChunk;
> ^
> In file included from ./gen-cpp/carbondata_constants.h:10:0,
> from ./gen-cpp/carbondata_constants.cpp:7:
> ./gen-cpp/carbondata_types.h:1245:28: error: field 'dictionary_meta' has incomplete type 'LocalDictionaryChunkMeta'
> LocalDictionaryChunkMeta dictionary_meta;
> ^
> In file included from ./gen-cpp/carbondata_constants.h:10:0,
> from ./gen-cpp/carbondata_constants.cpp:7:
> ./gen-cpp/carbondata_types.h:86:7: note: forward declaration of 'class LocalDictionaryChunkMeta'
> class LocalDictionaryChunkMeta;
> ^
> {code}
> if adjust the order of there these struct declaration like below, the generate c++ code will compiled correctly
> {code:java}
> struct LocalDictionaryChunkMeta{
> ...
> }
> struct LocalDictionaryChunk {
> ...
> }
> struct DataChunk3{
> ...
> }
> {code}
> 2. In all thrift file-format, it only define java namespace
> {code}
> namespace java org.apache.carbondata.format
> {code}
> It better add a cpp namespace make the generate c++ code have cpp namespace
> {code}
> namespace java org.apache.carbondata.format
> namespace cpp carbondata.format
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)