diff --git a/java/src/main/java/com/logicalclocks/hsfs/Feature.java b/java/src/main/java/com/logicalclocks/hsfs/Feature.java index 00ade31567..d074289ae9 100644 --- a/java/src/main/java/com/logicalclocks/hsfs/Feature.java +++ b/java/src/main/java/com/logicalclocks/hsfs/Feature.java @@ -63,6 +63,21 @@ public Feature(@NonNull String name, @NonNull String type, @NonNull String defau this.defaultValue = defaultValue; } + public Feature(String name, String type, Boolean primary, Boolean partition) + throws FeatureStoreException { + if (Strings.isNullOrEmpty(name)) { + throw new FeatureStoreException("Name is required when creating a feature"); + } + this.name = name; + + if (Strings.isNullOrEmpty(type)) { + throw new FeatureStoreException("Type is required when creating a feature"); + } + this.type = type; + this.primary = primary; + this.partition = partition; + } + @Builder public Feature(String name, String type, String onlineType, Boolean primary, Boolean partition, String defaultValue) throws FeatureStoreException { diff --git a/java/src/main/java/com/logicalclocks/hsfs/engine/Utils.java b/java/src/main/java/com/logicalclocks/hsfs/engine/Utils.java index d19360031a..e52b187979 100644 --- a/java/src/main/java/com/logicalclocks/hsfs/engine/Utils.java +++ b/java/src/main/java/com/logicalclocks/hsfs/engine/Utils.java @@ -48,8 +48,11 @@ public List parseFeatureGroupSchema(Dataset dataset) throws Featur List features = new ArrayList<>(); for (StructField structField : dataset.schema().fields()) { // TODO(Fabio): unit test this one for complext types - features.add(new Feature(structField.name(), structField.dataType().catalogString(), - structField.dataType().catalogString(), false, false, null)); + Feature f = new Feature(structField.name(), structField.dataType().catalogString(), false, false); + if (structField.metadata().contains("description")) { + f.setDescription(structField.metadata().getString("description")); + } + features.add(f); } return features;