I am using spark in Java and I am creating a Dataset of Row from an RDD OF row.
I create the schema using
Metadata meta = new MetadataBuilder().putString("type", "categorical").build();
StructField s = new StructField(name, IntegerType, true, meta);
StructType t = new StructType(new StructField[]{s});
Encoder<Row> encoder = RowEncoder.apply(t);
and I use it in the dataset like this
ds.flatMap((FlatMapFunction<Row, Row>) this::customFlatMapRow, encoder);
for some reasons after I write the table and I inspect the fields of the schema and their metadata they are empty (despite the fact I created and set them like above). Somehow I am loosing them