Skip to content

Commit

Permalink
Format and test
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9000 committed Aug 28, 2023
1 parent 8db3945 commit 573e5a2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/reference/esql/functions/left.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ from string starting from 0.

[source.merge.styled,esql]
----
include::{esql-specs}/docs.csv-spec[tag=left]
include::{esql-specs}/string.csv-spec[tag=left]
----
[%header.monospaced.styled,format=dsv,separator=|]
|===
include::{esql-specs}/docs.csv-spec[tag=left-result]
include::{esql-specs}/string.csv-spec[tag=left-result]
|===
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ is_finite |is_finite(arg1)
is_infinite |is_infinite(arg1)
is_nan |is_nan(arg1)
least |least(arg1, arg2...)
left |left(arg1)
left |left(arg1, arg2)
length |length(arg1)
log10 |log10(arg1)
ltrim |ltrim(arg1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ static BytesRef process(@Fixed BytesRef out, BytesRef str, int length) {
out.length = str.length;
int curLenStart = 0;
UnicodeUtil.UTF8CodePoint cp = new UnicodeUtil.UTF8CodePoint();
for (int i = 0; i < length && curLenStart < out.length;
i++, curLenStart += cp.numBytes) {
UnicodeUtil.codePointAt(out.bytes, out.offset + curLenStart, cp);
for (int i = 0; i < length && curLenStart < out.length; i++, curLenStart += cp.numBytes) {
UnicodeUtil.codePointAt(out.bytes, out.offset + curLenStart, cp);
}
out.length = Math.min(curLenStart, out.length);
out.length = Math.min(curLenStart, out.length);
return out;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import static org.elasticsearch.compute.data.BlockUtils.toJavaObject;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;

public class LeftTests extends AbstractScalarFunctionTestCase {
public LeftTests(@Name("TestCase") Supplier<TestCase> testCaseSupplier) {
Expand Down

0 comments on commit 573e5a2

Please sign in to comment.