private static int parseDate(Slice slice, int offset, int length) { long millis = HIVE_DATE_PARSER.parseMillis(slice.toStringAscii(offset, length)); return toIntExact(MILLISECONDS.toDays(millis)); } }
private static double parseDouble(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Double.parseDouble(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid double value"); } } }
private static float parseFloat(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Float.parseFloat(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid float value"); } } }
@Override public long getLong() { long millis = FORMATTER.parseMillis(getSlice().toStringAscii()); Type type = columnHandle.getType(); if (type.equals(DATE)) { return MILLISECONDS.toDays(millis); } if (type.equals(TIMESTAMP) || type.equals(TIME)) { return millis; } if (type.equals(TIMESTAMP_WITH_TIME_ZONE) || type.equals(TIME_WITH_TIME_ZONE)) { return packDateTimeWithZone(millis, 0); } return millis; } }
private Comparable<?> getPrestoValue(RecordCursor recordCursor, List<Column> columns, int columnId) { if (recordCursor.isNull(columnId)) { return null; } Column column = columns.get(columnId); ColumnType.Base baseType = column.getType().getBase(); switch (baseType) { case IDENTIFIER: case INTEGER: case DATE: case TIME: case DECIMAL: return recordCursor.getLong(columnId); case VARCHAR: case CHAR: return recordCursor.getSlice(columnId).toStringAscii(); } throw new UnsupportedOperationException(format("Unsupported TPCDS base type [%s]", baseType)); } }
ImmutableSet.of("a", "c").contains(VARCHAR.getSlice(rightPage.getBlock(0), rightPosition).toStringAscii())));
(leftPosition, leftPage, rightPosition, rightPage) -> VARCHAR.getSlice(rightPage.getBlock(0), rightPosition).toStringAscii().equals("a")));
ImmutableSet.of("a", "c").contains(VARCHAR.getSlice(rightPage.getBlock(0), rightPosition).toStringAscii())));
/** * Decodes the contents of this slice into a string using the US_ASCII * character set. The low order 7 bits if each byte are converted directly * into a code point for the string. */ public String toStringAscii() { return toStringAscii(0, size); }
/** * Decodes the contents of this slice into a string using the US_ASCII * character set. The low order 7 bits if each byte are converted directly * into a code point for the string. */ public String toStringAscii() { return toStringAscii(0, size); }
private static int parseDate(Slice slice, int offset, int length) { long millis = HIVE_DATE_PARSER.parseMillis(slice.toStringAscii(offset, length)); return toIntExact(MILLISECONDS.toDays(millis)); } }
private static double parseDouble(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Double.parseDouble(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid double value"); } } }
private static float parseFloat(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Float.parseFloat(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid float value"); } } }
private static int parseDate(Slice slice, int offset, int length) { long millis = HIVE_DATE_PARSER.parseMillis(slice.toStringAscii(offset, length)); return toIntExact(MILLISECONDS.toDays(millis)); } }
private static double parseDouble(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Double.parseDouble(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid double value"); } } }
private static float parseFloat(Slice slice, int start, int length) throws RcFileCorruptionException { try { return Float.parseFloat(slice.toStringAscii(start, length)); } catch (NumberFormatException e) { throw new RcFileCorruptionException(e, "Invalid float value"); } } }
@Override public long getLong() { long millis = FORMATTER.parseMillis(getSlice().toStringAscii()); Type type = columnHandle.getType(); if (type.equals(DATE)) { return MILLISECONDS.toDays(millis); } if (type.equals(TIMESTAMP) || type.equals(TIME)) { return millis; } if (type.equals(TIMESTAMP_WITH_TIME_ZONE) || type.equals(TIME_WITH_TIME_ZONE)) { return packDateTimeWithZone(millis, 0); } return millis; } }
private Comparable<?> getPrestoValue(RecordCursor recordCursor, List<Column> columns, int columnId) { if (recordCursor.isNull(columnId)) { return null; } Column column = columns.get(columnId); ColumnType.Base baseType = column.getType().getBase(); switch (baseType) { case IDENTIFIER: case INTEGER: case DATE: case TIME: case DECIMAL: return recordCursor.getLong(columnId); case VARCHAR: case CHAR: return recordCursor.getSlice(columnId).toStringAscii(); } throw new UnsupportedOperationException(format("Unsupported TPCDS base type [%s]", baseType)); } }
private Comparable<?> getPrestoValue(RecordCursor recordCursor, List<Column> columns, int columnId) { if (recordCursor.isNull(columnId)) { return null; } Column column = columns.get(columnId); ColumnType.Base baseType = column.getType().getBase(); switch (baseType) { case IDENTIFIER: case INTEGER: case DATE: case TIME: case DECIMAL: return recordCursor.getLong(columnId); case VARCHAR: case CHAR: return recordCursor.getSlice(columnId).toStringAscii(); } throw new UnsupportedOperationException(format("Unsupported TPCDS base type [%s]", baseType)); } }
private Comparable<?> getPrestoValue(RecordCursor recordCursor, List<Column> columns, int columnId) { if (recordCursor.isNull(columnId)) { return null; } Column column = columns.get(columnId); ColumnType.Base baseType = column.getType().getBase(); switch (baseType) { case IDENTIFIER: case INTEGER: case DATE: case TIME: case DECIMAL: return recordCursor.getLong(columnId); case VARCHAR: case CHAR: return recordCursor.getSlice(columnId).toStringAscii(); } throw new UnsupportedOperationException(format("Unsupported TPCDS base type [%s]", baseType)); } }