Skip to content

Complex Type Read Schema and Data #425

Answered by adamreeve
Mydurian asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can access the Parquet schema with something like:

using var fileReader = new ParquetFileReader(path);
using var metadata = fileReader.FileMetaData;
using var schemaNode = (GroupNode) metadata.Schema.SchemaRoot;

schemaNode is a ParquetSharp.Schema.GroupNode and has a Fields property containing a node for each top-level column of the schema. Fields can be a PrimitiveNode or a GroupNode with their own subfields for more complex types like lists, maps and structs. The LogicalType property of a node will tell you if it represents a List or Map.

Alternatively, if you're working with the Arrow API you can also get the schema in Arrow format with:

using var fileReader = new ParquetSharp.A…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@Mydurian
Comment options

@adamreeve
Comment options

Answer selected by Mydurian
@Mydurian
Comment options

@adamreeve
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants