-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9228dc4
commit 91071ae
Showing
61 changed files
with
648 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/org/sheinbergon/dremio/udf/gis/STAsBinary.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.sheinbergon.dremio.udf.gis; | ||
|
||
import com.dremio.exec.expr.SimpleFunction; | ||
import com.dremio.exec.expr.annotations.FunctionTemplate; | ||
import com.dremio.exec.expr.annotations.Output; | ||
import com.dremio.exec.expr.annotations.Param; | ||
|
||
import javax.inject.Inject; | ||
|
||
@FunctionTemplate( | ||
name = "ST_AsBinary", | ||
scope = FunctionTemplate.FunctionScope.SIMPLE, | ||
nulls = FunctionTemplate.NullHandling.INTERNAL) | ||
public class STAsBinary implements SimpleFunction { | ||
|
||
@Param | ||
org.apache.arrow.vector.holders.NullableVarBinaryHolder binaryInput; | ||
|
||
@Output | ||
org.apache.arrow.vector.holders.NullableVarBinaryHolder wkbOutput; | ||
|
||
@Inject | ||
org.apache.arrow.memory.ArrowBuf buffer; | ||
|
||
public void setup() { | ||
} | ||
|
||
public void eval() { | ||
if (org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.isHolderSet(binaryInput)) { | ||
org.locationtech.jts.geom.Geometry geom = org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.toGeometry(binaryInput); | ||
byte[] bytes = org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.toBinary(geom); | ||
buffer = buffer.reallocIfNeeded(bytes.length); | ||
org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.populate(bytes, buffer, wkbOutput); | ||
} else { | ||
org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.markHolderNotSet(wkbOutput); | ||
} | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
src/main/java/org/sheinbergon/dremio/udf/gis/STAsEWKB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.sheinbergon.dremio.udf.gis; | ||
|
||
import com.dremio.exec.expr.SimpleFunction; | ||
import com.dremio.exec.expr.annotations.FunctionTemplate; | ||
import com.dremio.exec.expr.annotations.Output; | ||
import com.dremio.exec.expr.annotations.Param; | ||
|
||
import javax.inject.Inject; | ||
|
||
@FunctionTemplate( | ||
name = "ST_AsEWKB", | ||
scope = FunctionTemplate.FunctionScope.SIMPLE, | ||
nulls = FunctionTemplate.NullHandling.INTERNAL) | ||
public class STAsEWKB implements SimpleFunction { | ||
|
||
@Param | ||
org.apache.arrow.vector.holders.NullableVarBinaryHolder binaryInput; | ||
|
||
@Output | ||
org.apache.arrow.vector.holders.NullableVarBinaryHolder ewkbOutput; | ||
|
||
@Inject | ||
org.apache.arrow.memory.ArrowBuf buffer; | ||
|
||
public void setup() { | ||
} | ||
|
||
public void eval() { | ||
if (org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.isHolderSet(binaryInput)) { | ||
org.locationtech.jts.geom.Geometry geom = org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.toGeometry(binaryInput); | ||
byte[] bytes = org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.toEWKB(geom); | ||
buffer = buffer.reallocIfNeeded(bytes.length); | ||
org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.populate(bytes, buffer, ewkbOutput); | ||
} else { | ||
org.sheinbergon.dremio.udf.gis.util.GeometryHelpers.markHolderNotSet(ewkbOutput); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.