Returns the n th (0-based) input to a join expression.
(
SqlSelect query,
int ordinal)
| 125 | * Returns the <code>n</code>th (0-based) input to a join expression. |
| 126 | */ |
| 127 | public static SqlNode getFromNode( |
| 128 | SqlSelect query, |
| 129 | int ordinal) { |
| 130 | SqlNode from = query.getFrom(); |
| 131 | if (from == null) { |
| 132 | throw new AssertionError("from must not be null for " + query); |
| 133 | } |
| 134 | ArrayList<SqlNode> list = flatten(from); |
| 135 | return list.get(ordinal); |
| 136 | } |
| 137 | |
| 138 | private static void flatten( |
| 139 | SqlNode node, |