yanxinyi commented on a change in pull request #671: PHOENIX-4845 Support using
Row Value Constructors in OFFSET clause fo…
URL: https://github.com/apache/phoenix/pull/671#discussion_r363572386
##########
File path:
phoenix-core/src/main/java/org/apache/phoenix/compile/OffsetCompiler.java
##########
@@ -62,23 +82,233 @@ public SortOrder getSortOrder() {
private OffsetCompiler() {}
- public static Integer compile(StatementContext context,
FilterableStatement statement) throws SQLException {
+ // eager initialization
+ final private static OffsetCompiler OFFSET_COMPILER = getInstance();
+
+ private static OffsetCompiler getInstance() {
+ return new OffsetCompiler();
+ }
+
+ public static OffsetCompiler getOffsetCompiler() {
+ return OFFSET_COMPILER;
+ }
+
+ public CompiledOffset compile(StatementContext context,
FilterableStatement statement) throws SQLException {
OffsetNode offsetNode = statement.getOffset();
- if (offsetNode == null) { return null; }
- OffsetParseNodeVisitor visitor = new OffsetParseNodeVisitor(context);
- offsetNode.getOffsetParseNode().accept(visitor);
- return visitor.getOffset();
+ if (offsetNode == null) { return new
CompiledOffset(Optional.<Integer>absent(), Optional.<byte[]>absent()); }
Review comment:
nit: more than 100 chars per line.
break into two lines for better readability
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services