[jira] [Commented] (AVRO-2775) JacksonUtils: exception when calling toJsonNode()

2020-03-16 Thread Andy Le (Jira)


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

Andy Le commented on AVRO-2775:
---

Another problem is: currently JacksonUtils does NOT handle Short and Byte (see 
[this 
code|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java#L82-L84]).
 So I'm thinking of creating a PR to address them all.

 

[~fokko] [~sekikn] Please review my issue. Thank you!

> JacksonUtils: exception when calling toJsonNode() 
> --
>
> Key: AVRO-2775
> URL: https://issues.apache.org/jira/browse/AVRO-2775
> Project: Apache Avro
>  Issue Type: Bug
>  Components: java
>Affects Versions: 1.9.2
>Reporter: Andy Le
>Priority: Major
>
> I've got a simple test as followed
> {code:java}
> public class TestJacksonUtils {
>   public static class Age{
> public int value = 9;
>   }
>   @Test
>   public void testToJson(){
> Map kv = new HashMap<>();
> kv.put("age", 9);
> JsonNode node1 = JacksonUtils.toJsonNode(kv); // -> This is OK
> Object obj = new Age();
> JsonNode node2 = JacksonUtils.toJsonNode(obj); // -> This will trigger an 
> exception
>   }
> }
> {code}
> When I ran the test:
> {noformat}
> org.apache.avro.AvroRuntimeException: Unknown datum class: class 
> org.apache.avro.util.internal.TestJacksonUtils$Age
>   at 
> org.apache.avro.util.internal.JacksonUtils.toJson(JacksonUtils.java:87)
>   at 
> org.apache.avro.util.internal.JacksonUtils.toJsonNode(JacksonUtils.java:48)
>   at 
> org.apache.avro.util.internal.TestJacksonUtils.testToJson(TestJacksonUtils.java:20)
> {noformat}
> I've read the code & tests for JacksonUtils. Instead of raising exceptions at 
> [line 
> #87|https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java#L87],
>  I see we can auto convert objects into maps, every thing's gonna fine.
> My question is:
> - Is raising exception acceptable?
> - Any other way to have `toJsonNode` for general objects?



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (AVRO-2776) Failed to install avro-python3: Version loaded from file: avro/VERSION.txt does not comply with PEP 440

2020-03-16 Thread Shabir Adeel (Jira)
Shabir Adeel created AVRO-2776:
--

 Summary: Failed to install avro-python3: Version loaded from file: 
avro/VERSION.txt does not comply with PEP 440
 Key: AVRO-2776
 URL: https://issues.apache.org/jira/browse/AVRO-2776
 Project: Apache Avro
  Issue Type: Bug
Reporter: Shabir Adeel


python3 -m venv catenv

source catenv/bin/activate

pip install avro-python3

 

Installing collected packages: avro-python3
 Running setup.py install for avro-python3 ... error
 Complete output from command /usr/local/google/home/sadeel/catenv/bin/python3 
-u -c "import setuptools, 
tokenize;__file__='/tmp/pip-install-xy74uv94/avro-python3/setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
/tmp/pip-record-rla4i946/install-record.txt --single-version-externally-managed 
--compile --install-headers 
/usr/local/google/home/sadeel/catenv/include/site/python3.7/avro-python3:
 Traceback (most recent call last):
 File "", line 1, in 
 File "/tmp/pip-install-xy74uv94/avro-python3/setup.py", line 172, in 
 main()
 File "/tmp/pip-install-xy74uv94/avro-python3/setup.py", line 167, in main
 "lint": LintCommand,
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/__init__.py",
 line 145, in setup
 return distutils.core.setup(**attrs)
 File "/usr/lib/python3.7/distutils/core.py", line 121, in setup
 dist.parse_config_files()
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/dist.py",
 line 705, in parse_config_files
 ignore_option_errors=ignore_option_errors)
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/config.py",
 line 120, in parse_configuration
 meta.parse()
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/config.py",
 line 425, in parse
 section_parser_method(section_options)
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/config.py",
 line 398, in parse_section
 self[name] = value
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/config.py",
 line 183, in __setitem__
 value = parser(value)
 File 
"/usr/local/google/home/sadeel/catenv/lib/python3.7/site-packages/setuptools/config.py",
 line 509, in _parse_version
 raise DistutilsOptionError(tmpl.format(**locals()))
 distutils.errors.DistutilsOptionError: Version loaded from file: 
avro/VERSION.txt does not comply with PEP 440:
 
 
Command "/usr/local/google/home/sadeel/catenv/bin/python3 -u -c "import 
setuptools, 
tokenize;__file__='/tmp/pip-install-xy74uv94/avro-python3/setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
/tmp/pip-record-rla4i946/install-record.txt --single-version-externally-managed 
--compile --install-headers 
/usr/local/google/home/sadeel/catenv/include/site/python3.7/avro-python3" 
failed with error code 1 in /tmp/pip-install-xy74uv94/avro-python3/



--
This message was sent by Atlassian Jira
(v8.3.4#803005)