@Test public void buildListOfColumnParseNodesTest() throws Exception { List<ParseNode> children = new ArrayList<>(); ColumnParseNode col1 = new ColumnParseNode(TABLE_NAME,"col1"); ColumnParseNode col2 = new ColumnParseNode(TABLE_NAME,"col2"); children.add(col1); children.add(col2); RowValueConstructorParseNode rvc = new RowValueConstructorParseNode(children); List<ColumnParseNode> result = offsetCompiler.buildListOfColumnParseNodes(rvc, true); assertEquals(2,result.size()); assertEquals(col1,result.get(0)); assertEquals(col2,result.get(1)); }
@VisibleForTesting List<ColumnParseNode> buildListOfColumnParseNodes( RowValueConstructorParseNode rvcColumnsParseNode, boolean isIndex) throws RowValueConstructorOffsetNotCoercibleException { List<ColumnParseNode> nodes = new ArrayList<ColumnParseNode>(); for (ParseNode node : rvcColumnsParseNode.getChildren()) { if (isIndex) { if (node instanceof CastParseNode) { node = node.getChildren().get(0); } } if (!(node instanceof ColumnParseNode)) { throw new RowValueConstructorOffsetNotCoercibleException( "RVC Offset must specify the tables PKs."); } else { nodes.add((ColumnParseNode) node); } } return nodes; }
RVCOffsetCompiler { @VisibleForTesting List<ColumnParseNode> buildListOfColumnParseNodes( RowValueConstructorParseNode rvcColumnsParseNode, boolean isIndex) throws RowValueConstructorOffsetNotCoercibleException { List<ColumnParseNode> nodes = new ArrayList<ColumnParseNode>(); for (ParseNode node : rvcColumnsParseNode.getChildren()) { if (isIndex) { if (node instanceof CastParseNode) { node = node.getChildren().get(0); } } if (!(node instanceof ColumnParseNode)) { throw new RowValueConstructorOffsetNotCoercibleException( "RVC Offset must specify the tables PKs."); } else { nodes.add((ColumnParseNode) node); } } return nodes; } }
RVCOffsetCompiler { @VisibleForTesting List<ColumnParseNode> buildListOfColumnParseNodes( RowValueConstructorParseNode rvcColumnsParseNode, boolean isIndex) throws RowValueConstructorOffsetNotCoercibleException { List<ColumnParseNode> nodes = new ArrayList<ColumnParseNode>(); for (ParseNode node : rvcColumnsParseNode.getChildren()) { if (isIndex) { if (node instanceof CastParseNode) { node = node.getChildren().get(0); } } if (!(node instanceof ColumnParseNode)) { throw new RowValueConstructorOffsetNotCoercibleException( "RVC Offset must specify the tables PKs."); } else { nodes.add((ColumnParseNode) node); } } return nodes; } private  RVCOffsetCompiler(); }
RVCOffsetCompiler { @VisibleForTesting List<ColumnParseNode> buildListOfColumnParseNodes( RowValueConstructorParseNode rvcColumnsParseNode, boolean isIndex) throws RowValueConstructorOffsetNotCoercibleException { List<ColumnParseNode> nodes = new ArrayList<ColumnParseNode>(); for (ParseNode node : rvcColumnsParseNode.getChildren()) { if (isIndex) { if (node instanceof CastParseNode) { node = node.getChildren().get(0); } } if (!(node instanceof ColumnParseNode)) { throw new RowValueConstructorOffsetNotCoercibleException( "RVC Offset must specify the tables PKs."); } else { nodes.add((ColumnParseNode) node); } } return nodes; } private  RVCOffsetCompiler(); static RVCOffsetCompiler getInstance(); CompiledOffset getRVCOffset(StatementContext context, FilterableStatement statement,
            boolean inJoin, boolean inUnion, OffsetNode offsetNode); }
RVCOffsetCompiler { @VisibleForTesting List<ColumnParseNode> buildListOfColumnParseNodes( RowValueConstructorParseNode rvcColumnsParseNode, boolean isIndex) throws RowValueConstructorOffsetNotCoercibleException { List<ColumnParseNode> nodes = new ArrayList<ColumnParseNode>(); for (ParseNode node : rvcColumnsParseNode.getChildren()) { if (isIndex) { if (node instanceof CastParseNode) { node = node.getChildren().get(0); } } if (!(node instanceof ColumnParseNode)) { throw new RowValueConstructorOffsetNotCoercibleException( "RVC Offset must specify the tables PKs."); } else { nodes.add((ColumnParseNode) node); } } return nodes; } private  RVCOffsetCompiler(); static RVCOffsetCompiler getInstance(); CompiledOffset getRVCOffset(StatementContext context, FilterableStatement statement,
            boolean inJoin, boolean inUnion, OffsetNode offsetNode);  }