[
https://issues.apache.org/jira/browse/AVRO-2976?focusedWorklogId=667941&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-667941
]
ASF GitHub Bot logged work on AVRO-2976:
----------------------------------------
Author: ASF GitHub Bot
Created on: 20/Oct/21 19:50
Start Date: 20/Oct/21 19:50
Worklog Time Spent: 10m
Work Description: martin-g commented on a change in pull request #985:
URL: https://github.com/apache/avro/pull/985#discussion_r733096593
##########
File path: lang/java/compiler/src/test/idl/input/simple.avdl
##########
@@ -60,6 +60,7 @@ protocol Simple {
time_ms t = 0;
@foo.bar("bar.foo") long l = 0;
+ @foo.bar.bar("foo.bar2") array<string> a = [];
Review comment:
Is this related to the issue with the logical types ?
##########
File path:
lang/java/compiler/src/test/java/org/apache/avro/compiler/idl/TestLogicalTypes.java
##########
@@ -0,0 +1,99 @@
+/*
+ * 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
+ *
+ * https://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.avro.compiler.idl;
+
+import org.apache.avro.LogicalType;
+import org.apache.avro.LogicalTypes;
+import org.apache.avro.Protocol;
+import org.apache.avro.Schema;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestLogicalTypes {
+ private static final Logger LOG = LoggerFactory.getLogger(TestCycle.class);
Review comment:
Why `TestCycle.class` ?
##########
File path:
lang/java/compiler/src/main/javacc/org/apache/avro/compiler/idl/idl.jj
##########
@@ -1296,20 +1300,11 @@ private void SchemaProperty(Map<String, JsonNode>
properties):
void FieldDeclaration(List<Field> fields):
{
Schema type;
- Map<String, JsonNode> props = new LinkedHashMap<String, JsonNode>();
}
{
- // TODO should we be able to specify properties on any Type?
- // or just on field declarations as done here
-
- ( SchemaProperty(props) )*
type = Type()
VariableDeclarator(type, fields) ( "," VariableDeclarator(type, fields) )*
";"
- {
- for (String key : props.keySet())
- Accessor.addProp(type, key, props.get(key));
Review comment:
It is not clear to me why this code is being removed.
I am not familiar with idl.jj.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 667941)
Time Spent: 1h 20m (was: 1h 10m)
> IDL parsing does not support arbitrary logical types
> ----------------------------------------------------
>
> Key: AVRO-2976
> URL: https://issues.apache.org/jira/browse/AVRO-2976
> Project: Apache Avro
> Issue Type: Improvement
> Components: java, logical types, tools
> Affects Versions: 1.8.2, 1.10.0, 1.9.2, 1.10.1, 1.10.2
> Reporter: Oscar Westra van Holthe - Kind
> Assignee: Oscar Westra van Holthe - Kind
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.11.1
>
> Attachments: avro2976.zip
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> When parsing Avro IDL in code, the resulting protocol types (schemas) have no
> logical types defined, when though the properties for them are set.
>
> Example IDL:
> {code:java}
> protocol P {
> record R {
> @logicalType("timestamp-micros") long uTime;
> }
> }{code}
>
> The following test fails on the second assert:
> {code:java}
> @Test
> public void validateIdlLogicalTypeParsing() {
> final ClassLoader cl = Thread.currentThread().getContextClassLoader();
> Idl idl = new Idl(cl.getResourceAsStream("logicalTypes.avdl"), "UTF-8");
> Protocol protocol = idl.CompilationUnit();
> Schema fieldSchema = protocol.getType("R").getField("uTime").schema();
> Assert.assertEquals("timestamp-micros",
> fieldSchema.getObjectProp("logicalType"));
> Assert.assertNotNull(fieldSchema.getLogicalType());
> }
> {code}
>
> A minimal proof is attached.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)