11
11
#include <string>
12
12
#include <vector>
13
13
14
- #include <parquet/column/writer .h>
14
+ #include <parquet/column_writer .h>
15
15
#include <parquet/file/writer.h>
16
16
#include <parquet/types.h>
17
- #include <parquet/util/output .h>
17
+ #include <arrow/io/file .h>
18
18
19
19
extern "C"
20
20
{
@@ -31,6 +31,7 @@ int luaopen_parquet(lua_State *lua);
31
31
#endif
32
32
33
33
using namespace std ;
34
+ using FileClass = arrow ::io ::FileOutputStream ;
34
35
35
36
namespace pq = parquet ;
36
37
@@ -784,7 +785,8 @@ static int pq_new_writer(lua_State *lua)
784
785
pw -> w -> num_records = 0 ;
785
786
add_columns (pw -> w , pw -> w -> node );
786
787
787
- shared_ptr < pq ::LocalFileOutputStream > sink (new pq ::LocalFileOutputStream (name ));
788
+ shared_ptr < FileClass > sink ;
789
+ PARQUET_THROW_NOT_OK (FileClass ::Open (name , & sink ));
788
790
if (t == LUA_TTABLE ) {
789
791
pw -> w -> writer = pq ::ParquetFileWriter ::Open (sink , static_pointer_cast < pq ::schema ::GroupNode > (ud -> n -> node ),
790
792
setup_properties (lua ));
@@ -1455,7 +1457,7 @@ static void dissect_field(pq_writer *pw, lua_State *lua, pq_node *n, int16_t r,
1455
1457
if (n -> node -> is_group ()) {
1456
1458
if (n -> node -> is_repeated () && lua_objlen (lua , -1 ) > 0 ) { // array of groups
1457
1459
size_t ol = lua_objlen (lua , -1 );
1458
- for (int j = 1 ; j <= static_cast < int > ( ol ) ; ++ j ) {
1460
+ for (size_t j = 1 ; j <= ol ; ++ j ) {
1459
1461
lua_rawgeti (lua , -1 , j );
1460
1462
if (lua_type (lua , -1 ) != LUA_TTABLE ) {
1461
1463
stringstream ss ;
@@ -1488,7 +1490,7 @@ static void dissect_field(pq_writer *pw, lua_State *lua, pq_node *n, int16_t r,
1488
1490
if (ol == 0 ) {
1489
1491
add_null (c , r , d );
1490
1492
} else {
1491
- for (int j = 1 ; j <= static_cast < int > ( ol ) ; ++ j ) {
1493
+ for (size_t j = 1 ; j <= ol ; ++ j ) {
1492
1494
lua_rawgeti (lua , -1 , j );
1493
1495
add_value (lua , n , c , r , n -> dl );
1494
1496
lua_pop (lua , 1 );
@@ -1563,7 +1565,7 @@ static void dissect_list(pq_writer *pw, lua_State *lua, pq_node *n, int16_t r, i
1563
1565
static void dissect_tuple (pq_writer * pw , lua_State * lua , pq_node * n , int16_t r , int16_t d )
1564
1566
{
1565
1567
size_t len = n -> group -> fields .size ();
1566
- for (int i = 0 ; i < static_cast < int > ( len ) ; ++ i ) {
1568
+ for (size_t i = 0 ; i < len ; ++ i ) {
1567
1569
pq_node * cn = n -> group -> fields [i ];
1568
1570
lua_checkstack (lua , 2 );
1569
1571
lua_rawgeti (lua , -1 , i + 1 );
0 commit comments