private static Expression bigint(long value) { return new Cast(new LongLiteral(String.valueOf(value)), BIGINT.toString()); }
private static Expression bigint(long value) { return new Cast(new LongLiteral(String.valueOf(value)), BIGINT.toString()); }
private PlanNode rewriteToDefaultAggregation(ApplyNode parent, Context context) { Symbol count = context.getSymbolAllocator().newSymbol(COUNT.toString(), BIGINT); Symbol exists = getOnlyElement(parent.getSubqueryAssignments().getSymbols()); return new LateralJoinNode( parent.getId(), parent.getInput(), new ProjectNode( context.getIdAllocator().getNextId(), new AggregationNode( context.getIdAllocator().getNextId(), parent.getSubquery(), ImmutableMap.of(count, new Aggregation(COUNT_CALL, countSignature, Optional.empty())), globalAggregation(), ImmutableList.of(), AggregationNode.Step.SINGLE, Optional.empty(), Optional.empty()), Assignments.of(exists, new ComparisonExpression(GREATER_THAN, count.toSymbolReference(), new Cast(new LongLiteral("0"), BIGINT.toString())))), parent.getCorrelation(), INNER, parent.getOriginSubquery()); } }
private PlanNode rewriteToDefaultAggregation(ApplyNode parent, Context context) { Symbol count = context.getSymbolAllocator().newSymbol(COUNT.toString(), BIGINT); Symbol exists = getOnlyElement(parent.getSubqueryAssignments().getSymbols()); return new LateralJoinNode( parent.getId(), parent.getInput(), new ProjectNode( context.getIdAllocator().getNextId(), new AggregationNode( context.getIdAllocator().getNextId(), parent.getSubquery(), ImmutableMap.of(count, new Aggregation(COUNT_CALL, countSignature, Optional.empty())), globalAggregation(), ImmutableList.of(), AggregationNode.Step.SINGLE, Optional.empty(), Optional.empty()), Assignments.of(exists, new ComparisonExpression(GREATER_THAN, count.toSymbolReference(), new Cast(new LongLiteral("0"), BIGINT.toString())))), parent.getCorrelation(), INNER, parent.getOriginSubquery()); } }
@Test void testNonImplictCastOnSymbolSide() { // we expect TupleDomain.all here(). // see comment in DomainTranslator.Visitor.visitComparisonExpression() assertUnsupportedPredicate(equal( new Cast(C_TIMESTAMP.toSymbolReference(), DATE.toString()), toExpression(DATE_VALUE, DATE))); assertUnsupportedPredicate(equal( new Cast(C_DECIMAL_12_2.toSymbolReference(), BIGINT.toString()), bigintLiteral(135L))); }
@Test void testNonImplictCastOnSymbolSide() { // we expect TupleDomain.all here(). // see comment in DomainTranslator.Visitor.visitComparisonExpression() assertUnsupportedPredicate(equal( new Cast(C_TIMESTAMP.toSymbolReference(), DATE.toString()), toExpression(DATE_VALUE, DATE))); assertUnsupportedPredicate(equal( new Cast(C_DECIMAL_12_2.toSymbolReference(), BIGINT.toString()), bigintLiteral(135L))); }