Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用parquet avro在parquet文件中创建日期类型列_Parquet - Fatal编程技术网

如何使用parquet avro在parquet文件中创建日期类型列

如何使用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

我正在使用基于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”成为拼花地板模式中的日期列


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);