public static LazyHiveVarcharObjectInspector getLazyHiveVarcharObjectInspector( VarcharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveVarcharObjectInspector result = (LazyHiveVarcharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveVarcharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveVarcharObjectInspector) prev; } } return result; }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { Text textData = data.getTextValue(); // This is doing a lot of copying here, this could be improved by enforcing length // at the same time as escaping rather than as separate steps. LazyUtils.copyAndEscapeStringDataToText(bytes.getData(), start, length, oi.getEscapeChar(),textData); data.set(textData.toString(), maxLength); isNull = false; } else { try { String byteData = null; byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveVarchar data type range so converted to null.", e); } } }
public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) { super(oi); maxLength = ((VarcharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveVarcharWritable(); }
@Override public String toString() { return getTypeName(); } }
@Override public String toString() { return getTypeName(); } }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { Text textData = data.getTextValue(); // This is doing a lot of copying here, this could be improved by enforcing length // at the same time as escaping rather than as separate steps. LazyUtils.copyAndEscapeStringDataToText(bytes.getData(), start, length, oi.getEscapeChar(),textData); data.set(textData.toString(), maxLength); isNull = false; } else { try { String byteData = null; byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveVarchar data type range so converted to null.", e); } } }
break; case VARCHAR: poi = new LazyHiveVarcharObjectInspector((VarcharTypeInfo)typeInfo); break; case DECIMAL:
@Override public String toString() { return getTypeName(); } }
public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) { super(oi); maxLength = ((VarcharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveVarcharWritable(); }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { Text textData = data.getTextValue(); // This is doing a lot of copying here, this could be improved by enforcing length // at the same time as escaping rather than as separate steps. LazyUtils.copyAndEscapeStringDataToText(bytes.getData(), start, length, oi.getEscapeChar(),textData); data.set(textData.toString(), maxLength); isNull = false; } else { try { String byteData = null; byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveVarchar data type range so converted to null.", e); } } }
public static LazyHiveVarcharObjectInspector getLazyHiveVarcharObjectInspector( VarcharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveVarcharObjectInspector result = (LazyHiveVarcharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveVarcharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveVarcharObjectInspector) prev; } } return result; }
@Override public String toString() { return getTypeName(); } }
public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) { super(oi); maxLength = ((VarcharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveVarcharWritable(); }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { Text textData = data.getTextValue(); // This is doing a lot of copying here, this could be improved by enforcing length // at the same time as escaping rather than as separate steps. LazyUtils.copyAndEscapeStringDataToText(bytes.getData(), start, length, oi.getEscapeChar(),textData); data.set(textData.toString(), maxLength); isNull = false; } else { try { String byteData = null; byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveVarchar data type range so converted to null.", e); } } }
public static LazyHiveVarcharObjectInspector getLazyHiveVarcharObjectInspector( VarcharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveVarcharObjectInspector result = (LazyHiveVarcharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveVarcharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveVarcharObjectInspector) prev; } } return result; }
@Override public String toString() { return getTypeName(); } }
public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) { super(oi); maxLength = ((VarcharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveVarcharWritable(); }
@Override public void init(ByteArrayRef bytes, int start, int length) { if (oi.isEscaped()) { Text textData = data.getTextValue(); // This is doing a lot of copying here, this could be improved by enforcing length // at the same time as escaping rather than as separate steps. LazyUtils.copyAndEscapeStringDataToText(bytes.getData(), start, length, oi.getEscapeChar(),textData); data.set(textData.toString(), maxLength); isNull = false; } else { try { String byteData = null; byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveVarchar data type range so converted to null.", e); } } }
public static LazyHiveVarcharObjectInspector getLazyHiveVarcharObjectInspector( VarcharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveVarcharObjectInspector result = (LazyHiveVarcharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveVarcharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveVarcharObjectInspector) prev; } } return result; }
public LazyHiveVarchar(LazyHiveVarcharObjectInspector oi) { super(oi); maxLength = ((VarcharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveVarcharWritable(); }