private void setDelimiterProperties(Properties props, String prefix, DelimiterSet values) { putProperty(props, prefix + ".field", Integer.toString((int) values.getFieldsTerminatedBy())); putProperty(props, prefix + ".record", Integer.toString((int) values.getLinesTerminatedBy())); putProperty(props, prefix + ".enclose", Integer.toString((int) values.getEnclosedBy())); putProperty(props, prefix + ".escape", Integer.toString((int) values.getEscapedBy())); putProperty(props, prefix + ".enclose.required", Boolean.toString(values.isEncloseRequired())); }
@Override public Object clone() { try { SqoopOptions other = (SqoopOptions) super.clone(); if (null != columns) { other.columns = Arrays.copyOf(columns, columns.length); } if (null != dbOutColumns) { other.dbOutColumns = Arrays.copyOf(dbOutColumns, dbOutColumns.length); } if (null != inputDelimiters) { other.inputDelimiters = (DelimiterSet) inputDelimiters.clone(); } if (null != outputDelimiters) { other.outputDelimiters = (DelimiterSet) outputDelimiters.clone(); } if (null != conf) { other.conf = new Configuration(conf); } if (null != extraArgs) { other.extraArgs = Arrays.copyOf(extraArgs, extraArgs.length); } return other; } catch (CloneNotSupportedException cnse) { // Shouldn't happen. return null; } }
public String toString(DelimiterSet delimiters, boolean useRecordDelim) { StringBuilder __sb = new StringBuilder(); char fieldDelim = delimiters.getFieldsTerminatedBy(); __sb.append( FieldFormatter.escapeAndEnclose( r_regionkey == null ? "null" : "" + r_regionkey, delimiters)); __sb.append(fieldDelim); __sb.append(FieldFormatter.escapeAndEnclose(r_name == null ? "null" : r_name, delimiters)); __sb.append(fieldDelim); __sb.append( FieldFormatter.escapeAndEnclose(r_comment == null ? "null" : r_comment, delimiters)); if (useRecordDelim) { __sb.append(delimiters.getLinesTerminatedBy()); } return __sb.toString(); }
private DelimiterSet getDelimiterProperties( Properties props, String prefix, DelimiterSet defaults) { if (null == defaults) { defaults = new DelimiterSet(); } char field = getCharProperty(props, prefix + ".field", defaults.getFieldsTerminatedBy()); char record = getCharProperty(props, prefix + ".record", defaults.getLinesTerminatedBy()); char enclose = getCharProperty(props, prefix + ".enclose", defaults.getEnclosedBy()); char escape = getCharProperty(props, prefix + ".escape", defaults.getEscapedBy()); boolean required = getBooleanProperty(props, prefix + ".enclose.required", defaults.isEncloseRequired()); return new DelimiterSet(field, record, enclose, escape, required); }
/** * @return the escape character to use when parsing lines. Defaults to the escape character used * when printing lines. */ public char getInputEscapedBy() { char c = inputDelimiters.getEscapedBy(); if (c == DelimiterSet.NULL_CHAR) { return this.outputDelimiters.getEscapedBy(); } else { return c; } }
/** * @return the record delimiter to use when parsing lines. Defaults to the record delim to use * when printing lines. */ public char getInputRecordDelim() { char r = inputDelimiters.getLinesTerminatedBy(); if (r == DelimiterSet.NULL_CHAR) { return this.outputDelimiters.getLinesTerminatedBy(); } else { return r; } }
/** * @return the field delimiter to use when parsing lines. Defaults to the field delim to use when * printing lines. */ public char getInputFieldDelim() { char f = inputDelimiters.getFieldsTerminatedBy(); if (f == DelimiterSet.NULL_CHAR) { return this.outputDelimiters.getFieldsTerminatedBy(); } else { return f; } }
/** Set the complete set of delimiters to use for output formatting. */ public void setOutputDelimiters(DelimiterSet delimiters) { this.outputDelimiters = delimiters.copy(); }