提交 e7340f90 编写于 作者: J Juan Pan(Trista) 提交者: GitHub

support using limit pagination (#4222)

* add more tests for order-by and or sql

* support using limit pagination
上级 0d5bdd22
......@@ -31,6 +31,9 @@ import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.FromCla
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InsertContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.InsertValuesClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.JoinedTableContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.LimitClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.LimitOffsetContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.LimitRowCountContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.MultipleTableNamesContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.MultipleTablesClauseContext;
import org.apache.shardingsphere.sql.parser.autogen.MySQLStatementParser.OnDuplicateKeyClauseContext;
......@@ -65,6 +68,10 @@ import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ProjectionSegme
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ProjectionsSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.item.ShorthandProjectionSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.order.OrderBySegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.PaginationValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.LimitSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.NumberLiteralLimitValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.pagination.limit.ParameterMarkerLimitValueSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.AndPredicate;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.OrPredicateSegment;
import org.apache.shardingsphere.sql.parser.sql.segment.dml.predicate.PredicateSegment;
......@@ -74,9 +81,11 @@ import org.apache.shardingsphere.sql.parser.sql.statement.dml.DeleteStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.InsertStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.sql.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.BooleanLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.BooleanLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.NumberLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.literal.impl.StringLiteralValue;
import org.apache.shardingsphere.sql.parser.sql.value.parametermarker.ParameterMarkerValue;
import java.util.Collection;
import java.util.LinkedList;
......@@ -285,6 +294,9 @@ public final class MySQLDMLVisitor extends MySQLVisitor {
result.setOrderBy(orderBy);
result.getAllSQLSegments().add(orderBy);
}
if (null != ctx.limitClause()) {
result.getAllSQLSegments().add((LimitSegment) visit(ctx.limitClause()));
}
return result;
}
......@@ -436,4 +448,37 @@ public final class MySQLDMLVisitor extends MySQLVisitor {
result.setParametersCount(getCurrentParameterIndex());
return result;
}
@Override
public ASTNode visitLimitClause(final LimitClauseContext ctx) {
if (null == ctx.limitOffset()) {
return new LimitSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), null, (PaginationValueSegment) visit(ctx.limitRowCount()));
}
PaginationValueSegment rowCount;
PaginationValueSegment limitOffset;
if (null != ctx.OFFSET()) {
rowCount = (PaginationValueSegment) visit(ctx.limitRowCount());
limitOffset = (PaginationValueSegment) visit(ctx.limitOffset());
} else {
limitOffset = (PaginationValueSegment) visit(ctx.limitOffset());
rowCount = (PaginationValueSegment) visit(ctx.limitRowCount());
}
return new LimitSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), limitOffset, rowCount);
}
@Override
public ASTNode visitLimitRowCount(final LimitRowCountContext ctx) {
if (null != ctx.numberLiterals()) {
return new NumberLiteralLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ((NumberLiteralValue) visit(ctx.numberLiterals())).getValue().longValue());
}
return new ParameterMarkerLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ((ParameterMarkerValue) visit(ctx.parameterMarker())).getValue());
}
@Override
public ASTNode visitLimitOffset(final LimitOffsetContext ctx) {
if (null != ctx.numberLiterals()) {
return new NumberLiteralLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ((NumberLiteralValue) visit(ctx.numberLiterals())).getValue().longValue());
}
return new ParameterMarkerLimitValueSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), ((ParameterMarkerValue) visit(ctx.parameterMarker())).getValue());
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<sql-parser-test-cases>
<select sql-case-id="select_or_with_same_sharding_columns" parameters="1, 2">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="2" start-index="22" stop-index="55">
<and-predicate>
<predicate start-index="28" stop-index="39">
<column-left-value name="order_id" start-index="28" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="44" stop-index="55">
<column-left-value name="order_id" start-index="44" stop-index="51" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_with_different_sharding_columns" parameters="1, 2">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="2" start-index="22" stop-index="54">
<and-predicate>
<predicate start-index="28" stop-index="39">
<column-left-value name="order_id" start-index="28" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="44" stop-index="54">
<column-left-value name="user_id" start-index="44" stop-index="50" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_with_none_sharding_columns" parameters="1, 'init'">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="2" start-index="22" stop-index="53" literal-stop-index="58">
<and-predicate>
<predicate start-index="28" stop-index="39">
<column-left-value name="order_id" start-index="28" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="44" stop-index="53" literal-stop-index="58">
<column-left-value name="status" start-index="44" stop-index="49" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_mix_and_for_simple_pattern" parameters="1, 'init', 3">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="3" start-index="22" stop-index="71" literal-stop-index="76">
<and-predicate>
<predicate start-index="29" stop-index="40">
<column-left-value name="order_id" start-index="29" stop-index="36" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="61" stop-index="71" literal-start-index="66" literal-stop-index="76">
<column-left-value name="user_id" start-index="61" stop-index="67" literal-start-index="66" literal-stop-index="72" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="45" stop-index="54" literal-stop-index="59">
<column-left-value name="status" start-index="45" stop-index="50" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
<predicate start-index="61" stop-index="71" literal-start-index="66" literal-stop-index="76">
<column-left-value name="user_id" start-index="61" stop-index="67" literal-start-index="66" literal-stop-index="72" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_mix_and_for_complex_pattern" parameters="'init', 1, 2, 3, 4">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="5" start-index="22" stop-index="113" literal-stop-index="118">
<and-predicate>
<predicate start-index="30" stop-index="39" literal-stop-index="44">
<column-left-value name="status" start-index="30" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
<predicate start-index="46" stop-index="57" literal-start-index="51" literal-stop-index="62">
<column-left-value name="order_id" start-index="46" stop-index="53" literal-start-index="51" literal-stop-index="58" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="83" stop-index="93" literal-start-index="88" literal-stop-index="98">
<column-left-value name="user_id" start-index="83" stop-index="89" literal-start-index="88" literal-stop-index="94" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="3" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="30" stop-index="39" literal-stop-index="44">
<column-left-value name="status" start-index="30" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
<predicate start-index="46" stop-index="57" literal-start-index="51" literal-stop-index="62">
<column-left-value name="order_id" start-index="46" stop-index="53" literal-start-index="51" literal-stop-index="58" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="99" stop-index="109" literal-start-index="104" literal-stop-index="114">
<column-left-value name="user_id" start-index="99" stop-index="105" literal-start-index="104" literal-stop-index="110" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="4" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="30" stop-index="39" literal-stop-index="44">
<column-left-value name="status" start-index="30" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
<predicate start-index="63" stop-index="74" literal-start-index="68" literal-stop-index="79">
<column-left-value name="order_id" start-index="63" stop-index="70" literal-start-index="68" literal-stop-index="75" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
<predicate start-index="83" stop-index="93" literal-start-index="88" literal-stop-index="98">
<column-left-value name="user_id" start-index="83" stop-index="89" literal-start-index="88" literal-stop-index="94" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="3" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="30" stop-index="39" literal-stop-index="44">
<column-left-value name="status" start-index="30" stop-index="35" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
<predicate start-index="63" stop-index="74" literal-start-index="68" literal-stop-index="79">
<column-left-value name="order_id" start-index="63" stop-index="70" literal-start-index="68" literal-stop-index="75" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
<predicate start-index="99" stop-index="109" literal-start-index="104" literal-stop-index="114">
<column-left-value name="user_id" start-index="99" stop-index="105" literal-start-index="104" literal-stop-index="110" />
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="4" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_mix_and_with_binding_tables" parameters="1, 2, 3">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="31" stop-index="42" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="3" start-index="99" stop-index="156">
<and-predicate>
<predicate start-index="106" stop-index="119">
<column-left-value name="order_id" start-index="106" stop-index="115">
<owner name="o" start-index="106" stop-index="106" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="144" stop-index="156">
<column-left-value name="user_id" start-index="144" stop-index="152">
<owner name="o" start-index="144" stop-index="144" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="124" stop-index="137">
<column-left-value name="order_id" start-index="124" stop-index="133">
<owner name="o" start-index="124" stop-index="124" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
<predicate start-index="144" stop-index="156">
<column-left-value name="user_id" start-index="144" stop-index="152">
<owner name="o" start-index="144" stop-index="144" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
<select sql-case-id="select_or_mix_and_with_binding_and_broadcast_tables" parameters="1, 2, 3, 'init'">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="31" stop-index="42" />
<table name="t_broadcast_table" alias="c" start-index="104" stop-index="120" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="4" start-index="147" stop-index="221" literal-stop-index="226">
<and-predicate>
<predicate start-index="154" stop-index="167">
<column-left-value name="order_id" start-index="154" stop-index="163">
<owner name="o" start-index="154" stop-index="154" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="1" />
</compare-right-value>
</predicate>
<predicate start-index="192" stop-index="204">
<column-left-value name="user_id" start-index="192" stop-index="200">
<owner name="o" start-index="192" stop-index="192" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
<predicate start-index="210" stop-index="221" literal-stop-index="226">
<column-left-value name="status" start-index="210" stop-index="217">
<owner name="o" start-index="210" stop-index="210" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="3" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
</and-predicate>
<and-predicate>
<predicate start-index="172" stop-index="185">
<column-left-value name="order_id" start-index="172" stop-index="181">
<owner name="o" start-index="172" stop-index="172" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="1" />
<literal-expression value="2" />
</compare-right-value>
</predicate>
<predicate start-index="192" stop-index="204">
<column-left-value name="user_id" start-index="192" stop-index="200">
<owner name="o" start-index="192" stop-index="192" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="2" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
<predicate start-index="210" stop-index="221" literal-stop-index="226">
<column-left-value name="status" start-index="210" stop-index="217">
<owner name="o" start-index="210" stop-index="210" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="3" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
</select>
</sql-parser-test-cases>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<sql-parser-test-cases>
<select sql-case-id="select_order_by_asc_and_index_desc">
<table name="t_order" alias="o" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="33" stop-index="33" />
</column-item>
<index-item index="2" order-direction="DESC" />
</order-by>
</select>
<select sql-case-id="select_order_by_desc_and_index_asc">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="27" stop-index="38" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="0" start-index="42" stop-index="92">
<and-predicate>
<predicate start-index="48" stop-index="70">
<column-left-value name="order_id" start-index="48" stop-index="57">
<owner name="o" start-index="48" stop-index="48" />
</column-left-value>
<operator type="=" />
<column-right-value name="order_id" start-index="61" stop-index="70">
<owner name="i" start-index="61" stop-index="61" />
</column-right-value>
</predicate>
<predicate start-index="76" stop-index="92">
<column-left-value name="status" start-index="76" stop-index="83">
<owner name="o" start-index="76" stop-index="76" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="init" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="order_id" order-direction="DESC">
<owner name="o" start-index="103" stop-index="103" />
</column-item>
<index-item index="1" />
</order-by>
</select>
<select sql-case-id="select_order_by_with_ordered_column">
<table name="t_order" alias="o" start-index="40" stop-index="46" />
<projections start-index="7" stop-index="33">
<column-projection name="order_id" alias="gen_order_id_" start-index="7" stop-index="16">
<owner name="o" start-index="7" stop-index="7" />
</column-projection>
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="59" stop-index="59" />
</column-item>
</order-by>
</select>
<select sql-case-id="select_order_by_with_date">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="27" stop-index="38" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="0" start-index="42" stop-index="92">
<and-predicate>
<predicate start-index="48" stop-index="70">
<column-left-value name="order_id" start-index="48" stop-index="57">
<owner name="o" start-index="48" stop-index="48" />
</column-left-value>
<operator type="=" />
<column-right-value name="order_id" start-index="61" stop-index="70">
<owner name="i" start-index="61" stop-index="61" />
</column-right-value>
</predicate>
<predicate start-index="76" stop-index="92">
<column-left-value name="status" start-index="76" stop-index="83">
<owner name="o" start-index="76" stop-index="76" />
</column-left-value>
<operator type="=" />
<compare-right-value>
<literal-expression value="init" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="creation_date" order-direction="DESC">
<owner name="i" start-index="103" stop-index="103" />
</column-item>
<column-item name="order_id" order-direction="DESC">
<owner name="o" start-index="125" stop-index="125" />
</column-item>
<column-item name="item_id">
<owner name="i" start-index="142" stop-index="142" />
</column-item>
</order-by>
</select>
<!-- //TODO add order-by-null-type -->
<select sql-case-id="select_order_by_for_nulls_first">
<table name="t_order" alias="o" start-index="40" stop-index="46" />
<projections start-index="7" stop-index="33">
<column-projection name="order_id" alias="gen_order_id_" start-index="7" stop-index="16">
<owner name="o" start-index="7" stop-index="7" />
</column-projection>
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="59" stop-index="59" />
</column-item>
</order-by>
</select>
<!-- //TODO add order-by-null-type -->
<select sql-case-id="select_order_by_for_nulls_last">
<table name="t_order" alias="o" start-index="40" stop-index="46" />
<projections start-index="7" stop-index="33">
<column-projection name="order_id" alias="gen_order_id_" start-index="7" stop-index="16">
<owner name="o" start-index="7" stop-index="7" />
</column-projection>
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="59" stop-index="59" />
</column-item>
</order-by>
</select>
<select sql-case-id="select_order_by_with_multiple_stars">
<table name="t_order" alias="o" start-index="29" stop-index="35" />
<projections start-index="7" stop-index="22">
<shorthand-projection start-index="7" stop-index="7" />
<shorthand-projection start-index="20" stop-index="22">
<owner name="o" start-index="20" stop-index="20" />
</shorthand-projection>
<column-projection name="order_id" start-index="10" stop-index="17" />
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="48" stop-index="48" />
</column-item>
</order-by>
</select>
<select sql-case-id="select_order_by_with_alias_star_alias_name">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="o" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<order-by>
<column-item name="order_id">
<owner name="o" start-index="35" stop-index="35" />
</column-item>
</order-by>
</select>
<select sql-case-id="select_order_by_with_star_table_alias">
<table name="t_order" alias="o" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<order-by>
<column-item name="order_id" />
</order-by>
</select>
<!--TODO need to add later-->
<!--<select sql-case-id="select_order_by_with_parameter" parameters="order_id">-->
<!--<table name="t_order" alias="o" start-index="14" stop-index="20" />-->
<!--</select>-->
<select sql-case-id="select_order_by_with_table_star_table_name">
<table name="t_order" start-index="22" stop-index="28" />
<projections start-index="7" stop-index="15">
<shorthand-projection start-index="7" stop-index="15">
<owner name="t_order" start-index="7" stop-index="13" />
</shorthand-projection>
</projections>
<order-by>
<column-item name="order_id">
<owner name="t_order" start-index="39" stop-index="45" />
</column-item>
</order-by>
</select>
<select sql-case-id="select_order_by_with_star_no_table_alias">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<order-by>
<column-item name="order_id" />
</order-by>
</select>
<select sql-case-id="select_order_by_with_table_star_without_table_name">
<table name="t_order" alias="o" start-index="21" stop-index="27" />
<table name="t_order_item" alias="i" start-index="36" stop-index="47" />
<projections start-index="7" stop-index="14">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
<shorthand-projection start-index="12" stop-index="14">
<owner name="o" start-index="12" stop-index="12" />
</shorthand-projection>
</projections>
<order-by>
<column-item name="item_id" />
</order-by>
</select>
</sql-parser-test-cases>
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<sql-parser-test-cases>
<select sql-case-id="select_pagination_with_offset" parameters="1, 2, 9, 10, 5">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="31" stop-index="42" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="5" start-index="99" stop-index="154" literal-stop-index="155">
<and-predicate>
<predicate start-index="105" stop-index="123">
<column-left-value name="user_id" start-index="105" stop-index="113">
<owner name="o" start-index="105" stop-index="105" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="129" stop-index="154" literal-stop-index="155">
<column-left-value name="order_id" start-index="129" stop-index="138">
<owner name="o" start-index="129" stop-index="129" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="2" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="3" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="165" stop-index="165" literal-start-index="166" literal-stop-index="166" />
</column-item>
</order-by>
<limit start-index="180" stop-index="187" literal-start-index="181" literal-stop-index="188">
<offset value="5" parameter-index="4" start-index="187" stop-index="187" literal-start-index="188" literal-stop-index="188" />
</limit>
</select>
<select sql-case-id="select_pagination_with_row_count" parameters="1, 2, 9, 10, 5">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="31" stop-index="42" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="4" start-index="99" stop-index="154" literal-stop-index="155">
<and-predicate>
<predicate start-index="105" stop-index="123">
<column-left-value name="user_id" start-index="105" stop-index="113">
<owner name="o" start-index="105" stop-index="105" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="129" stop-index="154" literal-stop-index="155">
<column-left-value name="order_id" start-index="129" stop-index="138">
<owner name="o" start-index="129" stop-index="129" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="2" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="3" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="165" stop-index="165" literal-start-index="166" literal-stop-index="166" />
</column-item>
</order-by>
<limit start-index="180" stop-index="186" literal-start-index="181" literal-stop-index="187">
<row-count value="5" parameter-index="4" start-index="186" stop-index="186" literal-start-index="187" literal-stop-index="187" />
</limit>
</select>
<select sql-case-id="select_pagination_with_limit_with_back_quotes" parameters="1, 2, 9, 10, 5, 3">
<table name="t_order" alias="o" start-delimiter="`" end-delimiter="`" start-index="16" stop-index="24" />
<table name="t_order_item" alias="i" start-delimiter="`" end-delimiter="`" start-index="33" stop-index="46" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="4" start-index="103" stop-index="162" literal-stop-index="163">
<and-predicate>
<predicate start-index="109" stop-index="129">
<column-left-value name="user_id" start-delimiter="`" end-delimiter="`" start-index="109" stop-index="119">
<owner name="o" start-index="109" stop-index="109" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="135" stop-index="162" literal-stop-index="163">
<column-left-value name="order_id" start-delimiter="`" end-delimiter="`" start-index="135" stop-index="146">
<owner name="o" start-index="135" stop-index="135" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="2" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="3" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="173" stop-index="173" literal-start-index="174" literal-stop-index="174" />
</column-item>
</order-by>
<limit start-index="188" stop-index="197" literal-start-index="189" literal-stop-index="198">
<offset value="5" parameter-index="4" start-index="194" stop-index="194" literal-start-index="195" literal-stop-index="195" />
<row-count value="3" parameter-index="5" start-index="197" stop-index="197" literal-start-index="198" literal-stop-index="198" />
</limit>
</select>
<select sql-case-id="select_pagination_with_limit_and_offset_keyword" parameters="1, 2, 9, 10, 3, 5">
<table name="t_order" alias="o" start-delimiter="`" end-delimiter="`" start-index="16" stop-index="24" />
<table name="t_order_item" alias="i" start-delimiter="`" end-delimiter="`" start-index="33" stop-index="46" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="4" start-index="103" stop-index="162" literal-stop-index="163">
<and-predicate>
<predicate start-index="109" stop-index="129">
<column-left-value name="user_id" start-delimiter="`" end-delimiter="`" start-index="109" stop-index="119">
<owner name="o" start-index="109" stop-index="109" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="135" stop-index="162" literal-stop-index="163">
<column-left-value name="order_id" start-delimiter="`" end-delimiter="`" start-index="135" stop-index="146">
<owner name="o" start-index="135" stop-index="135" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="2" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="3" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="173" stop-index="173" literal-start-index="174" literal-stop-index="174" />
</column-item>
</order-by>
<limit start-index="188" stop-index="203" literal-start-index="189" literal-stop-index="204">
<row-count value="3" parameter-index="4" start-index="194" stop-index="194" literal-start-index="195" literal-stop-index="195" />
<offset value="5" parameter-index="5" start-index="203" stop-index="203" literal-start-index="204" literal-stop-index="204" />
</limit>
</select>
<select sql-case-id="select_pagination_with_top" parameters="3, 1, 2, 9, 10">
<table name="t_order" alias="o" start-index="167" stop-index="173" />
<table name="t_order_item" alias="i" start-index="182" stop-index="193" />
<projections start-index="22" stop-index="160">
<top-projection alias="rownum_" start-index="22" stop-index="72">
<top-value value="3" parameter-index="0" start-index="27" stop-index="27" />
</top-projection>
<column-projection name="item_id" start-index="86" stop-index="94">
<owner name="i" start-index="86" stop-index="86" />
</column-projection>
<column-projection name="order_id" alias="order_id" start-index="97" stop-index="106">
<owner name="o" start-index="97" stop-index="97" />
</column-projection>
<column-projection name="status" alias="status" start-index="121" stop-index="128">
<owner name="o" start-index="121" stop-index="121" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="141" stop-index="149">
<owner name="o" start-index="141" stop-index="141" />
</column-projection>
</projections>
<where parameters-count="5" start-index="250" stop-index="305" literal-stop-index="306">
<and-predicate>
<predicate start-index="256" stop-index="274">
<column-left-value name="user_id" start-index="256" stop-index="264">
<owner name="o" start-index="256" stop-index="256" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="1" />
<parameter-marker-expression value="2" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="280" stop-index="305" literal-stop-index="306">
<column-left-value name="order_id" start-index="280" stop-index="289">
<owner name="o" start-index="280" stop-index="280" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="3" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="4" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="58" stop-index="58" />
</column-item>
</order-by>
<row-count value="3" parameter-index="0" />
</select>
<select sql-case-id="select_pagination_with_offset_and_limit" parameters="1, 2, 9, 10, 5, 3">
<table name="t_order" alias="o" start-index="16" stop-index="22" />
<table name="t_order_item" alias="i" start-index="31" stop-index="42" />
<projections start-index="7" stop-index="9">
<shorthand-projection start-index="7" stop-index="9">
<owner name="i" start-index="7" stop-index="7" />
</shorthand-projection>
</projections>
<where parameters-count="6" start-index="99" stop-index="154" literal-stop-index="155">
<and-predicate>
<predicate start-index="105" stop-index="123">
<column-left-value name="user_id" start-index="105" stop-index="113">
<owner name="o" start-index="105" stop-index="105" />
</column-left-value>
<in-right-value>
<parameter-marker-expression value="0" />
<parameter-marker-expression value="1" />
<literal-expression value="1" />
<literal-expression value="2" />
</in-right-value>
</predicate>
<predicate start-index="129" stop-index="154" literal-stop-index="155">
<column-left-value name="order_id" start-index="129" stop-index="138">
<owner name="o" start-index="129" stop-index="129" />
</column-left-value>
<between-right-value>
<between-parameter-marker-expression value="2" />
<between-literal-expression value="9" />
<and-parameter-marker-expression value="3" />
<and-literal-expression value="10" />
</between-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="165" stop-index="165" literal-start-index="166" literal-stop-index="166" />
</column-item>
</order-by>
<limit start-index="180" stop-index="195" literal-start-index="181" literal-stop-index="196">
<offset value="5" parameter-index="4" start-index="187" stop-index="187" literal-start-index="188" literal-stop-index="188" />
<row-count value="3" parameter-index="5" start-index="195" stop-index="195" literal-start-index="196" literal-stop-index="196" />
</limit>
</select>
<select sql-case-id="select_pagination_with_top_for_greater_than" parameters="3, 1, 2, 9, 10, 6">
<table name="t_order" alias="o" start-index="167" stop-index="173" />
<table name="t_order_item" alias="i" start-index="182" stop-index="193" />
<projections start-index="22" stop-index="160">
<top-projection alias="rownum_" start-index="22" stop-index="72">
<top-value value="3" parameter-index="0" start-index="27" stop-index="27" />
</top-projection>
<column-projection name="item_id" start-index="86" stop-index="94">
<owner name="i" start-index="86" stop-index="86" />
</column-projection>
<column-projection name="order_id" alias="order_id" start-index="97" stop-index="106">
<owner name="o" start-index="97" stop-index="97" />
</column-projection>
<column-projection name="status" alias="status" start-index="121" stop-index="128">
<owner name="o" start-index="121" stop-index="121" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="141" stop-index="149">
<owner name="o" start-index="141" stop-index="141" />
</column-projection>
</projections>
<where parameters-count="6" start-index="315" stop-index="337" literal-start-index="316" literal-stop-index="338">
<and-predicate>
<!-- FIXME cannot parse subquery's predicate -->
<predicate start-index="322" stop-index="337" literal-start-index="323" literal-stop-index="338">
<column-left-value name="rownum_" start-index="322" stop-index="333" literal-start-index="323" literal-stop-index="334">
<owner name="row_" start-index="322" stop-index="325" literal-start-index="323" literal-stop-index="326" />
</column-left-value>
<operator type="&gt;" />
<compare-right-value>
<parameter-marker-expression value="5" />
<literal-expression value="6" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="58" stop-index="58" />
</column-item>
</order-by>
<offset value="6" parameter-index="5" />
<row-count value="3" parameter-index="0" />
</select>
<select sql-case-id="select_pagination_with_top_for_greater_than_and_equal" parameters="3, 1, 2, 9, 10, 6">
<table name="t_order" alias="o" start-index="167" stop-index="173" />
<table name="t_order_item" alias="i" start-index="182" stop-index="193" />
<projections start-index="22" stop-index="160">
<top-projection alias="rownum_" start-index="22" stop-index="72">
<top-value value="3" parameter-index="0" start-index="27" stop-index="27" />
</top-projection>
<column-projection name="item_id" start-index="86" stop-index="94">
<owner name="i" start-index="86" stop-index="86" />
</column-projection>
<column-projection name="order_id" alias="order_id" start-index="97" stop-index="106">
<owner name="o" start-index="97" stop-index="97" />
</column-projection>
<column-projection name="status" alias="status" start-index="121" stop-index="128">
<owner name="o" start-index="121" stop-index="121" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="141" stop-index="149">
<owner name="o" start-index="141" stop-index="141" />
</column-projection>
</projections>
<where parameters-count="6" start-index="315" stop-index="338" literal-start-index="316" literal-stop-index="339">
<and-predicate>
<!-- FIXME cannot parse subquery's predicate -->
<predicate start-index="322" stop-index="338" literal-start-index="323" literal-stop-index="339">
<column-left-value name="rownum_" start-index="322" stop-index="333" literal-start-index="323" literal-stop-index="334">
<owner name="row_" start-index="322" stop-index="325" literal-start-index="323" literal-stop-index="326" />
</column-left-value>
<operator type="&gt;=" />
<compare-right-value>
<parameter-marker-expression value="5" />
<literal-expression value="6" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="58" stop-index="58" />
</column-item>
</order-by>
<offset value="6" parameter-index="5" />
<row-count value="3" parameter-index="0" />
</select>
<select sql-case-id="select_pagination_with_row_number" parameters="1, 2, 9, 10, 3">
<table name="t_order" alias="order0_" start-index="146" stop-index="152" />
<table name="t_order_item" alias="i" start-index="167" stop-index="178" />
<projections start-index="58" stop-index="139">
<column-projection name="order_id" alias="order_id" start-index="58" stop-index="73">
<owner name="order0_" start-index="58" stop-index="64" />
</column-projection>
<column-projection name="status" alias="status" start-index="88" stop-index="101">
<owner name="order0_" start-index="88" stop-index="94" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="114" stop-index="128">
<owner name="order0_" start-index="114" stop-index="120" />
</column-projection>
</projections>
<where parameters-count="5" start-index="253" stop-index="314" literal-stop-index="315">
<and-predicate>
<!-- FIXME cannot parse subquery's predicate -->
<!--<predicate start-index="253" stop-index="277">-->
<!--<column-left-value name="user_id" start-index="253" stop-index="267">-->
<!--<owner name="order0_" start-index="253" stop-index="253" />-->
<!--</column-left-value>-->
<!--</predicate>-->
<!--<predicate start-index="283" stop-index="314" literal-stop-index="315">-->
<!--<column-left-value name="order_id" start-index="283" stop-index="298">-->
<!--<owner name="order0_" start-index="283" stop-index="289" />-->
<!--</column-left-value>-->
<!--</predicate>-->
<predicate start-index="352" stop-index="362" literal-start-index="353" literal-stop-index="363">
<column-left-value name="rownum" start-index="352" stop-index="357" literal-start-index="353" literal-stop-index="358" />
<operator type="&lt;=" />
<compare-right-value>
<parameter-marker-expression value="4" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="325" stop-index="325" literal-start-index="326" literal-stop-index="326" />
</column-item>
</order-by>
<row-count value="3" parameter-index="4" />
</select>
<select sql-case-id="select_pagination_with_row_number_for_greater_than" parameters="1, 2, 9, 10, 5, 3">
<table name="t_order" alias="order0_" start-index="146" stop-index="152" />
<table name="t_order_item" alias="i" start-index="167" stop-index="178" />
<projections start-index="58" stop-index="139">
<column-projection name="order_id" alias="order_id" start-index="58" stop-index="73">
<owner name="order0_" start-index="58" stop-index="64" />
</column-projection>
<column-projection name="status" alias="status" start-index="88" stop-index="101">
<owner name="order0_" start-index="88" stop-index="94" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="114" stop-index="128">
<owner name="order0_" start-index="114" stop-index="120" />
</column-projection>
</projections>
<where parameters-count="6" start-index="367" stop-index="385" literal-start-index="368" literal-stop-index="386">
<and-predicate>
<!-- FIXME cannot parse subquery's predicate -->
<predicate start-index="373" stop-index="385" literal-start-index="374" literal-stop-index="386">
<column-left-value name="rownum_" start-index="373" stop-index="381" literal-start-index="374" literal-stop-index="382">
<owner name="t" start-index="373" stop-index="373" literal-start-index="374" literal-stop-index="374" />
</column-left-value>
<operator type="&gt;" />
<compare-right-value>
<parameter-marker-expression value="5" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="325" stop-index="325" literal-start-index="326" literal-stop-index="326" />
</column-item>
</order-by>
<offset value="3" parameter-index="5" />
<row-count value="5" parameter-index="4" />
</select>
<select sql-case-id="select_pagination_with_row_number_for_greater_than_and_equal" parameters="1, 2, 9, 10, 5, 3">
<table name="t_order" alias="order0_" start-index="146" stop-index="152" />
<table name="t_order_item" alias="i" start-index="167" stop-index="178" />
<projections start-index="58" stop-index="139">
<column-projection name="order_id" alias="order_id" start-index="58" stop-index="73">
<owner name="order0_" start-index="58" stop-index="64" />
</column-projection>
<column-projection name="status" alias="status" start-index="88" stop-index="101">
<owner name="order0_" start-index="88" stop-index="94" />
</column-projection>
<column-projection name="user_id" alias="user_id" start-index="114" stop-index="128">
<owner name="order0_" start-index="114" stop-index="120" />
</column-projection>
</projections>
<where parameters-count="6" start-index="367" stop-index="386" literal-start-index="368" literal-stop-index="387">
<and-predicate>
<!-- FIXME cannot parse subquery's predicate -->
<predicate start-index="373" stop-index="386" literal-start-index="374" literal-stop-index="387">
<column-left-value name="rownum_" start-index="373" stop-index="381" literal-start-index="374" literal-stop-index="382">
<owner name="t" start-index="373" stop-index="373" literal-start-index="374" literal-stop-index="374" />
</column-left-value>
<operator type="&gt;=" />
<compare-right-value>
<parameter-marker-expression value="5" />
<literal-expression value="3" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="item_id" order-direction="DESC">
<owner name="i" start-index="325" stop-index="325" literal-start-index="326" literal-stop-index="326" />
</column-item>
</order-by>
<offset value="3" parameter-index="5" />
<row-count value="5" parameter-index="4" />
</select>
<select sql-case-id="select_pagination_with_row_number_not_at_end" parameters="20">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<where parameters-count="1" start-index="22" stop-index="38" literal-stop-index="39">
<and-predicate>
<predicate start-index="28" stop-index="38" literal-stop-index="39">
<column-left-value name="ROWNUM" start-index="28" stop-index="33" />
<operator type="&lt;=" />
<compare-right-value>
<parameter-marker-expression value="0" />
<literal-expression value="20" />
</compare-right-value>
</predicate>
</and-predicate>
</where>
<order-by>
<column-item name="order_id" />
</order-by>
<row-count value="20" parameter-index="0" />
</select>
<select sql-case-id="select_pagination_with_offset_fetch" parameters="20">
<table name="t_order" start-index="14" stop-index="20" />
<projections start-index="7" stop-index="7">
<shorthand-projection start-index="7" stop-index="7" />
</projections>
<order-by>
<column-item name="order_id" />
</order-by>
<row-count value="20" parameter-index="0" />
</select>
</sql-parser-test-cases>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册