use of io.trino.spi.connector.SchemaTableName in project trino by trinodb.
the class TestHiveMetadata method testCreatePredicateWithNaN.
@Test
public void testCreatePredicateWithNaN() {
HiveColumnHandle columnHandle = DOUBLE_COLUMN_HANDLE;
ImmutableList.Builder<HivePartition> partitions = ImmutableList.builder();
partitions.add(new HivePartition(new SchemaTableName("test", "test"), "p1", ImmutableMap.of(columnHandle, NullableValue.of(DOUBLE, Double.NaN))));
partitions.add(new HivePartition(new SchemaTableName("test", "test"), "p2", ImmutableMap.of(columnHandle, NullableValue.of(DOUBLE, 4.2))));
Domain domain = createPredicate(ImmutableList.of(columnHandle), partitions.build()).getDomains().orElseThrow().get(columnHandle);
assertEquals(domain, Domain.notNull(DOUBLE));
}
use of io.trino.spi.connector.SchemaTableName in project trino by trinodb.
the class TestHiveMetadata method testCreatePredicate.
@Test(timeOut = 10_000)
public void testCreatePredicate() {
ImmutableList.Builder<HivePartition> partitions = ImmutableList.builder();
for (int i = 0; i < 5_000; i++) {
partitions.add(new HivePartition(new SchemaTableName("test", "test"), Integer.toString(i), ImmutableMap.of(TEST_COLUMN_HANDLE, NullableValue.of(VARCHAR, utf8Slice(Integer.toString(i))))));
}
Domain domain = createPredicate(ImmutableList.of(TEST_COLUMN_HANDLE), partitions.build()).getDomains().orElseThrow().get(TEST_COLUMN_HANDLE);
assertEquals(domain, Domain.create(ValueSet.copyOf(VARCHAR, IntStream.range(0, 5_000).mapToObj(i -> utf8Slice(Integer.toString(i))).collect(toImmutableList())), false));
}
use of io.trino.spi.connector.SchemaTableName in project trino by trinodb.
the class TestHiveMetadata method testCreateOnlyNullsPredicate.
@Test
public void testCreateOnlyNullsPredicate() {
ImmutableList.Builder<HivePartition> partitions = ImmutableList.builder();
for (int i = 0; i < 5; i++) {
partitions.add(new HivePartition(new SchemaTableName("test", "test"), Integer.toString(i), ImmutableMap.of(TEST_COLUMN_HANDLE, NullableValue.asNull(VARCHAR))));
}
Domain domain = createPredicate(ImmutableList.of(TEST_COLUMN_HANDLE), partitions.build()).getDomains().orElseThrow().get(TEST_COLUMN_HANDLE);
assertEquals(domain, Domain.onlyNull(VARCHAR));
}
use of io.trino.spi.connector.SchemaTableName in project trino by trinodb.
the class TestPartitionOfflineException method testMessage.
@Test
public void testMessage() {
assertMessage(new SchemaTableName("schema", "table"), "pk=1", false, "", "Table 'schema.table' partition 'pk=1' is offline");
assertMessage(new SchemaTableName("schema", "table"), "pk=1", false, null, "Table 'schema.table' partition 'pk=1' is offline");
assertMessage(new SchemaTableName("schema", "table"), "pk=1", true, "", "Table 'schema.table' partition 'pk=1' is offline for Presto");
assertMessage(new SchemaTableName("schema", "table"), "pk=1", true, null, "Table 'schema.table' partition 'pk=1' is offline for Presto");
assertMessage(new SchemaTableName("schema", "table"), "pk=1", false, "offline reason", "Table 'schema.table' partition 'pk=1' is offline: offline reason");
assertMessage(new SchemaTableName("schema", "table"), "pk=1", true, "offline reason", "Table 'schema.table' partition 'pk=1' is offline for Presto: offline reason");
}
use of io.trino.spi.connector.SchemaTableName in project trino by trinodb.
the class TestingMetadata method getColumnMetadata.
@Override
public ColumnMetadata getColumnMetadata(ConnectorSession session, ConnectorTableHandle tableHandle, ColumnHandle columnHandle) {
SchemaTableName tableName = getTableName(tableHandle);
int columnIndex = ((TestingColumnHandle) columnHandle).getOrdinalPosition();
return tables.get(tableName).getColumns().get(columnIndex);
}
Aggregations