-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow getting a ParquetFileReader and the SchemaManifest from an Arro…
…w.FileReader (#430)
- Loading branch information
Showing
13 changed files
with
548 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <arrow/c/abi.h> | ||
#include <arrow/c/bridge.h> | ||
#include <parquet/arrow/schema.h> | ||
#include <parquet/exception.h> | ||
|
||
#include "cpp/ParquetSharpExport.h" | ||
#include "../ExceptionInfo.h" | ||
|
||
using namespace parquet::arrow; | ||
|
||
extern "C" | ||
{ | ||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaField_ChildrenLength(const SchemaField* field, int32_t* length) | ||
{ | ||
TRYCATCH(*length = static_cast<int32_t>(field->children.size());) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaField_Child(const SchemaField* field, int32_t index, const SchemaField** child) | ||
{ | ||
TRYCATCH( | ||
if (index >= static_cast<int32_t>(field->children.size())) | ||
{ | ||
throw std::out_of_range("Child field index out of range"); | ||
} | ||
*child = &(field->children[index]); | ||
) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaField_ColumnIndex(const SchemaField* field, int32_t* column_index) | ||
{ | ||
TRYCATCH( | ||
*column_index = field->column_index; | ||
) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaField_Field(const SchemaField* field, struct ArrowSchema* arrow_field) | ||
{ | ||
TRYCATCH( | ||
PARQUET_THROW_NOT_OK(arrow::ExportField(*(field->field), arrow_field)); | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include <parquet/arrow/schema.h> | ||
#include <parquet/exception.h> | ||
|
||
#include "cpp/ParquetSharpExport.h" | ||
#include "../ExceptionInfo.h" | ||
|
||
using namespace parquet::arrow; | ||
|
||
extern "C" | ||
{ | ||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaManifest_SchemaFieldsLength(const SchemaManifest* manifest, int32_t* length) | ||
{ | ||
TRYCATCH(*length = static_cast<int32_t>(manifest->schema_fields.size());) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaManifest_SchemaField(const SchemaManifest* manifest, int32_t index, const SchemaField** field) | ||
{ | ||
TRYCATCH( | ||
if (index >= static_cast<int32_t>(manifest->schema_fields.size())) | ||
{ | ||
throw std::out_of_range("Field index out of range"); | ||
} | ||
*field = &(manifest->schema_fields[index]); | ||
) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaManifest_GetColumnField(const SchemaManifest* manifest, int32_t column_index, const SchemaField** field) | ||
{ | ||
TRYCATCH( | ||
PARQUET_THROW_NOT_OK(manifest->GetColumnField(column_index, field)); | ||
) | ||
} | ||
|
||
PARQUETSHARP_EXPORT ExceptionInfo* SchemaManifest_GetParent(const SchemaManifest* manifest, const SchemaField* field, const SchemaField** parent) | ||
{ | ||
TRYCATCH(*parent = manifest->GetParent(field);) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.