[ 
https://issues.apache.org/jira/browse/PARQUET-1647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17768342#comment-17768342
 ] 

ASF GitHub Bot commented on PARQUET-1647:
-----------------------------------------

zhangjiashen commented on code in PR #1142:
URL: https://github.com/apache/parquet-mr/pull/1142#discussion_r1335132433


##########
parquet-column/src/main/java/org/apache/parquet/schema/PrimitiveStringifier.java:
##########
@@ -448,4 +449,16 @@ private void appendHex(byte[] array, int offset, int 
length, StringBuilder build
       }
     }
   };
+
+  static final PrimitiveStringifier FLOAT16_STRINGIFIER = new 
BinaryStringifierBase("FLOAT16_STRINGIFIER") {
+
+    @Override
+    String stringifyNotNull(Binary value) {
+      if (value.length() != 2) {
+        return BINARY_INVALID;
+      }
+      ByteBuffer buffer = value.toByteBuffer().order(ByteOrder.LITTLE_ENDIAN);
+      return 
DEFAULT_STRINGIFIER.stringify(toFloat(buffer.getShort(buffer.position())));

Review Comment:
   Added a Float16.toFloatString(..) method and please help check if it makes 
sense?





> [Java] support for Arrow's float16
> ----------------------------------
>
>                 Key: PARQUET-1647
>                 URL: https://issues.apache.org/jira/browse/PARQUET-1647
>             Project: Parquet
>          Issue Type: Improvement
>          Components: parquet-format, parquet-thrift
>            Reporter: The Alchemist
>            Priority: Minor
>
> h2. DESCRIPTION
>  
> I'm wondering if there's any interest in supporting Arrow's {{float16}} type 
> in Parquet.
> There seem to be one or two {{float16}} / {{halffloat}} tickets here (e.g., 
> PARQUET-1403) but nothing that speaks to adding half-float support to Parquet 
> in-general.
>  
> h2. PLANS
> I'm able to spend some time on this, if someone points me  in the right 
> direction.
>  
>  # Add the {{HALFFLOAT}} or {{FLOAT16}} enum (any preferred naming 
> convention?) to 
> [https://github.com/apache/parquet-format/blob/master/src/main/thrift/parquet.thrift#L32]
>  # Add {{HALFFLOAT}} to {{org.apache.parquet.schema.PrimitiveType}}
>  # Add {{HALFFLOAT}} support to 
> {{org.apache.parquet.arrow.schema.SchemaConverter}}
>  # Add encoding for new type at {{org.apache.parquet.column.Encoding}}
>  # ??
> If anyone has any interest in this, pointers, or comments, they would be 
> greatly appreciated!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to