public static LazyHiveCharObjectInspector getLazyHiveCharObjectInspector( CharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveCharObjectInspector result = (LazyHiveCharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveCharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveCharObjectInspector) 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 { String byteData = null; try { byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveChar data type range so converted to null.", e); } } }
public LazyHiveChar(LazyHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
@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 { String byteData = null; try { byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveChar data type range so converted to null.", e); } } }
poi = new LazyHiveCharObjectInspector((CharTypeInfo) typeInfo); break; case VARCHAR:
public LazyHiveChar(LazyHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
@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 { String byteData = null; try { byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveChar data type range so converted to null.", e); } } }
public static LazyHiveCharObjectInspector getLazyHiveCharObjectInspector( CharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveCharObjectInspector result = (LazyHiveCharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveCharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveCharObjectInspector) prev; } } return result; }
public LazyHiveChar(LazyHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
@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 { String byteData = null; try { byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveChar data type range so converted to null.", e); } } }
public static LazyHiveCharObjectInspector getLazyHiveCharObjectInspector( CharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveCharObjectInspector result = (LazyHiveCharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveCharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveCharObjectInspector) prev; } } return result; }
public LazyHiveChar(LazyHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }
@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 { String byteData = null; try { byteData = Text.decode(bytes.getData(), start, length); data.set(byteData, maxLength); isNull = false; } catch (CharacterCodingException e) { isNull = true; LOG.debug("Data not in the HiveChar data type range so converted to null.", e); } } }
public static LazyHiveCharObjectInspector getLazyHiveCharObjectInspector( CharTypeInfo typeInfo, boolean escaped, byte escapeChar) { ArrayList<Object> signature = new ArrayList<Object>(); signature.add(typeInfo); signature.add(Boolean.valueOf(escaped)); signature.add(Byte.valueOf(escapeChar)); LazyHiveCharObjectInspector result = (LazyHiveCharObjectInspector) cachedLazyStringTypeOIs .get(signature); if (result == null) { result = new LazyHiveCharObjectInspector(typeInfo, escaped, escapeChar); AbstractPrimitiveLazyObjectInspector<?> prev = cachedLazyStringTypeOIs.putIfAbsent(signature, result); if (prev != null) { result = (LazyHiveCharObjectInspector) prev; } } return result; }
public LazyHiveChar(LazyHiveCharObjectInspector oi) { super(oi); maxLength = ((CharTypeInfo)oi.getTypeInfo()).getLength(); data = new HiveCharWritable(); }