You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by tu...@apache.org on 2022/07/29 11:06:34 UTC

[arrow-rs] branch master updated: parquet: export json api with `serde_json` feature name (#2209)

This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 588f40889 parquet: export json api with `serde_json` feature name (#2209)
588f40889 is described below

commit 588f40889f5970de66cce855e71a65fc098a4691
Author: 尹吉峰 <ji...@gmail.com>
AuthorDate: Fri Jul 29 19:06:30 2022 +0800

    parquet: export json api with `serde_json` feature name (#2209)
    
    * parquet: export json api with `serde_json` feature name
    
    * chore: don't piggyback on optional feature name
---
 parquet/Cargo.toml        | 4 +++-
 parquet/src/record/api.rs | 7 +++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/parquet/Cargo.toml b/parquet/Cargo.toml
index a0e164150..671f232cf 100644
--- a/parquet/Cargo.toml
+++ b/parquet/Cargo.toml
@@ -72,7 +72,9 @@ default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"]
 # Enable arrow reader/writer APIs
 arrow = ["dep:arrow", "base64"]
 # Enable CLI tools
-cli = ["serde_json", "base64", "clap", "arrow/csv"]
+cli = ["json", "base64", "clap", "arrow/csv"]
+# Enable JSON APIs
+json = ["serde_json"]
 # Enable internal testing APIs
 test_common = ["arrow/test_utils"]
 # Experimental, unstable functionality primarily used for testing
diff --git a/parquet/src/record/api.rs b/parquet/src/record/api.rs
index 0a360fd29..7e1c484bf 100644
--- a/parquet/src/record/api.rs
+++ b/parquet/src/record/api.rs
@@ -27,7 +27,7 @@ use crate::data_type::{ByteArray, Decimal, Int96};
 use crate::errors::{ParquetError, Result};
 use crate::schema::types::ColumnDescPtr;
 
-#[cfg(any(feature = "cli", test))]
+#[cfg(any(feature = "json", test))]
 use serde_json::Value;
 
 /// Macro as a shortcut to generate 'not yet implemented' panic error.
@@ -79,7 +79,7 @@ impl Row {
         }
     }
 
-    #[cfg(any(feature = "cli", test))]
+    #[cfg(any(feature = "json", test))]
     pub fn to_json_value(&self) -> Value {
         Value::Object(
             self.fields
@@ -667,7 +667,7 @@ impl Field {
         }
     }
 
-    #[cfg(any(feature = "cli", test))]
+    #[cfg(any(feature = "json", test))]
     pub fn to_json_value(&self) -> Value {
         match &self {
             Field::Null => Value::Null,
@@ -1685,7 +1685,6 @@ mod tests {
     }
 
     #[test]
-    #[cfg(any(feature = "cli", test))]
     fn test_to_json_value() {
         assert_eq!(Field::Null.to_json_value(), Value::Null);
         assert_eq!(Field::Bool(true).to_json_value(), Value::Bool(true));