[jira] [Commented] (PARQUET-1344) Type builders don't honor new logical types

2018-07-04 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on PARQUET-1344:
-

gszadovszky closed pull request #500: PARQUET-1344: Type builders don't honor 
new logical types
URL: https://github.com/apache/parquet-mr/pull/500
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/parquet-column/src/main/java/org/apache/parquet/schema/Types.java 
b/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
index 54fb1d885..165a5acea 100644
--- a/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
+++ b/parquet-column/src/main/java/org/apache/parquet/schema/Types.java
@@ -514,7 +514,11 @@ protected PrimitiveType build(String name) {
 }
   }
 
-  return new PrimitiveType(repetition, primitiveType, length, name, 
getOriginalType(), meta, id, columnOrder);
+  if (newLogicalTypeSet) {
+return new PrimitiveType(repetition, primitiveType, length, name, 
logicalTypeAnnotation, id, columnOrder);
+  } else {
+return new PrimitiveType(repetition, primitiveType, length, name, 
getOriginalType(), meta, id, columnOrder);
+  }
 }
 
 private static long maxPrecision(int numBytes) {
@@ -702,7 +706,11 @@ public THIS addFields(Type... types) {
 
 @Override
 protected GroupType build(String name) {
-  return new GroupType(repetition, name, getOriginalType(), fields, id);
+  if (newLogicalTypeSet) {
+return new GroupType(repetition, name, logicalTypeAnnotation, fields, 
id);
+  } else {
+return new GroupType(repetition, name, getOriginalType(), fields, id);
+  }
 }
 
 public MapBuilder map(
diff --git 
a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java 
b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
index a42e9e33b..82e58ef7d 100644
--- 
a/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
+++ 
b/parquet-column/src/test/java/org/apache/parquet/schema/TestTypeBuilders.java
@@ -26,6 +26,9 @@
 import org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName;
 import org.apache.parquet.schema.Type.Repetition;
 
+import static org.apache.parquet.schema.LogicalTypeAnnotation.TimeUnit.MICROS;
+import static org.apache.parquet.schema.LogicalTypeAnnotation.TimeUnit.MILLIS;
+import static org.apache.parquet.schema.LogicalTypeAnnotation.timestampType;
 import static org.apache.parquet.schema.OriginalType.*;
 import static org.apache.parquet.schema.PrimitiveType.PrimitiveTypeName.*;
 import static org.apache.parquet.schema.Type.Repetition.*;
@@ -1423,6 +1426,32 @@ public void 
testDecimalLogicalTypeWithDeprecatedPrecision() {
 Assert.assertEquals(expected, actual);
   }
 
+  @Test
+  public void testTimestampLogicalTypeWithUTCParameter() {
+PrimitiveType utcMillisExpected = new PrimitiveType(REQUIRED, INT64, 
"aTimestamp",
+  timestampType(true, MILLIS));
+PrimitiveType nonUtcMillisExpected = new PrimitiveType(REQUIRED, INT64, 
"aTimestamp",
+  timestampType(false, MILLIS));
+PrimitiveType utcMicrosExpected = new PrimitiveType(REQUIRED, INT64, 
"aTimestamp",
+  timestampType(true, MICROS));
+PrimitiveType nonUtcMicrosExpected = new PrimitiveType(REQUIRED, INT64, 
"aTimestamp",
+  timestampType(false, MICROS));
+
+PrimitiveType utcMillisActual = Types.required(INT64)
+  .as(timestampType(true, MILLIS)).named("aTimestamp");
+PrimitiveType nonUtcMillisActual = Types.required(INT64)
+  .as(timestampType(false, MILLIS)).named("aTimestamp");
+PrimitiveType utcMicrosActual = Types.required(INT64)
+  .as(timestampType(true, MICROS)).named("aTimestamp");
+PrimitiveType nonUtcMicrosActual = Types.required(INT64)
+  .as(timestampType(false, MICROS)).named("aTimestamp");
+
+Assert.assertEquals(utcMillisExpected, utcMillisActual);
+Assert.assertEquals(nonUtcMillisExpected, nonUtcMillisActual);
+Assert.assertEquals(utcMicrosExpected, utcMicrosActual);
+Assert.assertEquals(nonUtcMicrosExpected, nonUtcMicrosActual);
+  }
+
   @Test(expected = IllegalArgumentException.class)
   public void testDecimalLogicalTypeWithDeprecatedScaleMismatch() {
 Types.required(BINARY)


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Type builders don't honor new logical types
> 

[jira] [Commented] (PARQUET-1338) PrimitiveType.equals throw NPE

2018-07-04 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on PARQUET-1338:
-

wangyum opened a new pull request #498: PARQUET-1338: Fix PrimitiveType.equals 
throw NPE
URL: https://github.com/apache/parquet-mr/pull/498
 
 
   Fix `PrimitiveType.equals` throw NPE.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> PrimitiveType.equals throw NPE
> --
>
> Key: PARQUET-1338
> URL: https://issues.apache.org/jira/browse/PARQUET-1338
> Project: Parquet
>  Issue Type: Bug
>  Components: parquet-mr
>Affects Versions: 1.10.1
>Reporter: Yuming Wang
>Assignee: Yuming Wang
>Priority: Major
>  Labels: pull-request-available
>
> Error message:
> {noformat}
> java.lang.NullPointerException
>   at 
> org.apache.parquet.schema.PrimitiveType.equals(PrimitiveType.java:614)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (PARQUET-1335) Logical type names in parquet-mr are not consistent with parquet-format

2018-07-04 Thread ASF GitHub Bot (JIRA)


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

ASF GitHub Bot commented on PARQUET-1335:
-

nandorKollar opened a new pull request #503: PARQUET-1335: Logical type names 
in parquet-mr are not consistent with parquet-format
URL: https://github.com/apache/parquet-mr/pull/503
 
 
   Add test case for STRING annotation and revert UTF8 annotations removed in 
PR#496


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Logical type names in parquet-mr are not consistent with parquet-format
> ---
>
> Key: PARQUET-1335
> URL: https://issues.apache.org/jira/browse/PARQUET-1335
> Project: Parquet
>  Issue Type: Improvement
>  Components: parquet-mr
>Affects Versions: 1.11.0
>Reporter: Nandor Kollar
>Assignee: Nandor Kollar
>Priority: Minor
>  Labels: pull-request-available
>
> UTF8 logical type should be called STRING, INT should be called INTEGER.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)