Github user prasanthj commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2755#discussion_r193178839
--- Diff:
nifi-nar-bundles/nifi-hive-bundle/nifi-hive3-processors/src/main/java/org/apache/nifi/processors/orc/record/ORCHDFSRecordWriter.java
---
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.processors.orc.record;
+
+import org.apache.avro.Schema;
+import org.apache.hadoop.hive.ql.io.orc.NiFiOrcUtils;
+import org.apache.hadoop.hive.ql.io.orc.Writer;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
+import org.apache.nifi.processors.hadoop.record.HDFSRecordWriter;
+import org.apache.nifi.serialization.WriteResult;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.serialization.record.RecordSet;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static org.apache.nifi.processors.orc.PutORC.HIVE_DDL_ATTRIBUTE;
+
+/**
+ * HDFSRecordWriter that writes ORC files using Avro as the schema
representation.
+ */
+
+public class ORCHDFSRecordWriter implements HDFSRecordWriter {
+
+ private final Schema avroSchema;
+ private final TypeInfo orcSchema;
+ private final Writer orcWriter;
+ private final String hiveTableName;
+ private final boolean hiveFieldNames;
+
+ public ORCHDFSRecordWriter(final Writer orcWriter, final Schema
avroSchema, final String hiveTableName, final boolean hiveFieldNames) {
+ this.avroSchema = avroSchema;
+ this.orcWriter = orcWriter;
+ this.hiveFieldNames = hiveFieldNames;
+ this.orcSchema = NiFiOrcUtils.getOrcField(avroSchema,
this.hiveFieldNames);
+ this.hiveTableName = hiveTableName;
+ }
+
+ @Override
+ public void write(final Record record) throws IOException {
+ List<Schema.Field> fields = avroSchema.getFields();
--- End diff --
If fields does not change this can be outside of inner loop?
---