Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
vkorukanti committed Sep 26, 2024
1 parent 7b8c844 commit ae0b189
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private static FieldMetadata parseFieldMetadata(
JsonNode value = entry.getValue();
String key = entry.getKey();

if (!includecollationsMetadata && key.equals(DataType.COLLATIONS_METADATA_KEY)) {
if (!includecollationsMetadata && key.equals(StructField.COLLATIONS_METADATA_KEY)) {
continue;
}

Expand Down Expand Up @@ -419,10 +419,10 @@ private static void assertValidTypeForCollations(

/** Returns a metadata with a map of field path to collation name. */
private static FieldMetadata getCollationsMetadata(JsonNode fieldMetadata) {
if (fieldMetadata == null || !fieldMetadata.has(DataType.COLLATIONS_METADATA_KEY)) {
if (fieldMetadata == null || !fieldMetadata.has(StructField.COLLATIONS_METADATA_KEY)) {
return new FieldMetadata.Builder().build();
}
return parseFieldMetadata(fieldMetadata.get(DataType.COLLATIONS_METADATA_KEY));
return parseFieldMetadata(fieldMetadata.get(StructField.COLLATIONS_METADATA_KEY));
}

private static boolean getBooleanField(JsonNode rootNode, String fieldName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
*/
@Evolving
public abstract class DataType {
public static final String COLLATIONS_METADATA_KEY = "__COLLATIONS";

/**
* Are the data types same? The metadata or column names could be different.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class StructField {
false,
FieldMetadata.builder().putBoolean(IS_METADATA_COLUMN_KEY, true).build());

public static final String COLLATIONS_METADATA_KEY = "__COLLATIONS";

////////////////////////////////////////////////////////////////////////////////
// Instance Fields / Methods
////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -156,7 +158,7 @@ private List<Tuple2<String, String>> getNestedCollatedFields(DataType parent, St
// collation information in the nearest ancestor StructField's metadata when serializing.
return nestedCollatedFields;
}

/** Fetches collation metadata from nested collated fields. */
private FieldMetadata fetchCollationMetadata() {
List<Tuple2<String, String>> nestedCollatedFields = getNestedCollatedFields(dataType, name);
Expand All @@ -170,7 +172,7 @@ private FieldMetadata fetchCollationMetadata() {
}

return new FieldMetadata.Builder()
.putFieldMetadata(DataType.COLLATIONS_METADATA_KEY, metadataBuilder.build())
.build();
.putFieldMetadata(COLLATIONS_METADATA_KEY, metadataBuilder.build())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package io.delta.kernel.internal.types

import com.fasterxml.jackson.databind.ObjectMapper
import io.delta.kernel.types._
import io.delta.kernel.types.DataType.COLLATIONS_METADATA_KEY
import StructField.COLLATIONS_METADATA_KEY
import org.scalatest.funsuite.AnyFunSuite

import java.util.HashMap
Expand Down

0 comments on commit ae0b189

Please sign in to comment.