public static Block createTestBlock() { BlockBuilder blockBuilder = INTERVAL_DAY_TIME.createBlockBuilder(null, 15); INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111); INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111); INTERVAL_DAY_TIME.writeLong(blockBuilder, 1111); INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222); INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222); INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222); INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222); INTERVAL_DAY_TIME.writeLong(blockBuilder, 2222); INTERVAL_DAY_TIME.writeLong(blockBuilder, 3333); INTERVAL_DAY_TIME.writeLong(blockBuilder, 3333); INTERVAL_DAY_TIME.writeLong(blockBuilder, 4444); return blockBuilder.build(); }
@OutputFunction(StandardTypes.INTERVAL_DAY_TO_SECOND) public static void output(LongAndDoubleState state, BlockBuilder out) { long count = state.getLong(); if (count == 0) { out.appendNull(); } else { double value = state.getDouble(); INTERVAL_DAY_TIME.writeLong(out, round(value / count)); } } }
return timestampWithTimeZoneFormat.parse((String) value, ZonedDateTime::from); else if (INTERVAL_DAY_TIME.equals(type)) { return new SqlIntervalDayTime(IntervalDayTime.parseMillis(String.valueOf(value)));
@SqlType(StandardTypes.BOOLEAN) public static boolean isDistinctFrom( @BlockPosition @SqlType(value = StandardTypes.INTERVAL_DAY_TO_SECOND, nativeContainerType = long.class) Block left, @BlockIndex int leftPosition, @BlockPosition @SqlType(value = StandardTypes.INTERVAL_DAY_TO_SECOND, nativeContainerType = long.class) Block right, @BlockIndex int rightPosition) { if (left.isNull(leftPosition) != right.isNull(rightPosition)) { return true; } if (left.isNull(leftPosition)) { return false; } return notEqual(INTERVAL_DAY_TIME.getLong(left, leftPosition), INTERVAL_DAY_TIME.getLong(right, rightPosition)); } }
return timestampWithTimeZoneFormat.parse((String) value, ZonedDateTime::from); else if (INTERVAL_DAY_TIME.equals(type)) { return new SqlIntervalDayTime(IntervalDayTime.parseMillis(String.valueOf(value)));
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = INTERVAL_DAY_TIME.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { INTERVAL_DAY_TIME.writeLong(blockBuilder, i * 1000); } return new Block[] {blockBuilder.build()}; }
@Override public Block[] getSequenceBlocks(int start, int length) { BlockBuilder blockBuilder = INTERVAL_DAY_TIME.createBlockBuilder(null, length); for (int i = start; i < start + length; i++) { INTERVAL_DAY_TIME.writeLong(blockBuilder, i * 250); } return new Block[] {blockBuilder.build()}; }