Skip to content

Commit

Permalink
[Feat] support Arrow (#2466)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 committed Mar 4, 2024
1 parent b9bf453 commit f10c84f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions DataViewer/DataSource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ bool IDataSource::IsWritable(GdaConst::DataSourceType ds_type)
ds_type == GdaConst::ds_mysql ||
ds_type == GdaConst::ds_oci ||
ds_type == GdaConst::ds_parquet ||
ds_type == GdaConst::ds_arrow ||
ds_type == GdaConst::ds_postgresql )
return true;
return false;
Expand Down Expand Up @@ -144,6 +145,8 @@ wxString IDataSource::GetDataTypeNameByExt(wxString ext)
ds_format = "ODS";
else if(ext.CmpNoCase("parquet")==0)
ds_format = "Parquet";
else if(ext.CmpNoCase("arrow")==0)
ds_format = "Arrow";

//else
// ds_format = "Unknown";
Expand Down Expand Up @@ -196,6 +199,7 @@ IDataSource* IDataSource::CreateDataSource(wxString data_type_name,
type == GdaConst::ds_xls ||
type == GdaConst::ds_xlsx ||
type == GdaConst::ds_parquet ||
type == GdaConst::ds_arrow ||
type == GdaConst::ds_geo_json )
{
// using <file>xxx</file> to create DataSource instance
Expand Down Expand Up @@ -254,6 +258,7 @@ IDataSource* IDataSource::CreateDataSource(wxString ds_json)
type == GdaConst::ds_xls ||
type == GdaConst::ds_xlsx ||
type == GdaConst::ds_parquet ||
type == GdaConst::ds_arrow ||
type == GdaConst::ds_geo_json )
{
json_spirit::Value json_ds_path;
Expand Down
1 change: 1 addition & 0 deletions DialogTools/DatasourceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ void DatasourceDlg::Init()
// create file type dataset pop-up menu dynamically
ds_names.Add("GeoParquet (*.parquet)|*.parquet");
ds_names.Add("ESRI Shapefile (*.shp)|*.shp");
ds_names.Add("GeoArrow (*.arrow)|*.arrow");
ds_names.Add("ESRI File Geodatabase (*.gdb)|*.gdb");
ds_names.Add("GeoJSON (*.geojson;*.json)|*.geojson;*.json");
ds_names.Add("GeoPackage (*.gpkg)|*.gpkg");
Expand Down
11 changes: 11 additions & 0 deletions GdaConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,17 @@ void GdaConst::init()
datasrc_field_illegal_regex[ds_dbf] = db_field_name_illegal_regex;
datasrc_field_casesensitive[ds_dbf] = false;

datasrc_str_to_type["Arrow"] = ds_arrow;
datasrc_type_to_prefix[ds_arrow] = "";
datasrc_type_to_fullname[ds_arrow] = "Arrow";
// share the same with DBF
datasrc_table_lens[ds_arrow] = 128;
datasrc_field_lens[ds_arrow] = 10;
datasrc_field_warning[ds_arrow] = default_field_warning;
datasrc_field_regex[ds_arrow] = db_field_name_regex;
datasrc_field_illegal_regex[ds_arrow] = db_field_name_illegal_regex;
datasrc_field_casesensitive[ds_arrow] = false;

datasrc_str_to_type["Parquet"] = ds_parquet;
datasrc_type_to_prefix[ds_parquet] = "";
datasrc_type_to_fullname[ds_parquet] = "Parquet";
Expand Down
2 changes: 1 addition & 1 deletion GdaConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class GdaConst {
ds_csv, ds_dbf, ds_geo_json, ds_gml, ds_kml,
ds_mapinfo, ds_mysql, ds_ms_sql, ds_oci, ds_odbc, ds_postgresql,
ds_shapefile, ds_sqlite, ds_gpkg, ds_wfs, ds_xls, ds_xlsx, ds_osm,
ds_ods, ds_cartodb, ds_parquet, ds_unknown };
ds_ods, ds_cartodb, ds_parquet, ds_arrow, ds_unknown };

static std::map<std::string, DataSourceType> datasrc_str_to_type;
static std::map<DataSourceType, std::string> datasrc_type_to_str;
Expand Down

0 comments on commit f10c84f

Please sign in to comment.