You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@avro.apache.org by ie...@apache.org on 2021/03/04 13:35:12 UTC

[avro] 02/02: AVRO-2471: Clean some dead code.

This is an automated email from the ASF dual-hosted git repository.

iemejia pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git

commit bfe1d03d683d67cdb9a984c02c6b1eb75ffe7689
Author: Ryan Skraba <ry...@skraba.com>
AuthorDate: Wed Aug 5 16:33:49 2020 +0200

    AVRO-2471: Clean some dead code.
---
 .../avro/compiler/specific/SpecificCompiler.java   | 45 ----------------------
 .../compiler/specific/TestSpecificCompiler.java    |  3 +-
 2 files changed, 1 insertion(+), 47 deletions(-)

diff --git a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
index 6d363e4..47ff751 100644
--- a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
+++ b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
@@ -331,51 +331,6 @@ public class SpecificCompiler {
     return result;
   }
 
-  private Set<String> getClassNamesOfPrimitiveFields(Schema schema) {
-    Set<String> result = new HashSet<>();
-    getClassNamesOfPrimitiveFields(schema, result, new HashSet<>());
-    return result;
-  }
-
-  private void getClassNamesOfPrimitiveFields(Schema schema, Set<String> result, Set<Schema> seenSchemas) {
-    if (seenSchemas.contains(schema)) {
-      return;
-    }
-    seenSchemas.add(schema);
-    switch (schema.getType()) {
-    case RECORD:
-      for (Schema.Field field : schema.getFields()) {
-        getClassNamesOfPrimitiveFields(field.schema(), result, seenSchemas);
-      }
-      break;
-    case MAP:
-      getClassNamesOfPrimitiveFields(schema.getValueType(), result, seenSchemas);
-      break;
-    case ARRAY:
-      getClassNamesOfPrimitiveFields(schema.getElementType(), result, seenSchemas);
-      break;
-    case UNION:
-      for (Schema s : schema.getTypes())
-        getClassNamesOfPrimitiveFields(s, result, seenSchemas);
-      break;
-    case NULL:
-      break;
-    case ENUM:
-    case FIXED:
-    case STRING:
-    case BYTES:
-    case INT:
-    case LONG:
-    case FLOAT:
-    case DOUBLE:
-    case BOOLEAN:
-      result.add(javaType(schema, true));
-      break;
-    default:
-      throw new RuntimeException("Unknown type: " + schema);
-    }
-  }
-
   private void initializeVelocity() {
     this.velocityEngine = new VelocityEngine();
 
diff --git a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
index fc95454..1ab3b5a 100644
--- a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
+++ b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
@@ -533,8 +533,7 @@ public class TestSpecificCompiler {
     SpecificCompiler compiler = createCompiler();
 
     // timestamp-millis and timestamp-micros used to cause collisions when both were
-    // present or
-    // added as converters (AVRO-2481).
+    // present or added as converters (AVRO-2481).
     final Schema tsMillis = LogicalTypes.timestampMillis().addToSchema(Schema.create(Schema.Type.LONG));
     final Schema tsMicros = LogicalTypes.timestampMicros().addToSchema(Schema.create(Schema.Type.LONG));