Skip to content

Commit 40003fc

Browse files
authored
Feature: support open parquet file (#2456)
1 parent 8b043c8 commit 40003fc

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

DataViewer/DataSource.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ bool IDataSource::IsWritable(GdaConst::DataSourceType ds_type)
5050
ds_type == GdaConst::ds_gpkg ||
5151
ds_type == GdaConst::ds_mysql ||
5252
ds_type == GdaConst::ds_oci ||
53+
ds_type == GdaConst::ds_parquet ||
5354
ds_type == GdaConst::ds_postgresql )
5455
return true;
5556
return false;
@@ -141,6 +142,8 @@ wxString IDataSource::GetDataTypeNameByExt(wxString ext)
141142
ds_format = "Idrisi";
142143
else if(ext.CmpNoCase("ods")==0)
143144
ds_format = "ODS";
145+
else if(ext.CmpNoCase("parquet")==0)
146+
ds_format = "Parquet";
144147

145148
//else
146149
// ds_format = "Unknown";
@@ -192,6 +195,7 @@ IDataSource* IDataSource::CreateDataSource(wxString data_type_name,
192195
type == GdaConst::ds_gpkg ||
193196
type == GdaConst::ds_xls ||
194197
type == GdaConst::ds_xlsx ||
198+
type == GdaConst::ds_parquet ||
195199
type == GdaConst::ds_geo_json )
196200
{
197201
// using <file>xxx</file> to create DataSource instance
@@ -249,6 +253,7 @@ IDataSource* IDataSource::CreateDataSource(wxString ds_json)
249253
type == GdaConst::ds_gpkg ||
250254
type == GdaConst::ds_xls ||
251255
type == GdaConst::ds_xlsx ||
256+
type == GdaConst::ds_parquet ||
252257
type == GdaConst::ds_geo_json )
253258
{
254259
json_spirit::Value json_ds_path;

DialogTools/DatasourceDlg.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ void DatasourceDlg::Init()
5252
ds_file_path = wxFileName("");
5353

5454
// create file type dataset pop-up menu dynamically
55+
ds_names.Add("GeoParquet (*.parquet)|*.parquet");
5556
ds_names.Add("ESRI Shapefile (*.shp)|*.shp");
5657
ds_names.Add("ESRI File Geodatabase (*.gdb)|*.gdb");
5758
ds_names.Add("GeoJSON (*.geojson;*.json)|*.geojson;*.json");

GdaConst.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,17 @@ void GdaConst::init()
773773
datasrc_field_illegal_regex[ds_dbf] = db_field_name_illegal_regex;
774774
datasrc_field_casesensitive[ds_dbf] = false;
775775

776+
datasrc_str_to_type["Parquet"] = ds_parquet;
777+
datasrc_type_to_prefix[ds_parquet] = "";
778+
datasrc_type_to_fullname[ds_parquet] = "Parquet";
779+
// share the same with DBF
780+
datasrc_table_lens[ds_parquet] = 128;
781+
datasrc_field_lens[ds_parquet] = 10;
782+
datasrc_field_warning[ds_parquet] = default_field_warning;
783+
datasrc_field_regex[ds_parquet] = db_field_name_regex;
784+
datasrc_field_illegal_regex[ds_parquet] = db_field_name_illegal_regex;
785+
datasrc_field_casesensitive[ds_parquet] = false;
786+
776787
datasrc_str_to_type["ESRI Shapefile"] = ds_shapefile;
777788
datasrc_type_to_prefix[ds_shapefile] = "";
778789
datasrc_type_to_fullname[ds_shapefile] = "ESRI Shapefile";

GdaConst.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class GdaConst {
7373
ds_esri_personal_gdb, ds_esri_arc_sde,
7474
ds_csv, ds_dbf, ds_geo_json, ds_gml, ds_kml,
7575
ds_mapinfo, ds_mysql, ds_ms_sql, ds_oci, ds_odbc, ds_postgresql,
76-
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm, ds_ods, ds_cartodb, ds_unknown };
76+
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm,
77+
ds_ods, ds_cartodb, ds_parquet, ds_unknown };
7778

7879
static std::map<std::string, DataSourceType> datasrc_str_to_type;
7980
static std::map<DataSourceType, std::string> datasrc_type_to_str;

0 commit comments

Comments
 (0)