我正在用 Java 创建一个 ORC 文件。对于每一行,我希望字段用逗号分隔。这是我的java代码:
ObjectInspector inspector = ObjectInspectorFactory.getReflectionObjectInspector(String.class,ObjectInspectorFactory.ObjectInspectorOptions.JAVA);
this.mWriter = OrcFile.createWriter(fs, fsPath, config, inspector, stripSize, CompressionKind.ZLIB, bufferSize,0);
this.mWriter.addRow(new Text("shekhar,saha"));
this.mWriter.addRow(new Text("ram,shyam"));
this.mWriter.addRow(new Text("jhon,cena"));
this.mWriter.close();
这是创建它的正确方法吗?
我正在尝试在 Hive 表中加载数据。这就是我创建表的方式:
create table demo ( name1 STRING,name2 STRING ) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' STORED AS ORC tblproperties ("orc.compress"="ZLIB");
但我无法加载数据。当我从表中读取数据时,它会抛出类种姓异常org.apache.hadoop.hive.ql.io.orc.OrcStruct cannot be cast to org.apache.hadoop.io.Text