Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2465,3 +2465,39 @@ warning:Line 2:9: java.lang.IllegalArgumentException: single-value function enco
@timestamp:date | message:text
2023-10-23T13:55:01.544Z|Connected to 10.1.0.1
;

url_encode sample for docs
required_capability: url_encode

// tag::url_encode[]
ROW u = "https://www.example.com/papers?q=information+retrieval&year=2024&citations=high" | EVAL u = URL_ENCODE(u)
// end::url_encode[]
;

// tag::url_encode-result[]
u:keyword
https%3A%2F%2Fwww.example.com%2Fpapers%3Fq%3Dinformation%2Bretrieval%26year%3D2024%26citations%3Dhigh
// end::url_encode-result[]
;

url_encode mixed functions tests
required_capability: url_encode

FROM employees
| WHERE emp_no == 10001
| EVAL a = TRIM(URL_ENCODE(first_name))
| EVAL b = URL_ENCODE(TO_LOWER(first_name))
| KEEP a,b;

a:keyword | b:keyword
Georgi | georgi
;

url_encode mixed input tests
required_capability: url_encode

ROW u = ["hello elastic!", "a+b-c%d", "", "!#$&'()*+,/:;=?@[]"] | EVAL u = URL_ENCODE(u);

u:keyword
["hello+elastic%21", "a%2Bb-c%25d", "", "%21%23%24%26%27%28%29*%2B%2C%2F%3A%3B%3D%3F%40%5B%5D"]
;

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,12 @@ public enum Cap {
/**
* Allow qualifiers in attribute names.
*/
NAME_QUALIFIERS(Build.current().isSnapshot());
NAME_QUALIFIERS(Build.current().isSnapshot()),

/**
* URL encoding function.
*/
URL_ENCODE(Build.current().isSnapshot());

private final boolean enabled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToString;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToUnsignedLong;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToVersion;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.UrlEncode;
import org.elasticsearch.xpack.esql.expression.function.scalar.math.Abs;
import org.elasticsearch.xpack.esql.expression.function.scalar.math.Acos;
import org.elasticsearch.xpack.esql.expression.function.scalar.math.Asin;
Expand Down Expand Up @@ -223,6 +224,7 @@ public static List<NamedWriteableRegistry.Entry> unaryScalars() {
entries.add(WildcardLike.ENTRY);
entries.add(WildcardLikeList.ENTRY);
entries.add(Delay.ENTRY);
entries.add(UrlEncode.ENTRY);
// mv functions
entries.addAll(MvFunctionWritables.getNamedWriteables());
return entries;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToTimeDuration;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToUnsignedLong;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToVersion;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.UrlEncode;
import org.elasticsearch.xpack.esql.expression.function.scalar.date.DateDiff;
import org.elasticsearch.xpack.esql.expression.function.scalar.date.DateExtract;
import org.elasticsearch.xpack.esql.expression.function.scalar.date.DateFormat;
Expand Down Expand Up @@ -513,7 +514,8 @@ private static FunctionDefinition[][] snapshotFunctions() {
def(L1Norm.class, L1Norm::new, "v_l1_norm"),
def(L2Norm.class, L2Norm::new, "v_l2_norm"),
def(Magnitude.class, Magnitude::new, "v_magnitude"),
def(Hamming.class, Hamming::new, "v_hamming") } };
def(Hamming.class, Hamming::new, "v_hamming"),
def(UrlEncode.class, UrlEncode::new, "url_encode") } };
}

public EsqlFunctionRegistry snapshotRegistry() {
Expand Down
Loading
Loading