Skip to content

Commit

Permalink
fix: Parsing offset borefor pipe symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorklauritzen committed Nov 22, 2024
1 parent 4564912 commit 1b96c65
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ private static YQLPartParseResult parseYQLQuery(ParseContext context, String que
String charsBeforePipe = queryString.substring(charsRead, pipeIndex);
if (charsBeforePipe.strip().length() == 0) {
String groupingString = queryString.substring(pipeIndex + 1); // Do not include pipe char
charsRead = pipeIndex + 1;
Position YQLStringPosition = StringUtils.getStringPosition(YQLString);
Position groupOffsetWithoutPipe = CSTUtils.addPositions(offset, YQLStringPosition);

Position groupOffset = CSTUtils.addPositions(groupOffsetWithoutPipe, new Position(0, 1)); // Add pipe char

ret.addChild(new YQLNode(new Range(groupOffsetWithoutPipe, groupOffset), "|", charOffset + pipeIndex));
charsRead++;

// Look for continuation
boolean continuationDetected = detectContinuation(groupingString);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Stream<DynamicTest> generateGoodTests() {
"all( group(a) max(5) each(output(count()) all(group(b) max(5) each(output(count()) all(max(1) each(output(summary()))) all(group(c) max(5) each(max(69) output(count()) each(output(summary()))))) )))",
"all( group(a) max(5) each(output(count()) all(max(1) each(output(summary()))) all(group(b) max(5) each(output(count()) all(max(1) each(output(summary()))) all(group(c) max(5) each(max(69) output(count()) each(output(summary()))))) )))",
"all( group(a) max(5) each(output(count()) all(max(1) each(output(summary(complexsummary)))) all(group(b) max(5) each(output(count()) all(max(1) each(output(summary(simplesummary)))) all(group(c) max(5) each(max(69) output(count()) each(output(summary(fastsummary)))))) )))",
"all( group(a) max(5) each(output(count()) all(max(1) each(output(summary()))) all(group(b) each(output(count()) all(max(1) each(output(summary()))) all(group(c) each(output(count()) all(max(1) each(output(summary())))))))) )))",
"all( group(a) max(5) each(output(count()) all(max(1) each(output(summary()))) all(group(b) each(output(count()) all(max(1) each(output(summary()))) all(group(c) each(output(count()) all(max(1) each(output(summary())))))))) )",
"all( group(time.year(a)) each(output(count())) )",
"all( group(time.year(a)) each(output(count()) all(group(time.monthofyear(a)) each(output(count())))) )",
"all( group(time.year(a)) each(output(count()) all(group(time.monthofyear(a)) each(output(count()) all(group(time.dayofmonth(a)) each(output(count()) all(group(time.hourofday(a)) each(output(count())))))))) )",
Expand Down

0 comments on commit 1b96c65

Please sign in to comment.