Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions api/src/main/java/org/apache/iceberg/types/Types.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.apache.iceberg.types;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -457,7 +456,7 @@ private static void validateDefaultValue(Object defaultValue, Type type) {
}
switch (type.typeId()) {
case STRUCT:
Preconditions.checkArgument(Map.class.isInstance(defaultValue),
Preconditions.checkArgument(defaultValue instanceof Map,
"defaultValue should be a Map from fields names to values, for StructType");
Map<String, Object> defaultStruct = (Map<String, Object>) defaultValue;
if (defaultStruct.isEmpty()) {
Expand All @@ -470,17 +469,17 @@ private static void validateDefaultValue(Object defaultValue, Type type) {
break;

case LIST:
Preconditions.checkArgument(defaultValue instanceof ArrayList,
"defaultValue should be an ArrayList of Objects, for ListType");
List<Object> defaultArrayList = (ArrayList<Object>) defaultValue;
if (defaultArrayList.size() == 0) {
Preconditions.checkArgument(defaultValue instanceof List,
"defaultValue should be an List of Objects, for ListType");
List<Object> defaultList = (List<Object>) defaultValue;
if (defaultList.size() == 0) {
return;
}
defaultArrayList.forEach(dv -> NestedField.validateDefaultValue(dv, type.asListType().elementField.type));
defaultList.forEach(dv -> NestedField.validateDefaultValue(dv, type.asListType().elementField.type));
break;

case MAP:
Preconditions.checkArgument(Map.class.isInstance(defaultValue),
Preconditions.checkArgument(defaultValue instanceof Map,
"defaultValue should be an instance of Map for MapType");
Map<Object, Object> defaultMap = (Map<Object, Object>) defaultValue;
if (defaultMap.isEmpty()) {
Expand All @@ -494,7 +493,7 @@ private static void validateDefaultValue(Object defaultValue, Type type) {

case FIXED:
case BINARY:
Preconditions.checkArgument(byte[].class.isInstance(defaultValue),
Preconditions.checkArgument(defaultValue instanceof byte[],
"defaultValue should be an instance of byte[] for TypeId.%s, but defaultValue.class = %s",
type.typeId().name(), defaultValue.getClass().getCanonicalName());
break;
Expand Down
2 changes: 0 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ buildscript {
repositories {
jcenter()
gradlePluginPortal()
maven { url "http://palantir.bintray.com/releases" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
Expand Down Expand Up @@ -64,7 +63,6 @@ allprojects {
group = "org.apache.iceberg"
version = getProjectVersion()
repositories {
maven { url "http://palantir.bintray.com/releases" }
mavenCentral()
mavenLocal()
}
Expand Down