use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestRecordAccess method testStreamExists.
@Test
public void testStreamExists() {
QualifiedObjectName name = new QualifiedObjectName("kinesis", "default", dummyStreamName);
transaction(queryRunner.getTransactionManager(), new AllowAllAccessControl()).singleStatement().execute(SESSION, session -> {
Optional<TableHandle> handle = queryRunner.getServer().getMetadata().getTableHandle(session, name);
assertTrue(handle.isPresent());
});
log.info("Completed first test (access table handle)");
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class TestQuerySessionSupplier method createSessionSupplier.
private static QuerySessionSupplier createSessionSupplier(SqlEnvironmentConfig config) {
TransactionManager transactionManager = createTestTransactionManager();
Metadata metadata = testMetadataManagerBuilder().withTransactionManager(transactionManager).build();
return new QuerySessionSupplier(metadata, new AllowAllAccessControl(), new SessionPropertyManager(), config);
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class ValuesStatsRule method getSymbolValues.
private List<Object> getSymbolValues(ValuesNode valuesNode, int symbolId, Session session, Type rowType) {
Type symbolType = rowType.getTypeParameters().get(symbolId);
if (UNKNOWN.equals(symbolType)) {
// special casing for UNKNOWN as evaluateConstantExpression does not handle that
return IntStream.range(0, valuesNode.getRowCount()).mapToObj(rowId -> null).collect(toList());
}
checkState(valuesNode.getRows().isPresent(), "rows is empty");
return valuesNode.getRows().get().stream().map(row -> {
Object rowValue = evaluateConstantExpression(row, rowType, plannerContext, session, new AllowAllAccessControl(), ImmutableMap.of());
return readNativeValue(symbolType, (SingleRowBlock) rowValue, symbolId);
}).collect(toList());
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class SimplifyCountOverConstant method isCountOverConstant.
private boolean isCountOverConstant(Session session, AggregationNode.Aggregation aggregation, Assignments inputs) {
BoundSignature signature = aggregation.getResolvedFunction().getSignature();
if (!signature.getName().equals("count") || signature.getArgumentTypes().size() != 1) {
return false;
}
Expression argument = aggregation.getArguments().get(0);
if (argument instanceof SymbolReference) {
argument = inputs.get(Symbol.from(argument));
}
if (isEffectivelyLiteral(plannerContext, session, argument)) {
Object value = evaluateConstantExpression(argument, ImmutableMap.of(), ImmutableSet.of(), plannerContext, session, new AllowAllAccessControl(), ImmutableSet.of(), ImmutableMap.of());
verify(!(value instanceof Expression));
return value != null;
}
return false;
}
use of io.trino.security.AllowAllAccessControl in project trino by trinodb.
the class ExpressionUtils method getExpressionTypes.
/**
* @deprecated Use {@link io.trino.sql.planner.TypeAnalyzer#getTypes(Session, TypeProvider, Expression)}.
*/
@Deprecated
public static Map<NodeRef<Expression>, Type> getExpressionTypes(PlannerContext plannerContext, Session session, Expression expression, TypeProvider types) {
ExpressionAnalyzer expressionAnalyzer = ExpressionAnalyzer.createWithoutSubqueries(plannerContext, new AllowAllAccessControl(), session, types, ImmutableMap.of(), node -> new IllegalStateException("Unexpected node: " + node), WarningCollector.NOOP, false);
expressionAnalyzer.analyze(expression, Scope.create());
return expressionAnalyzer.getExpressionTypes();
}
Aggregations