duckdb 0.3.3-dev901.0 → 0.3.3-dev933.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7133,7 +7133,7 @@ public:
7133
7133
  throw std::runtime_error("Decode bit width too large");
7134
7134
  }
7135
7135
  byte_encoded_len = ((bit_width_ + 7) / 8);
7136
- max_val = (1 << bit_width_) - 1;
7136
+ max_val = (uint64_t(1) << bit_width_) - 1;
7137
7137
  }
7138
7138
 
7139
7139
  template <typename T>
@@ -7185,12 +7185,12 @@ private:
7185
7185
  ByteBuffer buffer_;
7186
7186
 
7187
7187
  /// Number of bits needed to encode the value. Must be between 0 and 64.
7188
- int bit_width_;
7188
+ uint32_t bit_width_;
7189
7189
  uint64_t current_value_;
7190
7190
  uint32_t repeat_count_;
7191
7191
  uint32_t literal_count_;
7192
7192
  uint8_t byte_encoded_len;
7193
- uint32_t max_val;
7193
+ uint64_t max_val;
7194
7194
 
7195
7195
  uint8_t bitpack_pos = 0;
7196
7196
 
@@ -7410,12 +7410,16 @@ public:
7410
7410
 
7411
7411
  virtual void Skip(idx_t num_values);
7412
7412
 
7413
- const LogicalType &Type();
7414
- const SchemaElement &Schema();
7413
+ ParquetReader &Reader();
7414
+ const LogicalType &Type() const;
7415
+ const SchemaElement &Schema() const;
7416
+ idx_t FileIdx() const;
7417
+ idx_t MaxDefine() const;
7418
+ idx_t MaxRepeat() const;
7415
7419
 
7416
7420
  virtual idx_t GroupRowsAvailable();
7417
7421
 
7418
- unique_ptr<BaseStatistics> Stats(const std::vector<ColumnChunk> &columns);
7422
+ virtual unique_ptr<BaseStatistics> Stats(const std::vector<ColumnChunk> &columns);
7419
7423
 
7420
7424
  protected:
7421
7425
  // readers that use the default Read() need to implement those
@@ -7574,10 +7578,17 @@ public:
7574
7578
  : ParquetReader(allocator, move(file_handle_p), vector<LogicalType>(), string()) {
7575
7579
  }
7576
7580
 
7577
- ParquetReader(ClientContext &context, string file_name, const vector<LogicalType> &expected_types_p,
7581
+ ParquetReader(ClientContext &context, string file_name, const vector<string> &names,
7582
+ const vector<LogicalType> &expected_types_p, const vector<column_t> &column_ids,
7578
7583
  ParquetOptions parquet_options, const string &initial_filename = string());
7579
7584
  ParquetReader(ClientContext &context, string file_name, ParquetOptions parquet_options)
7580
- : ParquetReader(context, move(file_name), vector<LogicalType>(), parquet_options, string()) {
7585
+ : ParquetReader(context, move(file_name), vector<string>(), vector<LogicalType>(), vector<column_t>(),
7586
+ parquet_options, string()) {
7587
+ }
7588
+ ParquetReader(ClientContext &context, string file_name, const vector<LogicalType> &expected_types_p,
7589
+ ParquetOptions parquet_options)
7590
+ : ParquetReader(context, move(file_name), vector<string>(), expected_types_p, vector<column_t>(),
7591
+ parquet_options, string()) {
7581
7592
  }
7582
7593
  ~ParquetReader();
7583
7594
 
@@ -7604,7 +7615,8 @@ public:
7604
7615
  static LogicalType DeriveLogicalType(const SchemaElement &s_ele, bool binary_as_string);
7605
7616
 
7606
7617
  private:
7607
- void InitializeSchema(const vector<LogicalType> &expected_types_p, const string &initial_filename_p);
7618
+ void InitializeSchema(const vector<string> &names, const vector<LogicalType> &expected_types_p,
7619
+ const vector<column_t> &column_ids, const string &initial_filename_p);
7608
7620
  bool ScanInternal(ParquetReaderScanState &state, DataChunk &output);
7609
7621
  unique_ptr<ColumnReader> CreateReader(const duckdb_parquet::format::FileMetaData *file_meta_data);
7610
7622
 
@@ -7623,6 +7635,12 @@ private:
7623
7635
 
7624
7636
  private:
7625
7637
  unique_ptr<FileHandle> file_handle;
7638
+ //! column-id map, used when reading multiple parquet files since separate parquet files might have columns at
7639
+ //! different positions e.g. the first file might have column "a" at position 0, the second at position 1, etc
7640
+ vector<column_t> column_id_map;
7641
+ //! Map of column_id -> cast, used when reading multiple parquet files when parquet files have diverging types
7642
+ //! for the same column
7643
+ unordered_map<column_t, LogicalType> cast_map;
7626
7644
  };
7627
7645
 
7628
7646
  } // namespace duckdb