You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/12/22 18:47:00 UTC

[GitHub] [arrow] laurentgo opened a new pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

laurentgo opened a new pull request #12028:
URL: https://github.com/apache/arrow/pull/12028


   Jackson 2.12 does not enable by default (de)serializers for Java
   Date/Time java.time.* classes and require the jsr310 module to be added
   to the object mapper. The absence of this module causes vector module to
   stop working with newer versions of Jackson.
   
   Address this by adding a ObjectMapper factory class which register the
   jsr310 module with the objectmapper used by vector classes.


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] Jimexist commented on a change in pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
Jimexist commented on a change in pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#discussion_r779599743



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/util/ObjectMapperFactory.java
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.vector.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+/**
+ * A {@link ObjectMapper} factory to read/write JSON.
+ */
+public final class ObjectMapperFactory {
+
+  private ObjectMapperFactory() {}
+
+  /**
+   * Creates a new {@link ObjectMapper} instance.
+   */
+  public static ObjectMapper newObjectMapper() {
+    return JsonMapper.builder()
+       .addModule(new JavaTimeModule())

Review comment:
       can you add a unit test for how this will alter the behavior?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] laurentgo commented on a change in pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
laurentgo commented on a change in pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#discussion_r779615535



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/util/ObjectMapperFactory.java
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.vector.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+/**
+ * A {@link ObjectMapper} factory to read/write JSON.
+ */
+public final class ObjectMapperFactory {
+
+  private ObjectMapperFactory() {}
+
+  /**
+   * Creates a new {@link ObjectMapper} instance.
+   */
+  public static ObjectMapper newObjectMapper() {
+    return JsonMapper.builder()
+       .addModule(new JavaTimeModule())

Review comment:
       That's the tricky part, it does not alter the the current behavior, but if you want to convince yourself this patch works, you can try to build arrow with `-Ddep.jackson.version=2.12.6` without and with the patch to observe the issue is being addressed.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] Jimexist commented on pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
Jimexist commented on pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#issuecomment-1059880764


   i havent tested this locally - so if anyone would give a second opinion i'll wait for a few days before trying to merge as is


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] laurentgo commented on pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
laurentgo commented on pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#issuecomment-1082029822


   @Jimexist sorry to put some pressure on you, but since you approved this 3weeks ago, is it possible to submit this one?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] laurentgo commented on a change in pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
laurentgo commented on a change in pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#discussion_r803079542



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/util/ObjectMapperFactory.java
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.vector.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+/**
+ * A {@link ObjectMapper} factory to read/write JSON.
+ */
+public final class ObjectMapperFactory {
+
+  private ObjectMapperFactory() {}
+
+  /**
+   * Creates a new {@link ObjectMapper} instance.

Review comment:
       Isn't that an implementation detail though?




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] github-actions[bot] commented on pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#issuecomment-999790398






-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] laurentgo commented on pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
laurentgo commented on pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#issuecomment-1048091041


   @Jimexist any other comments?


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [arrow] Jimexist commented on a change in pull request #12028: ARROW-15192: [Java] Allow use of Jackson 2.12 and higher

Posted by GitBox <gi...@apache.org>.
Jimexist commented on a change in pull request #12028:
URL: https://github.com/apache/arrow/pull/12028#discussion_r779600487



##########
File path: java/vector/src/main/java/org/apache/arrow/vector/util/ObjectMapperFactory.java
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.arrow.vector.util;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.json.JsonMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+
+/**
+ * A {@link ObjectMapper} factory to read/write JSON.
+ */
+public final class ObjectMapperFactory {
+
+  private ObjectMapperFactory() {}
+
+  /**
+   * Creates a new {@link ObjectMapper} instance.

Review comment:
       ```suggestion
      * Creates a new {@link ObjectMapper} instance preconfigured with Java time handling.
   ```




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org