use of io.prestosql.spi.connector.InMemoryRecordSet in project hetu-core by openlookeng.
the class TestFieldSetFilteringRecordSet method test.
@Test
public void test() {
ArrayType arrayOfBigintType = new ArrayType(BIGINT);
FieldSetFilteringRecordSet fieldSetFilteringRecordSet = new FieldSetFilteringRecordSet(createTestMetadataManager().getFunctionAndTypeManager(), new InMemoryRecordSet(ImmutableList.of(BIGINT, BIGINT, TIMESTAMP_WITH_TIME_ZONE, TIMESTAMP_WITH_TIME_ZONE, arrayOfBigintType, arrayOfBigintType), ImmutableList.of(ImmutableList.of(100L, 100L, // test same time in different time zone to make sure equal check was done properly
packDateTimeWithZone(100, getTimeZoneKeyForOffset(123)), packDateTimeWithZone(100, getTimeZoneKeyForOffset(234)), // test structural type
arrayBlockOf(BIGINT, 12, 34, 56), arrayBlockOf(BIGINT, 12, 34, 56)))), ImmutableList.of(ImmutableSet.of(0, 1), ImmutableSet.of(2, 3), ImmutableSet.of(4, 5)));
RecordCursor recordCursor = fieldSetFilteringRecordSet.cursor();
assertTrue(recordCursor.advanceNextPosition());
}
use of io.prestosql.spi.connector.InMemoryRecordSet in project hetu-core by openlookeng.
the class TestFieldSetFilteringRecordSet method testMultipleFieldRecordSet.
@Test
public void testMultipleFieldRecordSet() {
ArrayType arrayOfBigintType = new ArrayType(BIGINT);
FieldSetFilteringRecordSet fieldSetFilteringRecordSet = new FieldSetFilteringRecordSet(createTestMetadataManager().getFunctionAndTypeManager(), new InMemoryRecordSet(ImmutableList.of(BIGINT, BIGINT, TIMESTAMP_WITH_TIME_ZONE, TIMESTAMP_WITH_TIME_ZONE, arrayOfBigintType, arrayOfBigintType), ImmutableList.of(ImmutableList.of(100L, 100L, // test same time in different time zone to make sure equal check was done properly
packDateTimeWithZone(100, getTimeZoneKeyForOffset(123)), packDateTimeWithZone(100, getTimeZoneKeyForOffset(234)), // test structural type
arrayBlockOf(BIGINT, 12, 34, 56), arrayBlockOf(BIGINT, 12, 34, 56)), ImmutableList.of(200L, 200L, // test same time in different time zone to make sure equal check was done properly
packDateTimeWithZone(100, getTimeZoneKeyForOffset(123)), packDateTimeWithZone(100, getTimeZoneKeyForOffset(234)), // test structural type
arrayBlockOf(BIGINT, 12, 34, 56), arrayBlockOf(BIGINT, 12, 34, 56)))), ImmutableList.of(ImmutableSet.of(0, 1), ImmutableSet.of(2, 3), ImmutableSet.of(4, 5)));
RecordCursor recordCursor = fieldSetFilteringRecordSet.cursor();
assertTrue(recordCursor.advanceNextPosition());
}
use of io.prestosql.spi.connector.InMemoryRecordSet in project boostkit-bigdata by kunpengcompute.
the class HiveMetadata method getPropertiesSystemTable.
private Optional<SystemTable> getPropertiesSystemTable(ConnectorSession session, SchemaTableName tableName, SchemaTableName sourceTableName) {
Optional<Table> table = metastore.getTable(new HiveIdentity(session), sourceTableName.getSchemaName(), sourceTableName.getTableName());
if (!table.isPresent() || table.get().getTableType().equals(TableType.VIRTUAL_VIEW.name())) {
throw new TableNotFoundException(tableName);
}
Map<String, String> sortedTableParameters = ImmutableSortedMap.copyOf(table.get().getParameters());
List<ColumnMetadata> columns = sortedTableParameters.keySet().stream().map(key -> new ColumnMetadata(key, VarcharType.VARCHAR)).collect(toImmutableList());
List<Type> types = columns.stream().map(ColumnMetadata::getType).collect(toImmutableList());
Iterable<List<Object>> propertyValues = ImmutableList.of(ImmutableList.copyOf(sortedTableParameters.values()));
return Optional.of(createSystemTable(new ConnectorTableMetadata(sourceTableName, columns), constraint -> new InMemoryRecordSet(types, propertyValues).cursor()));
}
Aggregations