ClifHouck commented on code in PR #40957:
URL: https://github.com/apache/arrow/pull/40957#discussion_r1578248707


##########
cpp/src/parquet/encoding.cc:
##########
@@ -3988,4 +3988,56 @@ std::unique_ptr<Decoder> MakeDictDecoder(Type::type 
type_num,
 }
 
 }  // namespace detail
+   //
+   //
+bool IsParquetVersionAtLeast2_0(ParquetVersion::type parquet_version) {
+  switch (parquet_version) {
+    case ParquetVersion::PARQUET_1_0:
+      return false;
+    case ParquetVersion::PARQUET_2_4:
+      return true;
+    case ParquetVersion::PARQUET_2_6:
+      return true;
+    default:
+      return parquet_version > ParquetVersion::PARQUET_1_0;
+  }
+  return false;
+}
+
+// Informed heavily by 
https://github.com/apache/parquet-format/blob/master/Encodings.md
+// and
+// 
https://github.com/apache/arrow-rs/blob/a15adf66a8212fdb3a0222a32130ce70cfc28cf5/parquet/src/column/writer/mod.rs#L1183
+Encoding::type ChooseNonDictEncoding(Type::type data_type,
+                                     ParquetVersion::type parquet_version,
+                                     ParquetDataPageVersion datapage_version) {
+  switch (data_type) {
+    case Type::BOOLEAN:
+      if (IsParquetVersionAtLeast2_0(parquet_version) &&
+          datapage_version == ParquetDataPageVersion::V2) {
+        return Encoding::RLE;
+      }
+      break;
+
+    case Type::INT32:
+    case Type::INT64:
+      if (IsParquetVersionAtLeast2_0(parquet_version)) {
+        return Encoding::DELTA_BINARY_PACKED;
+      }
+      break;
+
+    case Type::INT96:
+    case Type::FLOAT:
+    case Type::DOUBLE:
+      return Encoding::PLAIN;
+
+    case Type::BYTE_ARRAY:
+      return Encoding::DELTA_LENGTH_BYTE_ARRAY;

Review Comment:
   Probably, added.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to