arina-ielchiieva commented on a change in pull request #1509: DRILL-6810:
Disable NULL_IF_NULL NullHandling for functions with Comp…
URL: https://github.com/apache/drill/pull/1509#discussion_r227353968
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/ParseUrlFunction.java
##########
@@ -22,134 +22,238 @@
import org.apache.drill.exec.expr.annotations.FunctionTemplate;
import org.apache.drill.exec.expr.annotations.Output;
import org.apache.drill.exec.expr.annotations.Param;
+import org.apache.drill.exec.expr.holders.NullableVarCharHolder;
import org.apache.drill.exec.expr.holders.VarCharHolder;
import org.apache.drill.exec.vector.complex.writer.BaseWriter;
import javax.inject.Inject;
-@FunctionTemplate(
- name="parse_url",
- scope= FunctionTemplate.FunctionScope.SIMPLE,
- nulls = FunctionTemplate.NullHandling.NULL_IF_NULL
-)
+public class ParseUrlFunction {
-public class ParseUrlFunction implements DrillSimpleFunc {
+ @FunctionTemplate(name = "parse_url", scope =
FunctionTemplate.FunctionScope.SIMPLE)
+ public static class ParseUrl implements DrillSimpleFunc {
- @Param VarCharHolder input;
+ @Param
+ VarCharHolder in;
+ @Output
+ BaseWriter.ComplexWriter outWriter;
+ @Inject
+ DrillBuf outBuffer;
- @Output BaseWriter.ComplexWriter outWriter;
-
- @Inject DrillBuf outBuffer;
-
- public void setup() {}
+ @Override
+ public void setup() {
+ }
+ @Override
public void eval() {
+ org.apache.drill.exec.vector.complex.writer.BaseWriter.MapWriter
urlMapWriter = outWriter.rootAsMap();
+
+ String urlString =
+
org.apache.drill.exec.expr.fn.impl.StringFunctionHelpers.toStringFromUTF8(in.start,
in.end, in.buffer);
+ try {
+ java.net.URL aURL = new java.net.URL(urlString);
+
+ String protocol = aURL.getProtocol();
Review comment:
Maybe create Map with key as property name (i.e. protocol), value as result
of the appropriate getter, then go over this map and write results into map
writer?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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