Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,14 @@ private void printHeader(Driver qp, PrintStream out) {
&& fieldSchemas != null) {
// Print the column names
boolean first_col = true;
String serializationFormat = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_LISTSINK_SERIALIZATION_FORMAT);
for (FieldSchema fs : fieldSchemas) {
if (!first_col) {
out.print('\t');
if (!StringUtils.isEmpty(serializationFormat)) {
out.print((char)Integer.parseInt(serializationFormat));
} else {
out.print('\t');
}
}
out.print(fs.getName());
first_col = false;
Expand Down
2 changes: 2 additions & 0 deletions common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ public static enum ConfVars {
HIVESERVER_KERBEROS_KEYTAB_FILE("hive.hiveserver.kerberos.keytab.file", ""),
HIVESERVER_KERBEROS_PRINCIPAL("hive.hiveserver.kerberos.principal", ""),
HIVESERVER_USE_THRIFT_SASL("hive.hiveserver.sasl.enabled", false),

HIVE_LISTSINK_SERIALIZATION_FORMAT("hive.listsink.serialization.format", ""),
;

public final String varname;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hive.common.JavaUtils;
import org.apache.hadoop.hive.conf.HiveConf;
Expand Down Expand Up @@ -65,7 +66,12 @@ private SerDe initializeSerde(Configuration conf) throws Exception {

// this is the default serialization format
if (serde instanceof DelimitedJSONSerDe) {
serdeProp.put(serdeConstants.SERIALIZATION_FORMAT, "" + Utilities.tabCode);
String serializationFormat = getConfiguration().get(HiveConf.ConfVars.HIVE_LISTSINK_SERIALIZATION_FORMAT.varname);
if (!StringUtils.isEmpty(serializationFormat)) {
serdeProp.put(serdeConstants.SERIALIZATION_FORMAT, "" + Integer.parseInt(serializationFormat));
} else {
serdeProp.put(serdeConstants.SERIALIZATION_FORMAT, "" + Utilities.tabCode);
}
serdeProp.put(serdeConstants.SERIALIZATION_NULL_FORMAT, getConf().getSerializationNullFormat());
}
serde.initialize(conf, serdeProp);
Expand Down