Skip to content

Commit

Permalink
[CALCITE-6790] Write LIMIT for fetch operations in Vertica
Browse files Browse the repository at this point in the history
  • Loading branch information
illes authored and mihaibudiu committed Jan 21, 2025
1 parent cc7b557 commit f9cc84f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
import org.apache.calcite.avatica.util.Casing;
import org.apache.calcite.rel.type.RelDataType;
import org.apache.calcite.sql.SqlDialect;
import org.apache.calcite.sql.SqlNode;
import org.apache.calcite.sql.SqlOperator;
import org.apache.calcite.sql.SqlWriter;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.List;

Expand Down Expand Up @@ -53,4 +57,9 @@ public VerticaSqlDialect(Context context) {
return super.supportsFunction(operator, type, paramTypes);
}
}

@Override public void unparseOffsetFetch(SqlWriter writer, @Nullable SqlNode offset,
@Nullable SqlNode fetch) {
unparseFetchUsingLimit(writer, offset, fetch);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3012,7 +3012,12 @@ private SqlDialect nonOrdinalDialect() {
+ "FROM `foodmart`.`product`\n"
+ "LIMIT 100\n"
+ "OFFSET 10";
final String expectedVertica = "SELECT \"product_id\"\n"
+ "FROM \"foodmart\".\"product\"\n"
+ "LIMIT 100\n"
+ "OFFSET 10";
sql(query).withHive().ok(expected)
.withVertica().ok(expectedVertica)
.withStarRocks().ok(expectedStarRocks);
}

Expand Down

0 comments on commit f9cc84f

Please sign in to comment.