Skip to content

Commit

Permalink
Revert "Fix IllegalArgumentException in RelationPlanner"
Browse files Browse the repository at this point in the history
This reverts commit dd7dad9.
  • Loading branch information
Ying Su authored and caithagoras0 committed Sep 17, 2020
1 parent d79804d commit 77c442c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,11 @@ protected RelationPlan visitValues(Values node, Void context)

private RowExpression rewriteRow(Expression row)
{
Expression expression = Coercer.addCoercions(row, analysis);
expression = ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters(), analysis), expression);

// resolve enum literals
Expression expression = ExpressionTreeRewriter.rewriteWith(new ExpressionRewriter<Void>() {
expression = ExpressionTreeRewriter.rewriteWith(new ExpressionRewriter<Void>() {
@Override
public Expression rewriteDereferenceExpression(DereferenceExpression node, Void context, ExpressionTreeRewriter<Void> treeRewriter)
{
Expand All @@ -701,9 +704,7 @@ public Expression rewriteDereferenceExpression(DereferenceExpression node, Void
}
return node;
}
}, row);
expression = Coercer.addCoercions(expression, analysis);
expression = ExpressionTreeRewriter.rewriteWith(new ParameterRewriter(analysis.getParameters(), analysis), expression);
}, expression);
return castToRowExpression(expression);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,6 @@ public void testRowFieldAccessor()
assertQuery("SELECT a.col1[2].col0, a.col1[2].col1 FROM (VALUES ROW(cast(row(1.0, ARRAY[row(31, 4.1E0), row(32, 4.2E0)], row(3, 4.0E0)) AS ROW(col0 double, col1 array(row(col0 integer, col1 double)), col2 row(col0 integer, col1 double))))) t(a)", "SELECT 32, 4.2");

assertQuery("SELECT CAST(row(11, 12) AS row(col0 bigint, col1 bigint)).col0", "SELECT 11");

// Dereference in VALUES node
assertQuery("SELECT v FROM ( VALUES (ARRAY[ CAST( ROW(2, 'a') AS ROW( int_field BIGINT, str_field VARCHAR ) )][1].str_field)) AS t (v)", "SELECT 'a'");
}

@Test
Expand Down

0 comments on commit 77c442c

Please sign in to comment.