如何使用parquet avro在parquet文件中创建日期类型列
我正在使用基于Java(1.8)的应用程序使用库创建拼花地板文件 org.apache.avro.Schema和org.apache.parquet.hadoop.ParquetWriter等 这是我的示例代码 最后一个字符串schemaLocation=ParquerWriterImpl.class.getClassLoader().getResource(“parquet schema/”+parquetypes.RISKINFO.getFileType()).getPath() 在POJO类中,我将“mydate”映射到Java int类型 问题1 虽然我在这里得到了拼花地板文件,但在使用spark打开该文件后,“mydate”列显示为int类型而不是预期的日期类型 请让我知道如何使这个“mydate”成为拼花地板模式中的日期列如何使用parquet avro在parquet文件中创建日期类型列,parquet,Parquet,我正在使用基于Java(1.8)的应用程序使用库创建拼花地板文件 org.apache.avro.Schema和org.apache.parquet.hadoop.ParquetWriter等 这是我的示例代码 最后一个字符串schemaLocation=ParquerWriterImpl.class.getClassLoader().getResource(“parquet schema/”+parquetypes.RISKINFO.getFileType()).getPath() 在POJO
e、 g mydate date(nullable true)我也有同样的问题。我在用 为我切换到修复它:
{"name": "birth_date", "type": [{"type": "int", "logicalType" : "date"}, "null"]}"
我将该值设置为:
record.put("birth_date", 1);
它在ApacheSpark数据帧中显示为1970-01-02
{"name": "birth_date", "type": [{"type": "int", "logicalType" : "date"}, "null"]}"
record.put("birth_date", 1);