diff --git a/.travis.yml b/.travis.yml index b57d69e..3665987 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,8 @@ language: java jdk: - - openjdk6 - - openjdk7 - - oraclejdk7 + - openjdk8 + - openjdk11 + - oraclejdk11 notifications: email: false sudo: false diff --git a/README.md b/README.md index 6bdcca7..ce14e7d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ -[![Build Status](https://travis-ci.org/Esri/spatial-framework-for-hadoop.png?branch=master)](https://travis-ci.org/Esri/spatial-framework-for-hadoop) # spatial-framework-for-hadoop The __Spatial Framework for Hadoop__ allows developers and data scientists to use the Hadoop data processing system @@ -9,28 +8,34 @@ to [GIS Tools for Hadoop](https://github.com/Esri/gis-tools-for-hadoop). ## What's New -* GeoJSON support: Hadoop InputFormat and Hive SerDe for GeoJSON as well as for Esri GeoServices REST JSON (in v1.2.0 release). -* ST_Geometry works under SparkSQL as well as under Hive itself (the new part is the JSON SerDe classes working under SparkSQL - pretty much everything else had already worked). +* Hive v4 compatibility (as of Y2023). +* ST_Centroid now returns the geometry centroid rather than the center of its envelope (as of v2.1). ## Features -* **[JSON Utilities](https://github.com/Esri/spatial-framework-for-hadoop/wiki/JSON-Utilities)** - Utilities -for interacting with JSON exported from ArcGIS - * [Javadoc](http://esri.github.com/spatial-framework-for-hadoop/json/) -* **[Hive Spatial](https://github.com/Esri/spatial-framework-for-hadoop/wiki/Hive-Spatial)** - User-Defined -Functions and SerDes for spatial analysis in Hive - * [UDF Documentation](https://github.com/Esri/spatial-framework-for-hadoop/wiki/UDF-Documentation) - * [JSON SerDe](https://github.com/Esri/spatial-framework-for-hadoop/wiki/Hive-JSON-SerDe) +* **[JSON Utilities](https://github.com/Esri/spatial-framework-for-hadoop/wiki/JSON-Utilities)** - + Utilities for interacting with JSON exported from ArcGIS + - [Javadoc](http://esri.github.io/spatial-framework-for-hadoop/json/) +* **[Hive Spatial](https://github.com/Esri/spatial-framework-for-hadoop/wiki/Hive-Spatial)** - + User-Defined Functions and SerDes for spatial analysis in Hive and SparkSQL + - [UDF Documentation](https://github.com/Esri/spatial-framework-for-hadoop/wiki/UDF-Documentation) + - [JSON SerDe](https://github.com/Esri/spatial-framework-for-hadoop/wiki/Hive-JSON-SerDe) ## Getting Started +### Pre-Built + +Up-to-date releases may be available [on Github](https://github.com/Esri/spatial-framework-for-hadoop/releases) but +[may not be on Maven Central](https://github.com/Esri/spatial-framework-for-hadoop/issues/123). + ### Maven Build as you would any other Mavenized repository. All dependencies are pulled automatically. ### Ant -Ant build files are also available +Ant build files are also available, +but are considered legacy, and may likely be removed in a future release. At the root level of this repository, you can build a single jar with everything in the framework using [Apache Ant](http://ant.apache.org/). Alternatively, you can build a jar at the root level of each @@ -47,30 +52,37 @@ processing. ## Requirements -* Hive 0.9.0 and above (see [Hive Compatibility issues](https://github.com/Esri/spatial-framework-for-hadoop/wiki/ST_Geometry-for-Hive-Compatibility-with-Hive-Versions)) +* Geometry v2.2 +* Hive v1 and above or SparkSQL ([compatibility details](https://github.com/Esri/spatial-framework-for-hadoop/wiki/ST_Geometry-for-Hive-Compatibility-with-Hive-Versions)) +* Hadoop v2 and above * Workflows calling MapReduce jobs require the location of the custom job to be run. * Custom MapReduce jobs that use the Esri Geometry API require that the developer has authored the job, -(referencing the com.esri.geometry.\* classes), and deployed the job Jar file to the Hadoop system, prior to the -ArcGIS user submitting the workflow file. + (referencing the com.esri.geometry.\* classes), and deployed the job Jar file to the Hadoop system, + prior to the ArcGIS user submitting the workflow file. +* System administrators should always deploy an appropriate version of dependencies into production, + that include important and especially security patches, + even if a JAR file has been built with a lower version. + ## Resources * [GeoData Blog on the ArcGIS Blogs](http://blogs.esri.com/esri/arcgis/author/jonmurphy/) * [Big Data Place on GeoNet](https://geonet.esri.com/groups/big-data) -* [ArcGIS Geodata Resource Center]( http://resources.arcgis.com/en/communities/geodata/) +* [ArcGIS Geodata Resource Center](http://resources.arcgis.com/en/communities/geodata/) * [ArcGIS Blog](http://blogs.esri.com/esri/arcgis/) * [twitter@esri](http://twitter.com/esri) + ## Issues -Find a bug or want to request a new feature? Please let us know by submitting an issue. +Find a bug or want to request a new feature? Please let us know by submitting an [issue](https://github.com/Esri/spatial-framework-for-hadoop/issues). ## Contributing -Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing) +Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](https://github.com/esri/contributing). ## Licensing -Copyright 2013-2017 Esri +Copyright 2013-2024 Esri Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -87,3 +99,8 @@ limitations under the License. A copy of the license is available in the repository's [license.txt](https://raw.github.com/Esri/spatial-framework-for-hadoop/master/license.txt) file. + +## See Also + +* [Apache Sedona](https://github.com/apache/incubator-sedona/) +* [ArcGIS GeoAnalytics Engine](https://developers.arcgis.com/geoanalytics/) diff --git a/build.xml b/build.xml old mode 100755 new mode 100644 index 65fb567..d76657c --- a/build.xml +++ b/build.xml @@ -1,3 +1,4 @@ + @@ -6,9 +7,9 @@ - - - + + + diff --git a/hive/build.xml b/hive/build.xml index a516012..264bba0 100755 --- a/hive/build.xml +++ b/hive/build.xml @@ -3,10 +3,10 @@ - - - - + + + + diff --git a/hive/pom.xml b/hive/pom.xml index 1ca2ee8..6b817d0 100755 --- a/hive/pom.xml +++ b/hive/pom.xml @@ -4,12 +4,12 @@ com.esri.hadoop spatial-sdk-hadoop - 2.0.0-SNAPSHOT + 2.2.1-SNAPSHOT ../ spatial-sdk-hive - Hive Spatial Framework + Spatial Framework for Hive and SparkSQL diff --git a/hive/src/main/java/com/esri/hadoop/hive/ST_Bin.java b/hive/src/main/java/com/esri/hadoop/hive/ST_Bin.java index 2456f1d..b23f3b6 100755 --- a/hive/src/main/java/com/esri/hadoop/hive/ST_Bin.java +++ b/hive/src/main/java/com/esri/hadoop/hive/ST_Bin.java @@ -33,36 +33,36 @@ public ObjectInspector initialize(ObjectInspector[] OIs) if (OIs.length != 2) { throw new UDFArgumentException("Function takes exactly 2 arguments"); } - + if (OIs[0].getCategory() != Category.PRIMITIVE) { - throw new UDFArgumentException("Argument 0 must be a number"); + throw new UDFArgumentException("Argument 0 must be a number - got: " + OIs[0].getCategory()); } - + oiBinSize = (PrimitiveObjectInspector)OIs[0]; - if (!EnumSet.of(PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT).contains(oiBinSize.getPrimitiveCategory())) { - throw new UDFArgumentException("Argument 0 must be a number"); + if (!EnumSet.of(PrimitiveCategory.DECIMAL,PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT).contains(oiBinSize.getPrimitiveCategory())) { + throw new UDFArgumentException("Argument 0 must be a number - got: " + oiBinSize.getPrimitiveCategory()); } - + geomHelper = HiveGeometryOIHelper.create(OIs[1], 1); binSizeIsConstant = ObjectInspectorUtils.isConstantObjectInspector(OIs[0]); return PrimitiveObjectInspectorFactory.javaLongObjectInspector; } - + @Override public Object evaluate(DeferredObject[] args) throws HiveException { double binSize = PrimitiveObjectInspectorUtils.getDouble(args[0].get(), oiBinSize); - + if (!binSizeIsConstant || bins == null) { bins = new BinUtils(binSize); } - + OGCPoint point = geomHelper.getPoint(args); - + if (point == null) { return null; } - + return bins.getId(point.X(), point.Y()); } @@ -71,4 +71,5 @@ public String getDisplayString(String[] args) { assert(args.length == 2); return String.format("st_bin(%s,%s)", args[0], args[1]); } + } diff --git a/hive/src/main/java/com/esri/hadoop/hive/ST_BinEnvelope.java b/hive/src/main/java/com/esri/hadoop/hive/ST_BinEnvelope.java index 8ca737d..9e42f88 100755 --- a/hive/src/main/java/com/esri/hadoop/hive/ST_BinEnvelope.java +++ b/hive/src/main/java/com/esri/hadoop/hive/ST_BinEnvelope.java @@ -58,7 +58,8 @@ private boolean isPrimitiveNumber(ObjectInspector oi) { return false; } - return EnumSet.of(PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG,PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT) + return EnumSet.of(PrimitiveCategory.DOUBLE,PrimitiveCategory.INT,PrimitiveCategory.LONG, + PrimitiveCategory.SHORT, PrimitiveCategory.FLOAT, PrimitiveCategory.DECIMAL) .contains(((PrimitiveObjectInspector)oi).getPrimitiveCategory()); } diff --git a/hive/src/main/java/com/esri/hadoop/hive/ST_Centroid.java b/hive/src/main/java/com/esri/hadoop/hive/ST_Centroid.java index 7f70d95..22cb5cb 100644 --- a/hive/src/main/java/com/esri/hadoop/hive/ST_Centroid.java +++ b/hive/src/main/java/com/esri/hadoop/hive/ST_Centroid.java @@ -12,10 +12,14 @@ @Description( name = "ST_Centroid", - value = "_FUNC_(polygon) - returns the point that is the center of the polygon's envelope", + value = "_FUNC_(geometry) - returns the centroid of the geometry", extended = "Example:\n" - + " > SELECT _FUNC_(ST_GeomFromText('polygon ((0 0, 3 6, 6 0, 0 0))')) FROM src LIMIT 1; -- POINT(3 3)\n" - + " > SELECT _FUNC_(ST_GeomFromText('polygon ((0 0, 0 8, 8 0, 0 0))')) FROM src LIMIT 1; -- POINT(4 4)\n" + + " > SELECT _FUNC_(ST_GeomFromText('point (2 3)')); -- POINT(2 3)\n" + + " > SELECT _FUNC_(ST_GeomFromText('multipoint ((0 0), (1 1), (1 -1), (6 0))')); -- POINT(2 0)\n" + + " > SELECT _FUNC_(ST_GeomFromText('linestring ((0 0, 6 0))')); -- POINT(3 0)\n" + + " > SELECT _FUNC_(ST_GeomFromText('linestring ((0 0, 2 4, 6 8))')); -- POINT(3 4)\n" + + " > SELECT _FUNC_(ST_GeomFromText('polygon ((0 0, 0 8, 8 8, 8 0, 0 0))')); -- POINT(4 4)\n" + + " > SELECT _FUNC_(ST_GeomFromText('polygon ((1 1, 5 1, 3 4))')); -- POINT(3 2)\n" ) public class ST_Centroid extends ST_GeometryAccessor { @@ -33,25 +37,7 @@ public BytesWritable evaluate(BytesWritable geomref) { return null; } - GeometryUtils.OGCType ogcType = GeometryUtils.getType(geomref); - switch(ogcType) { - case ST_MULTIPOLYGON: - case ST_POLYGON: - int wkid = GeometryUtils.getWKID(geomref); - SpatialReference spatialReference = null; - if (wkid != GeometryUtils.WKID_UNKNOWN) { - spatialReference = SpatialReference.create(wkid); - } - Envelope envBound = new Envelope(); - ogcGeometry.getEsriGeometry().queryEnvelope(envBound); - Point centroid = new Point((envBound.getXMin() + envBound.getXMax()) / 2., - (envBound.getYMin() + envBound.getYMax()) / 2.); - return GeometryUtils.geometryToEsriShapeBytesWritable(OGCGeometry.createFromEsriGeometry(centroid, - spatialReference)); - default: - LogUtils.Log_InvalidType(LOG, GeometryUtils.OGCType.ST_POLYGON, ogcType); - return null; - } + return GeometryUtils.geometryToEsriShapeBytesWritable(ogcGeometry.centroid()); } } diff --git a/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromJson.java b/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromJson.java index 9d2ef54..4e375e5 100644 --- a/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromJson.java +++ b/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromJson.java @@ -12,8 +12,8 @@ import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector.Category; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector; import org.apache.hadoop.hive.serde2.objectinspector.PrimitiveObjectInspector.PrimitiveCategory; -import org.codehaus.jackson.JsonFactory; -import org.codehaus.jackson.JsonParseException; +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonParseException; import com.esri.core.geometry.ogc.OGCGeometry; diff --git a/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromShape.java b/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromShape.java index 1ee0539..4143f58 100644 --- a/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromShape.java +++ b/hive/src/main/java/com/esri/hadoop/hive/ST_GeomFromShape.java @@ -2,6 +2,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.ql.exec.Description; import org.apache.hadoop.hive.ql.exec.UDFArgumentException; import org.apache.hadoop.io.BytesWritable; @@ -10,6 +11,12 @@ import com.esri.core.geometry.SpatialReference; import com.esri.hadoop.hive.GeometryUtils.OGCType; +@Description( + name = "ST_GeomFromShape", + value = "_FUNC_(shape) - construct ST_Geometry from Esri shape representation of geometry\n", + extended = "Example:\n" + + " SELECT _FUNC_(ST_AsShape(ST_Point(1, 2))); -- constructs ST_Point\n" + ) public class ST_GeomFromShape extends ST_Geometry { static final Log LOG = LogFactory.getLog(ST_GeomFromShape.class.getName()); @@ -50,4 +57,4 @@ public BytesWritable evaluate(BytesWritable shape, int wkid) throws UDFArgumentE } } -} \ No newline at end of file +} diff --git a/hive/src/main/java/com/esri/hadoop/hive/serde/BaseJsonSerDe.java b/hive/src/main/java/com/esri/hadoop/hive/serde/BaseJsonSerDe.java index 8c03ae6..ff65454 100644 --- a/hive/src/main/java/com/esri/hadoop/hive/serde/BaseJsonSerDe.java +++ b/hive/src/main/java/com/esri/hadoop/hive/serde/BaseJsonSerDe.java @@ -71,14 +71,17 @@ abstract public class BaseJsonSerDe extends AbstractSerDe { ArrayList rowBase; ArrayList row; - @Override - public void initialize(Configuration cfg, Properties tbl) throws SerDeException { - + // Hive v4 adds a second Properties parameter + public void initialize(Configuration cfg, Properties tblProps, Properties partProps) throws SerDeException { + initialize(cfg, tblProps); + } + public void initialize(Configuration cfg, Properties tblProps) throws SerDeException { + geometryColumn = -1; // Read the configuration parameters - String columnNameProperty = tbl.getProperty(HiveShims.serdeConstants.LIST_COLUMNS); - String columnTypeProperty = tbl.getProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES); + String columnNameProperty = tblProps.getProperty(HiveShims.serdeConstants.LIST_COLUMNS); + String columnTypeProperty = tblProps.getProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES); ArrayList typeInfos = TypeInfoUtils .getTypeInfosFromTypeString(columnTypeProperty); @@ -147,7 +150,7 @@ public Object deserialize(Writable json_in) throws SerDeException { // null out array because we reuse it and we don't want values persisting // from the last record - for (int i=0;i= 0) { - jst = parseTime(value.substring(0,point+4)); // "yyyy-MM-dd HH:mm:ss.SSS" - truncate - // idea: jst.setNanos; alt: Java-8, JodaTime, javax.xml.bind.DatatypeConverter - } else { - jst = parseTime(value); // "yyyy-MM-dd HH:mm:ss.SSS" - String[] formats = {"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"}; - for (String format: formats) { - if (jst != null) break; - try { - jst = new java.sql.Timestamp(parseTime(value, format)); - } catch (java.text.ParseException e) { - // remain null - } + String dateStr = (point < 0) ? value : value.substring(0,point+4); + String[] formats = {"yyyy-MM-dd HH:mm:ss.SSS", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"}; + for (String format: formats) { + try { + epoch = parseTime(dateStr, format); + jtpe = null; + break; + } catch (java.text.ParseException exc) { + if (null == jtpe) + jtpe = exc; } } - } - return jst; - } - - private java.sql.Timestamp parseTime(String value) { - try { - return java.sql.Timestamp.valueOf(value); - } catch (IllegalArgumentException iae) { - return null; - } + } // else String value + if (null == jtpe) + return epoch; + else + throw jtpe; } private long parseTime(String value, String format) throws java.text.ParseException { // epoch - return new java.text.SimpleDateFormat(format).parse(value).getTime(); + java.text.SimpleDateFormat dtFmt = new java.text.SimpleDateFormat(format); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + return dtFmt.parse(value).getTime(); } /** @@ -397,8 +396,10 @@ private long parseTime(String value, String format) throws java.text.ParseExcept * @param parser JsonParser pointing to the attribute * @throws JsonParseException * @throws IOException + * @throws ParseException */ - private void setRowFieldFromParser(int fieldIndex, JsonParser parser) throws JsonParseException, IOException{ + private void setRowFieldFromParser(int fieldIndex, JsonParser parser) throws + JsonParseException, IOException, java.text.ParseException { PrimitiveObjectInspector poi = (PrimitiveObjectInspector)this.columnOIs.get(fieldIndex); if (JsonToken.VALUE_NULL == parser.getCurrentToken()) @@ -429,11 +430,11 @@ private void setRowFieldFromParser(int fieldIndex, JsonParser parser) throws Jso case BOOLEAN: ((BooleanWritable)row.get(fieldIndex)).set(parser.getBooleanValue()); break; - case DATE: // DateWritable stores days not milliseconds. - ((DateWritable)row.get(fieldIndex)).set(parseDate(parser)); + case DATE: // DateWritable stores days not milliseconds. See also HIVE-12192. + HiveShims.setDateWritable(row.get(fieldIndex), parseDate(parser)); break; case TIMESTAMP: - ((TimestampWritable)row.get(fieldIndex)).set(parseTime(parser)); + HiveShims.setTimeWritable(row.get(fieldIndex), parseTime(parser)); break; default: // STRING/unrecognized ((Text)row.get(fieldIndex)).set(parser.getText()); diff --git a/hive/src/main/java/com/esri/hadoop/shims/HiveShims.java b/hive/src/main/java/com/esri/hadoop/shims/HiveShims.java index 0e6170b..e957030 100644 --- a/hive/src/main/java/com/esri/hadoop/shims/HiveShims.java +++ b/hive/src/main/java/com/esri/hadoop/shims/HiveShims.java @@ -1,27 +1,38 @@ package com.esri.hadoop.shims; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Properties; +import java.util.TimeZone; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.hive.serde2.AbstractSerDe; + + +/** + * These shims are internal to Spatial-Framework-for-Hadoop and subject to change without notice. + */ public class HiveShims { /** * This class is supplied for compatibility between Hive versions. - * At 10.0 the serde constants were moved to another package. Also, - * at 11.0 the previous class will be re-added for backwards - * compatibility, but deprecated + * At 0.10 the serde constants were moved to another package. Also, + * at 0.11 the previous class will be re-added for backwards + * compatibility, but deprecated. * */ public static class serdeConstants { public static final String LIST_COLUMNS; public static final String LIST_COLUMN_TYPES; - + static { Class clazz = null; try { - // Hive 10 and above constants + // Hive 0.10 and above constants clazz = Class.forName("org.apache.hadoop.hive.serde.serdeConstants"); } catch (ClassNotFoundException e) { try { - // Hive 9 and below constants + // Hive 0.9 and below constants clazz = Class.forName("org.apache.hadoop.hive.serde.Constants"); } catch (ClassNotFoundException e1) { // not much we can do here @@ -31,7 +42,7 @@ public static class serdeConstants { LIST_COLUMNS = getAsStringOrNull(clazz, "LIST_COLUMNS"); LIST_COLUMN_TYPES = getAsStringOrNull(clazz, "LIST_COLUMN_TYPES"); } - + static String getAsStringOrNull(Class clazz, String constant) { try { return (String) clazz.getField(constant).get(null); @@ -40,4 +51,100 @@ static String getAsStringOrNull(Class clazz, String constant) { } } } + + /** + * Classes o.a.h.h.common.type Date & Timestamp were introduced in Hive-3.1 version. + */ + public static Long getPrimitiveEpoch(Object prim) { + if (prim instanceof java.sql.Timestamp) { + return ((java.sql.Timestamp)prim).getTime(); + } else if (prim instanceof java.util.Date) { + return ((java.util.Date)prim).getTime(); + } else { + try { + Class dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date"); + if (prim.getClass() == dtClazz) { + Method dtGetImpl = dtClazz.getMethod("toEpochMilli"); + return (java.lang.Long)(dtGetImpl.invoke(prim)); + } else { + Class ttClazz = Class.forName("org.apache.hadoop.hive.common.type.Timestamp"); + if (prim.getClass() == ttClazz) { + Method ttGetImpl = ttClazz.getMethod("toEpochMilli"); + return (java.lang.Long)(ttGetImpl.invoke(prim)); + } else { + return null; + } + } + } catch (Exception exc) { + return null; + } + } + } + + /** + * // Hive v4 adds a second Properties parameter to AbstractSerDe#initialize. + */ + public static void initSerDe(AbstractSerDe jserde, Configuration cfg, Properties tblProps) + throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { + try { // Hive-4 + Method initImpl = jserde.getClass().getMethod("initialize", Configuration.class, + Properties.class, Properties.class); + initImpl.invoke(jserde, cfg, tblProps, null); + } catch (Exception exc) { // Hive-3 + Method initImpl = jserde.getClass().getMethod("initialize", Configuration.class, Properties.class); + initImpl.invoke(jserde, cfg, tblProps); + } + } + + /** + * Type DATE was introduced in Hive-0.12 - class DateWritable in API. + * Class DateWritableV2 is used instead as of Hive-3.1 version. + */ + // See HIVE-12192. + public static void setDateWritable(Object dwHive, long epoch) { + try { // Hive 3.1 and above + Class dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date"); + Class dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritableV2"); + Method dtSetImpl = dtClazz.getMethod("setTimeInMillis", long.class); + Method dwSetImpl = dwClazz.getMethod("set", dtClazz); + Object dtObj = dtClazz.getConstructor().newInstance(); + dtSetImpl.invoke(dtObj, epoch); + dwSetImpl.invoke(dwHive, dtObj); + } catch (Exception e1) { + try { // Hive 0.12 and above + Class dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritable"); + Method dwSetImpl = dwClazz.getMethod("set", java.sql.Date.class); + dwSetImpl.invoke(dwHive, new java.sql.Date(epoch)); + } catch (Exception e2) { // Hive 0.11 and below + // column type DATE not supported + throw new UnsupportedOperationException("DATE type"); + } + } + } // setDateWritable + + /** + * Type TIMESTAMP was introduced in Hive-0.12 - class TimestampWritable in API. + * Class TimestampWritableV2 is used instead as of Hive-3.1 version. + */ + public static void setTimeWritable(Object twHive, long epoch) { + try { // Hive 3.1 and above + Class ttClazz = Class.forName("org.apache.hadoop.hive.common.type.Timestamp"); + Class twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritableV2"); + Method ttSetImpl = ttClazz.getMethod("setTimeInMillis", long.class); + Method twSetImpl = twClazz.getMethod("set", ttClazz); + Object ttObj = ttClazz.getConstructor().newInstance(); + ttSetImpl.invoke(ttObj, epoch); + twSetImpl.invoke(twHive, ttObj); + } catch (Exception e1) { + try { // Hive 0.12 and above + Class twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritable"); + Method twSetImpl = twClazz.getMethod("set", java.sql.Timestamp.class); + twSetImpl.invoke(twHive, new java.sql.Timestamp(epoch)); + } catch (Exception e2) { // Hive 0.11 and below + // column type TIMESTAMP not supported + throw new UnsupportedOperationException("TIMESTAMP type"); + } + } + } // setTimeWritable + } diff --git a/hive/src/test/java/com/esri/hadoop/hive/TestStCentroid.java b/hive/src/test/java/com/esri/hadoop/hive/TestStCentroid.java new file mode 100644 index 0000000..9a5ada4 --- /dev/null +++ b/hive/src/test/java/com/esri/hadoop/hive/TestStCentroid.java @@ -0,0 +1,90 @@ +package com.esri.hadoop.hive; + +import static org.junit.Assert.*; +import org.junit.Test; + +import org.apache.hadoop.io.BytesWritable; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.hive.serde2.io.DoubleWritable; + +import com.esri.core.geometry.Point; + + +public class TestStCentroid { + + private final static double Epsilon = 0.0001; + + @Test + public void TestSimplePointCentroid() throws Exception { + final ST_Centroid stCtr = new ST_Centroid(); + final ST_Point stPt = new ST_Point(); + BytesWritable bwGeom = stPt.evaluate(new Text("point (2 3)")); + BytesWritable bwCentroid = stCtr.evaluate(bwGeom); + validatePoint(new Point(2,3), bwCentroid); + } + + @Test + public void TestMultiPointCentroid() throws Exception { + final ST_Centroid stCtr = new ST_Centroid(); + final ST_MultiPoint stMp = new ST_MultiPoint(); + BytesWritable bwGeom = stMp.evaluate(new Text("multipoint ((0 0), (1 1), (1 -1), (6 0))")); + BytesWritable bwCentroid = stCtr.evaluate(bwGeom); + validatePoint(new Point(2,0), bwCentroid); + } + + @Test + public void TestLineCentroid() throws Exception { + final ST_Centroid stCtr = new ST_Centroid(); + final ST_LineString stLn = new ST_LineString(); + BytesWritable bwGeom = stLn.evaluate(new Text("linestring (0 0, 6 0)")); + BytesWritable bwCentroid = stCtr.evaluate(bwGeom); + validatePoint(new Point(3,0), bwCentroid); + bwGeom = stLn.evaluate(new Text("linestring (0 0, 0 4, 12 4)")); + bwCentroid = stCtr.evaluate(bwGeom); + // L1 = 4, L2 = 12, W1 = 0.25, W2 = 0.75, X = W1 * 0 + W2 * 6, Y = W1 * 2 + W2 * 4 + // Or like centroid of multipoint of 1 of (0 2) and 3 of (6 4) + validatePoint(new Point(4.5, 3.5), bwCentroid); + } + + @Test + public void TestPolygonCentroid() throws Exception { + final ST_Centroid stCtr = new ST_Centroid(); + final ST_Polygon stPoly = new ST_Polygon(); + BytesWritable bwGeom = stPoly.evaluate(new Text("polygon ((0 0, 0 8, 8 8, 8 0, 0 0))")); + BytesWritable bwCentroid = stCtr.evaluate(bwGeom); + validatePoint(new Point(4,4), bwCentroid); + bwGeom = stPoly.evaluate(new Text("polygon ((1 1, 5 1, 3 4, 1 1))")); + bwCentroid = stCtr.evaluate(bwGeom); + validatePoint(new Point(3,2), bwCentroid); + bwGeom = stPoly.evaluate(new Text("polygon ((14 0, -14 0, -2 24, 2 24, 14 0))")); + bwCentroid = stCtr.evaluate(bwGeom); // Cross-checked with ... + validatePoint(new Point(0,9), bwCentroid); // ... omnicalculator.com/math/centroid + } + + /** + * Validates the centroid geometry writable. + * + * @param point + * the represented point location. + * @param geometryAsWritable + * the geometry represented as {@link BytesWritable}. + */ + private static void validatePoint(Point point, BytesWritable geometryAsWritable) { + ST_X getX = new ST_X(); + ST_Y getY = new ST_Y(); + DoubleWritable xAsWritable = getX.evaluate(geometryAsWritable); + DoubleWritable yAsWritable = getY.evaluate(geometryAsWritable); + + if (null == xAsWritable || null == yAsWritable || + Math.abs(point.getX() - xAsWritable.get()) > Epsilon || + Math.abs(point.getY() - yAsWritable.get()) > Epsilon) + System.err.println("validateCentroid: " + (new ST_AsText()).evaluate(geometryAsWritable) + + " ~ " + point); + + assertNotNull("The x writable must not be null!", xAsWritable); + assertNotNull("The y writable must not be null!", yAsWritable); + assertEquals("Longitude is different!", point.getX(), xAsWritable.get(), Epsilon); + assertEquals("Latitude is different!", point.getY(), yAsWritable.get(), Epsilon); + } + +} diff --git a/hive/src/test/java/com/esri/hadoop/hive/serde/JsonSerDeTestingBase.java b/hive/src/test/java/com/esri/hadoop/hive/serde/JsonSerDeTestingBase.java index 4e938f2..5d2a4eb 100644 --- a/hive/src/test/java/com/esri/hadoop/hive/serde/JsonSerDeTestingBase.java +++ b/hive/src/test/java/com/esri/hadoop/hive/serde/JsonSerDeTestingBase.java @@ -1,6 +1,7 @@ package com.esri.hadoop.hive.serde; import org.junit.Assert; +import java.lang.reflect.Method; import java.util.ArrayList; import org.apache.hadoop.hive.serde2.AbstractSerDe; @@ -53,11 +54,35 @@ protected void addWritable(ArrayList stuff, String item) { } protected void addWritable(ArrayList stuff, java.sql.Date item) { - stuff.add(new DateWritable(item)); - } + try { + Class dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date"); + Class dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritableV2"); + Method dtSetImpl = dtClazz.getMethod("setTimeInMillis", long.class); + Method dwSetImpl = dwClazz.getMethod("set", dtClazz); + Object dtObj = dtClazz.getConstructor().newInstance(); + dtSetImpl.invoke(dtObj, item.getTime()); + Object dwObj = dwClazz.getConstructor().newInstance(); + dwSetImpl.invoke(dwObj, dtObj); + stuff.add(dwObj); + } catch (Exception exc) { + stuff.add(new DateWritable(item)); + } + } protected void addWritable(ArrayList stuff, java.sql.Timestamp item) { - stuff.add(new TimestampWritable(item)); + try { + Class ttClazz = Class.forName("org.apache.hadoop.hive.common.type.Timestamp"); + Class twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritableV2"); + Method ttSetImpl = ttClazz.getMethod("setTimeInMillis", long.class); + Method twSetImpl = twClazz.getMethod("set", ttClazz); + Object ttObj = ttClazz.getConstructor().newInstance(); + ttSetImpl.invoke(ttObj, item.getTime()); + Object twObj = twClazz.getConstructor().newInstance(); + twSetImpl.invoke(twObj, ttObj); + stuff.add(twObj); + } catch (Exception exc) { + stuff.add(new TimestampWritable(item)); + } } protected void addWritable(ArrayList stuff, Geometry geom) { @@ -77,6 +102,38 @@ protected void ckPoint(Point refPt, BytesWritable fieldData) { GeometryUtils.geometryFromEsriShape(fieldData).getEsriGeometry()); } + protected long epochFromWritable(Object dwHive) throws Exception { + // Hive 0.12 and above + Class dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritable"); + Method dwGetImpl = dwClazz.getMethod("get"); + Class twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritable"); + Method twGetImpl = twClazz.getMethod("getTimestamp"); + if (dwHive.getClass() == dwClazz) { + // Counter the time-zone adjustment done by DateWritable#daysToMillis . + // What the product should do about that is another discussion. + long epoch = ((java.util.Date)(dwGetImpl.invoke(dwHive))).getTime(); + return epoch + java.util.TimeZone.getDefault().getOffset(epoch); + } else if (dwHive.getClass() == twClazz) { + return ((java.sql.Timestamp)(twGetImpl.invoke(dwHive))).getTime(); + } else { + // Hive 3.1 and above + dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritableV2"); + twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritableV2"); + if (dwHive.getClass() == dwClazz) { + Class dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date"); + Method dtGetImpl = dtClazz.getMethod("toEpochMilli"); + dwGetImpl = dwClazz.getMethod("get"); + // Object dtObj = dtClazz.getConstructor().newInstance(); + return ((java.lang.Long)(dtGetImpl.invoke(dwGetImpl.invoke(dwHive)))).longValue(); + } else { // dwHive.getClass() == twClazz + Class ttClazz = Class.forName("org.apache.hadoop.hive.common.type.Timestamp"); + Method ttGetImpl = ttClazz.getMethod("toEpochMilli"); + twGetImpl = twClazz.getMethod("getTimestamp"); + return ((java.lang.Long)(ttGetImpl.invoke(twGetImpl.invoke(dwHive)))).longValue(); + } + } + } // epochFromWritable + protected Object getField(String col, Object row, StructObjectInspector rowOI) { StructField f0 = rowOI.getStructFieldRef(col); return rowOI.getStructFieldData(row, f0); @@ -84,8 +141,42 @@ protected Object getField(String col, Object row, StructObjectInspector rowOI) { protected Object runSerDe(Object stuff, AbstractSerDe jserde, StructObjectInspector rowOI) throws Exception { Writable jsw = jserde.serialize(stuff, rowOI); - //System.err.println(jsw); return jserde.deserialize(jsw); } + protected String iso8601FromWritable(Object dtwHive) throws Exception { + // Hive 0.12 and above + Class dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritable"); + Method dwGetImpl = dwClazz.getMethod("get"); + Class twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritable"); + Method twGetImpl = twClazz.getMethod("getTimestamp"); + if (dtwHive.getClass() == dwClazz) { + java.util.Date localDay = (java.util.Date)(dwGetImpl.invoke(dtwHive)); + java.text.SimpleDateFormat dtFmt = new java.text.SimpleDateFormat("yyyy-MM-dd"); + dtFmt.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); + return dtFmt.format(localDay); + } else if (dtwHive.getClass() == twClazz) { + java.text.SimpleDateFormat dtFmt = new java.text.SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss.SSS"); + dtFmt.setTimeZone(java.util.TimeZone.getTimeZone("UTC")); + java.sql.Timestamp localDt = (java.sql.Timestamp)(twGetImpl.invoke(dtwHive)); + // return localDt.toString(); + return dtFmt.format(localDt); + } else { + // Hive 3.1 and above + dwClazz = Class.forName("org.apache.hadoop.hive.serde2.io.DateWritableV2"); + twClazz = Class.forName("org.apache.hadoop.hive.serde2.io.TimestampWritableV2"); + if (dtwHive.getClass() == dwClazz) { + Class dtClazz = Class.forName("org.apache.hadoop.hive.common.type.Date"); + Method dtGetImpl = dtClazz.getMethod("toString"); + dwGetImpl = dwClazz.getMethod("get"); + // Object dtObj = dtClazz.getConstructor().newInstance(); + return (String)(dtGetImpl.invoke(dwGetImpl.invoke(dtwHive))); + } else { // dtwHive.getClass() == twClazz + Class ttClazz = Class.forName("org.apache.hadoop.hive.common.type.Timestamp"); + twGetImpl = twClazz.getMethod("toString"); + return (String)(twGetImpl.invoke(dtwHive)); + } + } + } // epochFromWritable + } diff --git a/hive/src/test/java/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java b/hive/src/test/java/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java index f829e08..351f264 100644 --- a/hive/src/test/java/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java +++ b/hive/src/test/java/com/esri/hadoop/hive/serde/TestEsriJsonSerDe.java @@ -3,8 +3,11 @@ import org.junit.Assert; import org.junit.Test; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Properties; +import java.util.TimeZone; + import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.serde2.AbstractSerDe; import org.apache.hadoop.hive.serde2.io.ByteWritable; @@ -24,8 +27,8 @@ import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.esri.core.geometry.Geometry; import com.esri.core.geometry.Point; @@ -56,29 +59,39 @@ public void TestIntWrite() throws Exception { JsonNode jn = new ObjectMapper().readTree(((Text)jsw).toString()); jn = jn.findValue("attributes"); jn = jn.findValue("num"); - Assert.assertEquals(7, jn.getIntValue()); + Assert.assertEquals(7, jn.asInt()); } @Test public void TestEpochWrite() throws Exception { - ArrayList stuff = new ArrayList(); Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); AbstractSerDe jserde = mkSerDe(proptab); - StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); - - // {"attributes":{"when":147147147147}} - long epoch = 147147147147L; - java.sql.Date expected = new java.sql.Date(epoch); - //System.err.println(expected.getTime()); - addWritable(stuff, expected); - Writable jsw = jserde.serialize(stuff, rowOI); + StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); + long day = 24*3600*1000; // DateWritable represents days not milliseconds. + + long epoch = 1641535200000L; // 2022-01-07 06:00 UTC + //long zoned = epoch - TimeZone.getDefault().getOffset(epoch); + java.sql.Date jsd = new java.sql.Date(epoch); // zoned? + ArrayList stuff = new ArrayList(); + addWritable(stuff, jsd); + Writable jsw = jserde.serialize(stuff, rowOI); JsonNode jn = new ObjectMapper().readTree(((Text)jsw).toString()); jn = jn.findValue("attributes"); jn = jn.findValue("when"); - java.sql.Date actual = new java.sql.Date(jn.getLongValue()); - Assert.assertEquals(expected.toString(), actual.toString()); // workaround DateWritable,j.s.Date + Assert.assertEquals(epoch/day, jn.asLong()/day); + + epoch = 1641578400000L; // 2022-01-07 18:00 UTC + //long zoned = epoch - TimeZone.getDefault().getOffset(epoch); + jsd = new java.sql.Date(epoch); // zoned? + stuff = new ArrayList(); + addWritable(stuff, jsd); + jsw = jserde.serialize(stuff, rowOI); + jn = new ObjectMapper().readTree(((Text)jsw).toString()); + jn = jn.findValue("attributes"); + jn = jn.findValue("when"); + Assert.assertEquals(epoch/day, jn.asLong()/day); } @Test @@ -94,12 +107,12 @@ public void TestTimeWrite() throws Exception { long epoch = 147147147147L; java.sql.Timestamp expected = new java.sql.Timestamp(epoch); addWritable(stuff, expected); - Writable jsw = jserde.serialize(stuff, rowOI); + Writable jsw = jserde.serialize(stuff, rowOI); JsonNode jn = new ObjectMapper().readTree(((Text)jsw).toString()); jn = jn.findValue("attributes"); jn = jn.findValue("when"); - java.sql.Timestamp actual = new java.sql.Timestamp(jn.getLongValue()); - Assert.assertEquals(expected, actual); + java.sql.Timestamp actual = new java.sql.Timestamp(jn.asLong()); + Assert.assertEquals(epoch, actual.getTime()); } @Test @@ -130,7 +143,7 @@ public void TestIntParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "int"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); //value.set("{\"attributes\":{\"num\":7},\"geometry\":null}"); @@ -148,6 +161,10 @@ public void TestIntParse() throws Exception { @Test public void TestDateParse() throws Exception { + // DateWritable#daysToMillis adjusts the numerical/epoch time + // to midnight in the local time zone - but only prior to Hive-3.1 (HIVE-12192). + // Raises questions about what the product source code should do, + // but at least in the meantime the test expectations match that. Configuration config = new Configuration(); Text value = new Text(); @@ -155,20 +172,20 @@ public void TestDateParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); - value.set("{\"attributes\":{\"when\":\"2020-02-20\"}}"); + String dateStr = "2020-02-20"; + value.set("{\"attributes\":{\"when\":\"" + dateStr + "\"}}"); Object row = jserde.deserialize(value); StructField f0 = rowOI.getStructFieldRef("when"); Object fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals("2020-02-20", - ((DateWritable)fieldData).get().toString()); - value.set("{\"attributes\":{\"when\":\"2017-05-05\"}}"); + Assert.assertEquals(dateStr, iso8601FromWritable(fieldData)); + dateStr = "2017-05-05"; + value.set("{\"attributes\":{\"when\":\"" + dateStr + "\"}}"); row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals("2017-05-05", - ((DateWritable)fieldData).get().toString()); + Assert.assertEquals(dateStr, iso8601FromWritable(fieldData)); } @Test @@ -180,22 +197,23 @@ public void TestEpochParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); + // Half a day apart to test both a.m. & p.m. whether in East or West - value.set("{\"attributes\":{\"when\":147147147147}}"); + value.set("{\"attributes\":{\"when\":1641535200000}}"); // 2022-01-07 06:00 UTC Object row = jserde.deserialize(value); StructField f0 = rowOI.getStructFieldRef("when"); Object fieldData = rowOI.getStructFieldData(row, f0); - //Assert.assertEquals(147147147147L, ((DateWritable)fieldData).get().getTime()); - Assert.assertEquals(new java.sql.Date(147147147147L).toString(), - ((DateWritable)fieldData).get().toString()); - value.set("{\"attributes\":{\"when\":142857142857}}"); + long day = 24*3600*1000; // DateWritable represents days not milliseconds. + long epochExpected = 1641535200000L; // or likely 00:00 UTC + Assert.assertEquals(epochExpected/day, epochFromWritable(fieldData)/day); + + value.set("{\"attributes\":{\"when\":1641578400000}}"); // 2022-01-07 18:00 UTC row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - //Assert.assertEquals(142857142857L, ((DateWritable)fieldData).get()); - Assert.assertEquals(new java.sql.Date(142857142857L).toString(), - ((DateWritable)fieldData).get().toString()); + epochExpected = 1641578400000L; // or likely 00:00 UTC + Assert.assertEquals(epochExpected/day, epochFromWritable(fieldData)/day); } @Test @@ -207,34 +225,56 @@ public void TestTimeParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "timestamp"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); - value.set("{\"attributes\":{\"when\":\"2020-02-20\"}}"); + String timeStr = "2020-02-20"; + value.set("{\"attributes\":{\"when\":\"" + timeStr + "\"}}"); Object row = jserde.deserialize(value); StructField f0 = rowOI.getStructFieldRef("when"); Object fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals( - new java.text.SimpleDateFormat("yyyy-MM-dd").parse("2020-02-20").getTime(), - ((TimestampWritable)fieldData).getTimestamp().getTime()); - value.set("{\"attributes\":{\"when\":\"2017-05-05 05:05\"}}"); + SimpleDateFormat dtFmt = new SimpleDateFormat("yyyy-MM-dd"); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + long epoch = dtFmt.parse(timeStr).getTime(); + long + withOffset = epoch - TimeZone.getDefault().getOffset(epoch); + long got = epochFromWritable(fieldData); + Assert.assertEquals(epoch, got); + timeStr = "2017-05-05 05:05"; + value.set("{\"attributes\":{\"when\":\"" + timeStr + "\"}}"); row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals( - new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm").parse("2017-05-05 05:05").getTime(), - ((TimestampWritable)fieldData).getTimestamp().getTime()); - value.set("{\"attributes\":{\"when\":\"2017-08-09 10:11:12\"}}"); + dtFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + epoch = dtFmt.parse(timeStr).getTime(); + got = epochFromWritable(fieldData); + Assert.assertEquals(timeStr, iso8601FromWritable(fieldData).substring(0,16)); + Assert.assertEquals(epoch, got); + + timeStr = "2017-08-09 10:11:12"; + value.set("{\"attributes\":{\"when\":\"" + timeStr + "\"}}"); row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals( - new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2017-08-09 10:11:12").getTime(), - ((TimestampWritable)fieldData).getTimestamp().getTime()); - value.set("{\"attributes\":{\"when\":\"2017-06-05 04:03:02.123456789\"}}"); + dtFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + epoch = dtFmt.parse(timeStr+'Z').getTime(); + withOffset = epoch - TimeZone.getDefault().getOffset(epoch); + got = epochFromWritable(fieldData); + Assert.assertEquals(timeStr, iso8601FromWritable(fieldData).substring(0,19)); + Assert.assertEquals(epoch, got); + + timeStr = "2017-06-05 04:03:02.123456789"; + value.set("{\"attributes\":{\"when\":\"" + timeStr + "\"}}"); row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals( - new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2017-06-05 04:03:02.123").getTime(), - ((TimestampWritable)fieldData).getTimestamp().getTime()); // ns parsed but not checked + dtFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm.SSS"); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + dtFmt = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + dtFmt.setTimeZone(TimeZone.getTimeZone("UTC")); + epoch = dtFmt.parse(timeStr.substring(0,23)).getTime(); + withOffset = epoch - TimeZone.getDefault().getOffset(epoch); + got = epochFromWritable(fieldData); + Assert.assertEquals(epoch, got); // ns consumed by parser but not checked } @Test @@ -246,7 +286,7 @@ public void TestPointParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "binary"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); value.set("{\"attributes\":{},\"geometry\":{\"x\":15.0,\"y\":5.0}}"); @@ -421,42 +461,11 @@ public void TestColumnTypes() throws Exception { fieldData = getField("text", row, rowOI); Assert.assertEquals("other", ((Text)fieldData).toString()); } - /* * - @Deprecated -> Obsolete - @Test - public void LegacyName() throws Exception { - ArrayList stuff = new ArrayList(); - Properties proptab = new Properties(); - proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num,shape"); - proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "bigint,binary"); - Configuration config = new Configuration(); - AbstractSerDe jserde = new JsonSerde(); - jserde.initialize(config, proptab); - StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); - - //value.set("{\"attributes\":{\"num\":7},\"geometry\":{\"x\":15.0,\"y\":5.0}}"); - addWritable(stuff, 7L); - addWritable(stuff, new Point(15.0, 5.0)); - Object row = runSerDe(stuff, jserde, rowOI); - Object fieldData = getField("num", row, rowOI); - Assert.assertEquals(7, ((LongWritable)fieldData).get()); - - //value.set("{\"attributes\":{\"num\":4},\"geometry\":{\"x\":7.0,\"y\":2.0}}"); - stuff.clear(); - addWritable(stuff, 4L); - addWritable(stuff, new Point(7.0, 2.0)); - row = runSerDe(stuff, jserde, rowOI); - fieldData = getField("num", row, rowOI); - Assert.assertEquals(4, ((LongWritable)fieldData).get()); - fieldData = getField("shape", row, rowOI); - ckPoint(new Point(7.0, 2.0), (BytesWritable)fieldData); - } - * */ private AbstractSerDe mkSerDe(Properties proptab) throws Exception { Configuration config = new Configuration(); AbstractSerDe jserde = new EsriJsonSerDe(); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); return jserde; } diff --git a/hive/src/test/java/com/esri/hadoop/hive/serde/TestGeoJsonSerDe.java b/hive/src/test/java/com/esri/hadoop/hive/serde/TestGeoJsonSerDe.java index e3a5a7d..57f4089 100644 --- a/hive/src/test/java/com/esri/hadoop/hive/serde/TestGeoJsonSerDe.java +++ b/hive/src/test/java/com/esri/hadoop/hive/serde/TestGeoJsonSerDe.java @@ -17,8 +17,8 @@ import org.apache.hadoop.io.Text; import org.apache.hadoop.io.Writable; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.esri.core.geometry.Geometry; import com.esri.core.geometry.Point; @@ -49,29 +49,39 @@ public void TestIntWrite() throws Exception { JsonNode jn = new ObjectMapper().readTree(((Text)jsw).toString()); jn = jn.findValue("properties"); jn = jn.findValue("num"); - Assert.assertEquals(7, jn.getIntValue()); + Assert.assertEquals(7, jn.asInt()); } @Test public void TestEpochWrite() throws Exception { - ArrayList stuff = new ArrayList(); Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); AbstractSerDe jserde = mkSerDe(proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); + long day = 24*3600*1000; // DateWritable represents days not milliseconds. - // {"properties":{"when":147147147147}} - long epoch = 0L; // 147147147147L; - java.sql.Date expected = new java.sql.Date(epoch - TimeZone.getDefault().getOffset(epoch)); - addWritable(stuff, expected); - Writable jsw = jserde.serialize(stuff, rowOI); + long epoch = 1641535200000L; // 2022-01-07 06:00 UTC + java.sql.Date jsd = new java.sql.Date(epoch); // zoned? + ArrayList stuff = new ArrayList(); + addWritable(stuff, jsd); + Writable jsw = jserde.serialize(stuff, rowOI); JsonNode jn = new ObjectMapper().readTree(((Text)jsw).toString()); jn = jn.findValue("properties"); jn = jn.findValue("when"); - java.sql.Date actual = new java.sql.Date(jn.getLongValue()); - long day = 24*3600*1000; // DateWritable stores days not milliseconds. - Assert.assertEquals(epoch/day, jn.getLongValue()/day); + Assert.assertEquals(epoch/day, jn.asLong()/day); + + epoch = 1641578400000L; // 2022-01-07 18:00 UTC + //long zoned = epoch - TimeZone.getDefault().getOffset(epoch); + jsd = new java.sql.Date(epoch); // zoned? + stuff = new ArrayList(); + addWritable(stuff, jsd); + jsw = jserde.serialize(stuff, rowOI); + jn = new ObjectMapper().readTree(((Text)jsw).toString()); + jn = jn.findValue("properties"); + jn = jn.findValue("when"); + System.err.println(jn); + Assert.assertEquals(epoch/day, jn.asLong()/day); } @Test @@ -102,7 +112,7 @@ public void TestIntParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "num"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "int"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); value.set("{\"properties\":{\"num\":7}}"); @@ -119,6 +129,10 @@ public void TestIntParse() throws Exception { @Test public void TestDateParse() throws Exception { + // DateWritable#daysToMillis adjusts the numerical/epoch time + // to midnight in the local time zone - but only prior to Hive-3.1 (HIVE-12192). + // Raises questions about what the product source code should do, + // but at least in the meantime the test expectations match that. Configuration config = new Configuration(); Text value = new Text(); @@ -126,20 +140,20 @@ public void TestDateParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); - value.set("{\"properties\":{\"when\":\"2020-02-20\"}}"); + String dateStr = "2020-02-20"; + value.set("{\"properties\":{\"when\":\"" + dateStr + "\"}}"); Object row = jserde.deserialize(value); StructField f0 = rowOI.getStructFieldRef("when"); Object fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals("2020-02-20", - ((DateWritable)fieldData).get().toString()); - value.set("{\"properties\":{\"when\":\"2017-05-05\"}}"); + Assert.assertEquals(dateStr, iso8601FromWritable(fieldData)); + dateStr = "2017-05-05"; + value.set("{\"properties\":{\"when\":\"" + dateStr + "\"}}"); row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - Assert.assertEquals("2017-05-05", - ((DateWritable)fieldData).get().toString()); + Assert.assertEquals(dateStr, iso8601FromWritable(fieldData)); } @Test @@ -151,22 +165,23 @@ public void TestEpochParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "when"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "date"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); + // Half a day apart to test both a.m. & p.m. whether in East or West - value.set("{\"properties\":{\"when\":147147147147}}"); + value.set("{\"properties\":{\"when\":1641535200000}}"); // 2022-01-07 06:00 UTC Object row = jserde.deserialize(value); StructField f0 = rowOI.getStructFieldRef("when"); Object fieldData = rowOI.getStructFieldData(row, f0); - //Assert.assertEquals(147147147147L, ((DateWritable)fieldData).get().getTime()); - Assert.assertEquals(new java.sql.Date(147147147147L).toString(), - ((DateWritable)fieldData).get().toString()); - value.set("{\"properties\":{\"when\":142857142857}}"); + long day = 24*3600*1000; // DateWritable represents days not milliseconds. + long epochExpected = 1641535200000L; // or likely 00:00 UTC + Assert.assertEquals(epochExpected/day, epochFromWritable(fieldData)/day); + + value.set("{\"properties\":{\"when\":1641578400000}}"); // 2022-01-07 18:00 UTC row = jserde.deserialize(value); fieldData = rowOI.getStructFieldData(row, f0); - //Assert.assertEquals(142857142857L, ((DateWritable)fieldData).get()); - Assert.assertEquals(new java.sql.Date(142857142857L).toString(), - ((DateWritable)fieldData).get().toString()); + epochExpected = 1641578400000L; // or likely 00:00 UTC + Assert.assertEquals(epochExpected/day, epochFromWritable(fieldData)/day); } @Test @@ -178,7 +193,7 @@ public void TestPointParse() throws Exception { Properties proptab = new Properties(); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMNS, "shape"); proptab.setProperty(HiveShims.serdeConstants.LIST_COLUMN_TYPES, "binary"); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); StructObjectInspector rowOI = (StructObjectInspector)jserde.getObjectInspector(); value.set("{\"properties\":{},\"geometry\":{\"type\":\"Point\",\"coordinates\":[15.0,5.0]}}"); @@ -312,7 +327,7 @@ public void TestNullGeom() throws Exception { private AbstractSerDe mkSerDe(Properties proptab) throws Exception { Configuration config = new Configuration(); AbstractSerDe jserde = new GeoJsonSerDe(); - jserde.initialize(config, proptab); + HiveShims.initSerDe(jserde, config, proptab); return jserde; } diff --git a/hive/test/st-geom-exact.sql b/hive/test/st-geom-exact.sql index a26e666..6637e50 100644 --- a/hive/test/st-geom-exact.sql +++ b/hive/test/st-geom-exact.sql @@ -1,354 +1,354 @@ -select ST_GeometryType(ST_Point(0, 0)) from onerow; -select ST_GeometryType(ST_Point('point (10.02 20.01)')) from onerow; -select ST_GeometryType(ST_Point('point z (10.02 20.01 2)')) from onerow; -select ST_GeometryType(ST_MultiPoint('multipoint ((1 2))')) from onerow; -select ST_GeometryType(ST_Linestring(10,10, 20,20)) from onerow; -select ST_GeometryType(ST_Linestring('linestring (10 10, 20 20)')) from onerow; -select ST_GeometryType(ST_Linestring('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_GeometryType(ST_GeomFromText('polygon ((0 0, 0 10, 10 0, 0 0))')) from onerow; -select ST_GeometryType(ST_Polygon('polygon ((0 0, 0 10, 10 0, 0 0))')) from onerow; -select ST_GeometryType(ST_Polygon(1,1, 1,4, 4,1)) from onerow; -select ST_GeometryType(ST_Polygon(1,1, 4,1, 1,4)) from onerow; -select ST_GeometryType(ST_Polygon(1,1, 1,4, 4,1, 1,1)) from onerow; -select ST_GeometryType(ST_Polygon(1,1, 4,1, 1,4, 1,1)) from onerow; -select ST_GeometryType(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')) from onerow; -select ST_X(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')) from onerow; -select ST_Y(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')) from onerow; -select ST_MinY(ST_GeomFromGeoJson('{"type":"LineString", "coordinates":[[1,2], [3,4]]}')) from onerow; -select ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJson(ST_Point(1.2, 2.4)))) from onerow; -select ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJson(ST_LineString(1,2, 3,4)))) from onerow; -SELECT ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJSON(ST_MultiLineString(array(1, 1, 2, 2, 3, 3), array(10, 10, 11, 11, 12, 12))))) from onerow; -select ST_NumPoints(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)) from onerow; -select ST_NumPoints(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5, 2.5)) from onerow; -select ST_NumPoints(ST_Polygon(0.1,2.2, 3.0,2.2, 2.2,1.1, 0.1, 2.2)) from onerow; -select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1, 1,1)) from onerow; -select ST_IsEmpty(ST_Point(0,0)) from onerow; -select ST_IsSimple(ST_Point(0,0)) from onerow; -select ST_IsSimple(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_IsSimple(ST_LineString(0.,0., 1.,1., 0.,1., 1.,0.)) from onerow; -select ST_IsSimple(ST_LineString(0.,0., 1.,1., 2.,2., 2.,0., 1.,1., 0.,2.)) from onerow; -select ST_IsSimple(ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_IsSimple(ST_LineString(10,10, 20,20, 20,30, 10,30, 10,20, 20,10)) from onerow; -select ST_IsSimple(ST_LineString(0.,0., 1.,0., 1.,1., 0.,2., 2.,2., 1.,1., 2.,0.)) from onerow; -select ST_IsSimple(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_Dimension(ST_Point(0,0)) from onerow; -select ST_Dimension(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_Dimension(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)) from onerow; -select ST_Dimension(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5,2.5)) from onerow; -select ST_Dimension(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Dimension(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_Dimension(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_Dimension(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_X(ST_Point(1,2)) from onerow; -select ST_Y(ST_Point(1,2)) from onerow; -select ST_MinX(ST_Point(1,2)) from onerow; -select ST_MinY(ST_Point(1,2)) from onerow; -select ST_MaxX(ST_Point(1,2)) from onerow; -select ST_MaxY(ST_Point(1,2)) from onerow; -select ST_MinX(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_MinY(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_MaxX(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_MaxY(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_MinX(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_MinY(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_MaxX(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_MaxY(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_MaxX(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_MaxY(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_MinX(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_MinY(ST_MultiPoint(0,0, 2,2)) from onerow; -select ST_MaxX(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_MaxY(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_MinX(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_MinY(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_MaxX(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_MaxY(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_MinX(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_MinY(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_Length(ST_LineString(1.5,2.5, 3.0,2.2)) from onerow; -select ST_Length(ST_LineString(0.0,0.0, 3.0,4.0)) from onerow; -select ST_Length(ST_SetSRID(ST_LineString(0.0,0.0, 3.0,4.0), 0)) from onerow; -select ST_Length(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))) from onerow; -select ST_Length(ST_SetSRID(ST_MultiLineString(array(1,1, 1,2), array(10,10, 20,10)), 0)) from onerow; -select ST_Length(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_Area(ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Area(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')) from onerow; -select ST_Area(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(0,80, 0.03, 80.04), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_MultiLineString(array(0,80, 0.03, 80.04)), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_MultiLineString(array(0.0, 80.0, 0.03, 80.04)), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))'), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)) from onerow; -select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('LineString(0 0, 0.03 0.04)', 4326)), 1, 5) from onerow; -select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 0, 0.03 0.04))', 4326)),1,5) from onerow; -select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)),1,5) from onerow; -select ST_IsClosed(ST_LineString(0.,0., 3.,4.)) from onerow; -select ST_IsClosed(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)) from onerow; -select ST_IsClosed(ST_MultiLineString(array(0,0, 0.03,0.04))) from onerow; -select ST_IsClosed(ST_MultiLineString(array(0,0, 3,4, 2,2, 0,0))) from onerow; -select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2), (6 2, 7 8))')) from onerow; -select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2, 0 0), (6 2, 7 8))')) from onerow; -select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2, 0 0), (6 2, 7 5, 6 8, 6 2))')) from onerow; -select ST_Is3D(ST_Point(0., 3.)) from onerow; -select ST_Is3D(ST_PointZ(0., 3., 1)) from onerow; -select ST_Is3D(ST_Point('pointzm (0. 3. 1. 2.)')) from onerow; -select ST_Is3D(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)) from onerow; -select ST_Is3D(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Is3D(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_Z(ST_PointZ(0., 3., 1)) from onerow; -select ST_Z(ST_Point('pointzm (0. 3. 1. 2.)')) from onerow; -select ST_Z(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_MinZ(ST_PointZ(0., 3., 1)) from onerow; -select ST_MinZ(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_MinZ(ST_MultiPoint('multipoint z((0 0 1), (2 2 3))')) from onerow; -select ST_MinZ(ST_GeomFromText('polygon z ((0 0 2, 8 0 4, 0 8 3, 0 0 2))')) from onerow; -select ST_MaxZ(ST_PointZ(0., 3., 1)) from onerow; -select ST_MaxZ(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_MaxZ(ST_GeomFromText('polygon z ((0 0 2, 8 0 4, 0 8 3, 0 0 2))')) from onerow; -select ST_MaxZ(ST_MultiPoint('multipoint z((0 0 1), (2 2 3))')) from onerow; -select ST_IsMeasured(ST_Point(0., 3.)) from onerow; -select ST_IsMeasured(ST_Point('point m(0. 3. 1)')) from onerow; -select ST_IsMeasured(ST_Point('pointzm (0. 3. 1. 2.)')) from onerow; -select ST_IsMeasured(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)) from onerow; -select ST_IsMeasured(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_IsMeasured(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')) from onerow; -select ST_M(ST_Point('point m(0. 3. 1)')) from onerow; -select ST_M(ST_Point('pointzm (0. 3. 1. 2.)')) from onerow; -select ST_M(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')) from onerow; -select ST_MinM(ST_Point('point m(0. 3. 1)')) from onerow; -select ST_MinM(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')) from onerow; -select ST_MinM(ST_GeomFromText('polygon m ((0 0 5, 8 0 4, 0 8 3, 0 0 5))')) from onerow; -select ST_MinM(ST_MultiPoint('multipoint m((0 0 1), (2 2 3))')) from onerow; -select ST_MaxM(ST_Point('point m(0. 3. 1)')) from onerow; -select ST_MaxM(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')) from onerow; -select ST_MaxM(ST_GeomFromText('polygon m ((0 0 5, 8 0 4, 0 8 3, 0 0 5))')) from onerow; -select ST_MaxM(ST_MultiPoint('multipoint m((0 0 1), (2 2 3))')) from onerow; -select ST_CoordDim(ST_Point(0., 3.)) from onerow; -select ST_CoordDim(ST_PointZ(0., 3., 1)) from onerow; -select ST_CoordDim(ST_Point('point m(0. 3. 1)')) from onerow; -select ST_CoordDim(ST_Point('pointzm (0. 3. 1. 2.)')) from onerow; -select ST_CoordDim(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)) from onerow; -select ST_CoordDim(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_CoordDim(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')) from onerow; -select ST_CoordDim(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')) from onerow; -select ST_NumPoints(ST_Point('point empty')) from onerow; -select ST_NumPoints(ST_Point(0., 3.)) from onerow; -select ST_NumPoints(ST_PointZ(0., 3., 1)) from onerow; -select ST_NumPoints(ST_LineString(0.,0., 3.,4.)) from onerow; -select ST_NumPoints(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)) from onerow; -select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1, 1,1)) from onerow; -select ST_NumPoints(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))')) from onerow; -select ST_NumPoints(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0)) from onerow; -select ST_Contains(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1), ST_Point(2, 3)) from onerow; -select ST_Contains(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1), ST_Point(8, 8)) from onerow; -select ST_Within(ST_Point(2, 3), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Within(ST_Point(8, 8), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Touches(ST_Point(1, 3), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Touches(ST_Point(8, 8), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)) from onerow; -select ST_Overlaps(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)) from onerow; -select ST_Overlaps(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Overlaps(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_Overlaps(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_Touches(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)) from onerow; -select ST_Crosses(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Crosses(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_Crosses(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_Crosses(ST_Linestring(0,0, 1,1), ST_Linestring(1,0, 0,1)) from onerow; -select ST_Crosses(ST_Linestring(1,0, 1,2), ST_Linestring(0,1, 2,1)) from onerow; -select ST_Crosses(ST_Linestring(0,0, 0,1), ST_Linestring(0,0, 1,0)) from onerow; -select ST_Crosses(ST_Linestring(0,0, 0,2), ST_Linestring(0,1, 1,1)) from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '*0*******') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '***0*****') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '****0****') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), 'FF*F0****') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), '*0*******') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), 'F0*FF****') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), '***0*****') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), 'T********') from onerow; -select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), 'T********') from onerow; -select ST_Equals(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_Equals(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_Equals(st_linestring(0,0, 1,2), ST_linestring(0,0, 1,2)) from onerow; -select ST_Equals(st_linestring(0,0, 1,2), ST_linestring(1,2, 0,0)) from onerow; -select ST_Equals(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4)) from onerow; -select ST_Equals(st_polygon(2,0, 2,1, 3,1), ST_Polygon(2,0, 2,1, 3,1)) from onerow; -select ST_Equals(st_polygon(2,0, 2,1, 3,1), ST_Polygon(3,1, 2,0, 2,1)) from onerow; -select ST_Equals(st_polygon(2,0, 8,1, 3,1), ST_Polygon(3,1, 2,0, 2,1)) from onerow; -select ST_Intersects(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_linestring(2,0, 2,3), ST_Polygon(1,1, 4,1, 4,4, 1,4)) from onerow; -select ST_Intersects(ST_LineString(8,7, 7,8), ST_Polygon(1,1, 4,1, 4,4, 1,4)) from onerow; -select ST_Intersects(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)) from onerow; -select ST_Intersects(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_linestring(0,0, 1,1), ST_linestring(0,1, 1,0)) from onerow; -select ST_Intersects(ST_Linestring(1,0, 1,2), ST_Linestring(0,1, 2,1)) from onerow; -select ST_Intersects(st_linestring(0,0, 0,1), ST_linestring(0,0, 1,0)) from onerow; -select ST_Intersects(st_linestring(0,0, 0,2), ST_linestring(0,1, 1,1)) from onerow; -select ST_Intersects(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_Intersects(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_Touches(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Intersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Disjoint(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_Disjoint(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_Disjoint(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_EnvIntersects(ST_LineString(0,0, 1,1), ST_LineString(1,3, 2,2)) from onerow; -select ST_EnvIntersects(ST_LineString(0,0, 2,2), ST_LineString(1,0, 3,2)) from onerow; -select ST_EnvIntersects(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)) from onerow; -select ST_EnvIntersects(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_EnvIntersects(st_linestring(0,0, 1,1), ST_linestring(0,1, 1,0)) from onerow; -select ST_EnvIntersects(st_point(1,1), ST_Point(1,1)) from onerow; -select ST_EnvIntersects(st_point(2,0), ST_Point(1,1)) from onerow; -select ST_Equals(ST_Envelope(ST_LineString(0,0, 2,2)), ST_Polygon(0,0, 2,0, 2,2, 0,2)) from onerow; -select st_AsText(ST_Envelope(ST_Polygon(1,1, 4,1, 4,4, 1,4))) from onerow; -select st_AsText(ST_Envelope(st_polygon(2,0, 2,3, 3,0))) from onerow; -select ST_Relate(st_point(2,0), ST_Point(1,1), "TFFF0FFF2") from onerow; -select ST_Relate(st_point(2,0), ST_Point(1,1), "****T****") from onerow; -select ST_Relate(st_point(1,1), ST_Point(1,1), "TFFF0FFF2") from onerow; -select ST_Relate(st_point(1,1), ST_Point(1,1), "****T****") from onerow; -select ST_Relate(st_point(1,1), ST_Point(1,1), "T********") from onerow; -select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "T********") from onerow; -select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "****T****") from onerow; -select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "F***1****") from onerow; -select ST_Relate(st_polygon(2,0, 2,3, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "2***0****") from onerow; -select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1))'), "F***1****") from onerow; -select ST_Relate(st_GeomFromText('polygon((2 0, 2 3, 3 1))'), St_GeomFromText('Polygon((1 1, 1 4, 4 4, 4 1))'), "2***0****") from onerow; -select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1, 2 0))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1, 1 1))'), "FF*F1****") from onerow; -select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1, 2 0))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1, 1 1))'), "FF*F2****") from onerow; -select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "T********") from onerow; -select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "*T*******") from onerow; -select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "***T*****") from onerow; -select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "****T****") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "T********") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*T*******") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "***T*****") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "****T****") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "**T******") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*****T***") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "******T**") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*******T*") from onerow; -select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "********T") from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '2********') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*F*******') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*1*******') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '**2******') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '***F*****') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '****F****') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*****1***') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '******F**') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*******F*') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '********2') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '2F2FF1FF2') from onerow; -select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '212FF1FF2') from onerow; -select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '**1******') from onerow; -select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '**2******') from onerow; -select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '******1**') from onerow; -select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '******2**') from onerow; -select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '**1******') from onerow; -select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '**2******') from onerow; -select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '******1**') from onerow; -select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '******2**') from onerow; -select ST_Relate(ST_Polygon('polygon((1 0, 3 0, 1 2, 1 0))'), ST_Polygon('polygon((0 1, 2 1, 0 3, 0 1))'), '212111212') from onerow; -select ST_Relate(ST_Polygon('polygon((3 0, 3 3, 0 3, 3 0))'), ST_Polygon('polygon((2 2, 5 2, 2 5, 2 2))'), '212101212') from onerow; -select ST_Relate(ST_Polygon('polygon((2 0, 2 2, 0 2, 2 0))'), ST_Polygon('polygon((1 1, 3 1, 1 3, 1 1))'), '212101212') from onerow; -select ST_Relate(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), '212F11FF2') from onerow; -select ST_Relate(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((1 1, 2 1, 1 2, 1 1))'), '212F11FF2') from onerow; -select ST_Relate(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 1 0, 0 1, 1 1))'), '212F01FF2') from onerow; -select ST_Relate(ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), '2FFF1FFF2') from onerow; -select ST_Relate(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((2 2, 2 0, 3 0, 3 3, 0 3, 0 2, 2 2))'), '212111212') from onerow; -select ST_Distance(ST_Point(0.0,0.0), ST_Point(3.0,4.0)) from onerow; -select ST_Distance(ST_LineString(0,0, 1,1), ST_LineString(2,1, 3,0)) from onerow; -select ST_Area(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)) from onerow; -select ST_GeometryType(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)) from onerow; -select ST_GeometryType(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)) from onerow; -select substr(ST_Area(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)), 1, 3) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3))) from onerow; -select ST_IsEmpty(ST_Intersection(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_IsEmpty(ST_Intersection(st_linestring(0,0, 1,1), ST_linestring(2,2, 4,4))) from onerow; -select ST_IsEmpty(ST_Intersection(ST_LineString(0,2, 0,4), ST_Point(3,3))) from onerow; -select ST_IsEmpty(ST_Intersection(st_point(1,1), ST_Point(1,1))) from onerow; -select ST_IsEmpty(ST_Intersection(ST_Point(2,0), ST_Point(1,1))) from onerow; -select ST_Dimension(ST_Intersection(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_Dimension(ST_Intersection(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_Dimension(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3))) from onerow; -select ST_Dimension(ST_Intersection(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1))) from onerow; -select ST_Dimension(ST_Intersection(st_point(1,1), ST_Point(1,1))) from onerow; -select ST_Equals(ST_Intersection(ST_Polygon(1,0, 3,0, 1,2), ST_Polygon(0,1, 2,1, 0,3)), ST_Polygon(1,1, 2,1, 1,2)) from onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_Point('point(0 0)'), ST_Point('point(2 2)'))) FROM onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_MultiPoint('multipoint((0 0))'), ST_MultiPoint('multipoint((2 2))'))) FROM onerow; -SELECT ST_Equals(ST_SymmetricDiff(ST_LineString('linestring(0 2, 2 2)'), ST_LineString('linestring(1 2, 3 2)')), ST_GeomFromText('multilinestring((0 2, 1 2), (2 2, 3 2))')) FROM onerow; -SELECT ST_Equals(ST_SymmetricDiff(ST_Polygon('polygon((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 3 1, 3 3, 1 3, 1 1))')), ST_MultiPolygon('multipolygon(((0 0, 2 0, 2 1, 1 1, 1 2, 0 2, 0 0)), ((3 1, 3 3, 1 3, 1 2, 2 2, 2 1, 3 1)))')) FROM onerow; -select ST_Equals(ST_Boundary(ST_LineString(0,1, 1,0)), ST_MultiPoint('multipoint((1 0),(0 1))')) from onerow; -select ST_GeometryType(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4))) from onerow; -select ST_Equals(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4)), ST_LineString(1,1, 4,1, 1,4, 1,1)) from onerow; -select ST_GeometryType(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))) from onerow; -select ST_Equals(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')), ST_MultiLineString('multilinestring((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')) from onerow; -select ST_Equals(ST_ExteriorRing(ST_Polygon(1,1, 1,4, 4,1)), ST_LineString(1,1, 4,1, 1,4, 1,1)) from onerow; -select ST_Equals(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))')), ST_LineString('linestring(1 1, 4 1, 1 4, 1 1)')) from onerow; -select ST_GeometryType(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))'))) from onerow; -select ST_Equals(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')), ST_LineString('linestring (0 0, 8 0, 0 8, 0 0)')) from onerow; -select ST_GeometryType(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))) from onerow; -select ST_NumGeometries(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)', 0)) from onerow; -select ST_NumGeometries(ST_GeomFromText('multipoint ((10 40), (40 30))', 0)) from onerow; -select ST_NumGeometries(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))', 0)) from onerow; -select ST_NumGeometries(ST_GeomFromText('multilinestring ((2 4, 10 10, 20 20, 7 8))', 0)) from onerow; -select ST_NumGeometries(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)),((8 24, 1 28, 9 25, 8 24)), ((13 33, 7 36, 1 40, 10 43, 13 33)))')) from onerow; -select ST_NumGeometries(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)))')) from onerow; -select ST_NumGeometries(ST_GeomFromText('multipolygon (((0 0, 9 0, 9 9, 0 9, 0 0),(1 2, 1 7, 5 7, 1 2), (2 1, 7 5, 7 1, 2 1)))')) from onerow; -select ST_GeometryType(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3)) from onerow; -select ST_Equals(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3), ST_GeomFromText('point (20 20)')) from onerow; -select ST_GeometryType(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)) from onerow; -select ST_Equals(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2), ST_GeomFromText('linestring (20 20, 7 8)')) from onerow; -select ST_GeometryType(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1)) from onerow; -select ST_Equals(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1), ST_LineString('linestring(1 1, 5 1, 1 5, 1 1)')) from onerow; -select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('point (10.02 20.01)')))) from onerow; -select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('point (10.02 20.01)'))),ST_GeomFromText('point (10.02 20.01)')) from onerow; -select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)')))) from onerow; -select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)'))), ST_GeomFromText('linestring (10 10, 20 20)')) from onerow; -select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))')))) from onerow; -select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))'))), ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))')) from onerow; -select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))')))) from onerow; -select ST_GeometryType(ST_PointFromWKB(ST_AsBinary(ST_GeomFromText('point (10 10)')))) from onerow; -select ST_Equals(ST_PointFromWKB(ST_AsBinary(ST_GeomFromText('point (10 10)'))), ST_GeomFromText('point (10 10)')) from onerow; -select ST_GeometryType(ST_LineFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)')))) from onerow; -select ST_Equals(ST_LineFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)'))), ST_GeomFromText('linestring (10 10, 20 20)')) from onerow; -select ST_GeometryType(ST_PolyFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))')))) from onerow; -select ST_Equals(ST_PolyFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))'))), ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))')) from onerow; -select ST_GeometryType(ST_MPointFromWKB(ST_AsBinary(ST_GeomFromText('multipoint ((10 10), (20 20))')))) from onerow; -select ST_Equals(ST_MPointFromWKB(ST_AsBinary(ST_GeomFromText('multipoint ((10 10), (20 20))'))), ST_GeomFromText('multipoint ((10 10), (20 20))')) from onerow; -select ST_GeometryType(ST_MLineFromWKB(ST_AsBinary(ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))')))) from onerow; -select ST_Equals(ST_MLineFromWKB(ST_AsBinary(ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))'))), ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))')) from onerow; -select ST_GeometryType(ST_MPolyFromWKB(ST_AsBinary(ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1, 0 0)), ((2 2, 1 2, 2 1, 2 2)))')))) from onerow; -select ST_Equals(ST_MPolyFromWKB(ST_AsBinary(ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1, 0 0)), ((2 2, 1 2, 2 1, 2 2)))'))), ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1)), ((2 2, 1 2, 2 1)))')) from onerow; +select ST_GeometryType(ST_Point(0, 0)); +select ST_GeometryType(ST_Point('point (10.02 20.01)')); +select ST_GeometryType(ST_Point('point z (10.02 20.01 2)')); +select ST_GeometryType(ST_MultiPoint('multipoint ((1 2))')); +select ST_GeometryType(ST_Linestring(10,10, 20,20)); +select ST_GeometryType(ST_Linestring('linestring (10 10, 20 20)')); +select ST_GeometryType(ST_Linestring('linestring z (10 10 2, 20 20 4)')); +select ST_GeometryType(ST_GeomFromText('polygon ((0 0, 0 10, 10 0, 0 0))')); +select ST_GeometryType(ST_Polygon('polygon ((0 0, 0 10, 10 0, 0 0))')); +select ST_GeometryType(ST_Polygon(1,1, 1,4, 4,1)); +select ST_GeometryType(ST_Polygon(1,1, 4,1, 1,4)); +select ST_GeometryType(ST_Polygon(1,1, 1,4, 4,1, 1,1)); +select ST_GeometryType(ST_Polygon(1,1, 4,1, 1,4, 1,1)); +select ST_GeometryType(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')); +select ST_X(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')); +select ST_Y(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')); +select ST_MinY(ST_GeomFromGeoJson('{"type":"LineString", "coordinates":[[1,2], [3,4]]}')); +select ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJson(ST_Point(1.2, 2.4)))); +select ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJson(ST_LineString(1,2, 3,4)))); +SELECT ST_GeometryType(ST_GeomFromGeoJson(ST_AsGeoJSON(ST_MultiLineString(array(1, 1, 2, 2, 3, 3), array(10, 10, 11, 11, 12, 12))))); +select ST_NumPoints(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)); +select ST_NumPoints(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5, 2.5)); +select ST_NumPoints(ST_Polygon(0.1,2.2, 3.0,2.2, 2.2,1.1, 0.1, 2.2)); +select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1, 1,1)); +select ST_IsEmpty(ST_Point(0,0)); +select ST_IsSimple(ST_Point(0,0)); +select ST_IsSimple(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_IsSimple(ST_LineString(0.,0., 1.,1., 0.,1., 1.,0.)); +select ST_IsSimple(ST_LineString(0.,0., 1.,1., 2.,2., 2.,0., 1.,1., 0.,2.)); +select ST_IsSimple(ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_IsSimple(ST_LineString(10,10, 20,20, 20,30, 10,30, 10,20, 20,10)); +select ST_IsSimple(ST_LineString(0.,0., 1.,0., 1.,1., 0.,2., 2.,2., 1.,1., 2.,0.)); +select ST_IsSimple(ST_MultiPoint(0,0, 2,2)); +select ST_Dimension(ST_Point(0,0)); +select ST_Dimension(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_Dimension(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)); +select ST_Dimension(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5,2.5)); +select ST_Dimension(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Dimension(ST_MultiPoint(0,0, 2,2)); +select ST_Dimension(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_Dimension(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_X(ST_Point(1,2)); +select ST_Y(ST_Point(1,2)); +select ST_MinX(ST_Point(1,2)); +select ST_MinY(ST_Point(1,2)); +select ST_MaxX(ST_Point(1,2)); +select ST_MaxY(ST_Point(1,2)); +select ST_MinX(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_MinY(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_MaxX(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_MaxY(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_MinX(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_MinY(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_MaxX(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_MaxY(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_MaxX(ST_MultiPoint(0,0, 2,2)); +select ST_MaxY(ST_MultiPoint(0,0, 2,2)); +select ST_MinX(ST_MultiPoint(0,0, 2,2)); +select ST_MinY(ST_MultiPoint(0,0, 2,2)); +select ST_MaxX(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_MaxY(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_MinX(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_MinY(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_MaxX(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_MaxY(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_MinX(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_MinY(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_Length(ST_LineString(1.5,2.5, 3.0,2.2)); +select ST_Length(ST_LineString(0.0,0.0, 3.0,4.0)); +select ST_Length(ST_SetSRID(ST_LineString(0.0,0.0, 3.0,4.0), 0)); +select ST_Length(ST_MultiLineString(array(1, 1, 2, 2), array(10, 10, 20, 20))); +select ST_Length(ST_SetSRID(ST_MultiLineString(array(1,1, 1,2), array(10,10, 20,10)), 0)); +select ST_Length(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_Area(ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Area(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')); +select ST_Area(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3))); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(0,80, 0.03, 80.04), 4326)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_MultiLineString(array(0,80, 0.03, 80.04)), 4326)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_MultiLineString(array(0.0, 80.0, 0.03, 80.04)), 4326)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))'), 4326)); +select ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)); +select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('LineString(0 0, 0.03 0.04)', 4326)), 1, 5); +select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 0, 0.03 0.04))', 4326)),1,5); +select substr(ST_GeodesicLengthWGS84(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)),1,5); +select ST_IsClosed(ST_LineString(0.,0., 3.,4.)); +select ST_IsClosed(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)); +select ST_IsClosed(ST_MultiLineString(array(0,0, 0.03,0.04))); +select ST_IsClosed(ST_MultiLineString(array(0,0, 3,4, 2,2, 0,0))); +select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2), (6 2, 7 8))')); +select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2, 0 0), (6 2, 7 8))')); +select ST_IsClosed(ST_MultiLineString('multilinestring ((0 0, 3 4, 2 2, 0 0), (6 2, 7 5, 6 8, 6 2))')); +select ST_Is3D(ST_Point(0., 3.)); +select ST_Is3D(ST_PointZ(0., 3., 1)); +select ST_Is3D(ST_Point('pointzm (0. 3. 1. 2.)')); +select ST_Is3D(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)); +select ST_Is3D(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Is3D(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')); +select ST_Z(ST_PointZ(0., 3., 1)); +select ST_Z(ST_Point('pointzm (0. 3. 1. 2.)')); +select ST_Z(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')); +select ST_MinZ(ST_PointZ(0., 3., 1)); +select ST_MinZ(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')); +select ST_MinZ(ST_MultiPoint('multipoint z((0 0 1), (2 2 3))')); +select ST_MinZ(ST_GeomFromText('polygon z ((0 0 2, 8 0 4, 0 8 3, 0 0 2))')); +select ST_MaxZ(ST_PointZ(0., 3., 1)); +select ST_MaxZ(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')); +select ST_MaxZ(ST_GeomFromText('polygon z ((0 0 2, 8 0 4, 0 8 3, 0 0 2))')); +select ST_MaxZ(ST_MultiPoint('multipoint z((0 0 1), (2 2 3))')); +select ST_IsMeasured(ST_Point(0., 3.)); +select ST_IsMeasured(ST_Point('point m(0. 3. 1)')); +select ST_IsMeasured(ST_Point('pointzm (0. 3. 1. 2.)')); +select ST_IsMeasured(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)); +select ST_IsMeasured(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_IsMeasured(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')); +select ST_M(ST_Point('point m(0. 3. 1)')); +select ST_M(ST_Point('pointzm (0. 3. 1. 2.)')); +select ST_M(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')); +select ST_MinM(ST_Point('point m(0. 3. 1)')); +select ST_MinM(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')); +select ST_MinM(ST_GeomFromText('polygon m ((0 0 5, 8 0 4, 0 8 3, 0 0 5))')); +select ST_MinM(ST_MultiPoint('multipoint m((0 0 1), (2 2 3))')); +select ST_MaxM(ST_Point('point m(0. 3. 1)')); +select ST_MaxM(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')); +select ST_MaxM(ST_GeomFromText('polygon m ((0 0 5, 8 0 4, 0 8 3, 0 0 5))')); +select ST_MaxM(ST_MultiPoint('multipoint m((0 0 1), (2 2 3))')); +select ST_CoordDim(ST_Point(0., 3.)); +select ST_CoordDim(ST_PointZ(0., 3., 1)); +select ST_CoordDim(ST_Point('point m(0. 3. 1)')); +select ST_CoordDim(ST_Point('pointzm (0. 3. 1. 2.)')); +select ST_CoordDim(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)); +select ST_CoordDim(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_CoordDim(ST_GeomFromText('linestring z (10 10 2, 20 20 4)')); +select ST_CoordDim(ST_GeomFromText('linestring m (10 10 2, 20 20 4)')); +select ST_NumPoints(ST_Point('point empty')); +select ST_NumPoints(ST_Point(0., 3.)); +select ST_NumPoints(ST_PointZ(0., 3., 1)); +select ST_NumPoints(ST_LineString(0.,0., 3.,4.)); +select ST_NumPoints(ST_LineString(0.,0., 3.,4., 0.,4., 0.,0.)); +select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_NumPoints(ST_Polygon(1,1, 1,4, 4,4, 4,1, 1,1)); +select ST_NumPoints(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))')); +select ST_NumPoints(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0)); +select ST_Contains(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1), ST_Point(2, 3)); +select ST_Contains(ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1), ST_Point(8, 8)); +select ST_Within(ST_Point(2, 3), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Within(ST_Point(8, 8), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Touches(ST_Point(1, 3), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Touches(ST_Point(8, 8), ST_Polygon(1, 1, 1, 4, 4, 4, 4, 1)); +select ST_Overlaps(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)); +select ST_Overlaps(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Overlaps(st_point(1,1), ST_Point(1,1)); +select ST_Overlaps(st_point(2,0), ST_Point(1,1)); +select ST_Touches(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)); +select ST_Crosses(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Crosses(st_point(1,1), ST_Point(1,1)); +select ST_Crosses(st_point(2,0), ST_Point(1,1)); +select ST_Crosses(ST_Linestring(0,0, 1,1), ST_Linestring(1,0, 0,1)); +select ST_Crosses(ST_Linestring(1,0, 1,2), ST_Linestring(0,1, 2,1)); +select ST_Crosses(ST_Linestring(0,0, 0,1), ST_Linestring(0,0, 1,0)); +select ST_Crosses(ST_Linestring(0,0, 0,2), ST_Linestring(0,1, 1,1)); +select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '*0*******'); +select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '***0*****'); +select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), '****0****'); +select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), 'FF*F0****'); +select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), '*0*******'); +select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), 'F0*FF****'); +select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), '***0*****'); +select ST_Relate(st_linestring('linestring(0 0, 0 1)'), ST_linestring('linestring(0 0, 1 0)'), 'T********'); +select ST_Relate(st_linestring('linestring(0 0, 0 2)'), ST_linestring('linestring(0 1, 1 1)'), 'T********'); +select ST_Equals(st_point(1,1), ST_Point(1,1)); +select ST_Equals(st_point(2,0), ST_Point(1,1)); +select ST_Equals(st_linestring(0,0, 1,2), ST_linestring(0,0, 1,2)); +select ST_Equals(st_linestring(0,0, 1,2), ST_linestring(1,2, 0,0)); +select ST_Equals(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4)); +select ST_Equals(st_polygon(2,0, 2,1, 3,1), ST_Polygon(2,0, 2,1, 3,1)); +select ST_Equals(st_polygon(2,0, 2,1, 3,1), ST_Polygon(3,1, 2,0, 2,1)); +select ST_Equals(st_polygon(2,0, 8,1, 3,1), ST_Polygon(3,1, 2,0, 2,1)); +select ST_Intersects(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_linestring(2,0, 2,3), ST_Polygon(1,1, 4,1, 4,4, 1,4)); +select ST_Intersects(ST_LineString(8,7, 7,8), ST_Polygon(1,1, 4,1, 4,4, 1,4)); +select ST_Intersects(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)); +select ST_Intersects(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_linestring(0,0, 1,1), ST_linestring(0,1, 1,0)); +select ST_Intersects(ST_Linestring(1,0, 1,2), ST_Linestring(0,1, 2,1)); +select ST_Intersects(st_linestring(0,0, 0,1), ST_linestring(0,0, 1,0)); +select ST_Intersects(st_linestring(0,0, 0,2), ST_linestring(0,1, 1,1)); +select ST_Intersects(st_point(1,1), ST_Point(1,1)); +select ST_Intersects(st_point(2,0), ST_Point(1,1)); +select ST_Touches(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Intersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Disjoint(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_Disjoint(st_point(1,1), ST_Point(1,1)); +select ST_Disjoint(st_point(2,0), ST_Point(1,1)); +select ST_EnvIntersects(ST_LineString(0,0, 1,1), ST_LineString(1,3, 2,2)); +select ST_EnvIntersects(ST_LineString(0,0, 2,2), ST_LineString(1,0, 3,2)); +select ST_EnvIntersects(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3)); +select ST_EnvIntersects(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1)); +select ST_EnvIntersects(st_linestring(0,0, 1,1), ST_linestring(0,1, 1,0)); +select ST_EnvIntersects(st_point(1,1), ST_Point(1,1)); +select ST_EnvIntersects(st_point(2,0), ST_Point(1,1)); +select ST_Equals(ST_Envelope(ST_LineString(0,0, 2,2)), ST_Polygon(0,0, 2,0, 2,2, 0,2)); +select st_AsText(ST_Envelope(ST_Polygon(1,1, 4,1, 4,4, 1,4))); +select st_AsText(ST_Envelope(st_polygon(2,0, 2,3, 3,0))); +select ST_Relate(st_point(2,0), ST_Point(1,1), "TFFF0FFF2"); +select ST_Relate(st_point(2,0), ST_Point(1,1), "****T****"); +select ST_Relate(st_point(1,1), ST_Point(1,1), "TFFF0FFF2"); +select ST_Relate(st_point(1,1), ST_Point(1,1), "****T****"); +select ST_Relate(st_point(1,1), ST_Point(1,1), "T********"); +select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "T********"); +select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "****T****"); +select ST_Relate(st_polygon(2,0, 2,1, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "F***1****"); +select ST_Relate(st_polygon(2,0, 2,3, 3,1), ST_Polygon(1,1, 1,4, 4,4, 4,1), "2***0****"); +select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1))'), "F***1****"); +select ST_Relate(st_GeomFromText('polygon((2 0, 2 3, 3 1))'), St_GeomFromText('Polygon((1 1, 1 4, 4 4, 4 1))'), "2***0****"); +select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1, 2 0))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1, 1 1))'), "FF*F1****"); +select ST_Relate(st_GeomFromText('polygon((2 0, 2 1, 3 1, 2 0))'), St_GeomFromText('polygon((1 1, 1 4, 4 4, 4 1, 1 1))'), "FF*F2****"); +select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "T********"); +select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "*T*******"); +select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "***T*****"); +select ST_Relate(st_linestring(0,0, 3,3), ST_linestring(1,1, 4,4), "****T****"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "T********"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*T*******"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "***T*****"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "****T****"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "**T******"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*****T***"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "******T**"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "*******T*"); +select ST_Relate(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1), "********T"); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '2********'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*F*******'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*1*******'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '**2******'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '***F*****'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '****F****'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*****1***'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '******F**'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '*******F*'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '********2'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '2F2FF1FF2'); +select ST_Relate(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0))'), ST_Polygon('polygon ((1 1, 1 5, 5 1, 1 1))'), '212FF1FF2'); +select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '**1******'); +select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '**2******'); +select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '******1**'); +select ST_Relate(ST_LineString('linestring(0 2, 2 3)'), ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), '******2**'); +select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '**1******'); +select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '**2******'); +select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '******1**'); +select ST_Relate(ST_Polygon('polygon((1 1, 4 1, 4 4, 1 4, 1 1))'), ST_LineString('linestring(0 2, 2 3)'), '******2**'); +select ST_Relate(ST_Polygon('polygon((1 0, 3 0, 1 2, 1 0))'), ST_Polygon('polygon((0 1, 2 1, 0 3, 0 1))'), '212111212'); +select ST_Relate(ST_Polygon('polygon((3 0, 3 3, 0 3, 3 0))'), ST_Polygon('polygon((2 2, 5 2, 2 5, 2 2))'), '212101212'); +select ST_Relate(ST_Polygon('polygon((2 0, 2 2, 0 2, 2 0))'), ST_Polygon('polygon((1 1, 3 1, 1 3, 1 1))'), '212101212'); +select ST_Relate(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), '212F11FF2'); +select ST_Relate(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((1 1, 2 1, 1 2, 1 1))'), '212F11FF2'); +select ST_Relate(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 1 0, 0 1, 1 1))'), '212F01FF2'); +select ST_Relate(ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), '2FFF1FFF2'); +select ST_Relate(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((2 2, 2 0, 3 0, 3 3, 0 3, 0 2, 2 2))'), '212111212'); +select ST_Distance(ST_Point(0.0,0.0), ST_Point(3.0,4.0)); +select ST_Distance(ST_LineString(0,0, 1,1), ST_LineString(2,1, 3,0)); +select ST_Area(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)); +select ST_GeometryType(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)); +select ST_GeometryType(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)); +select substr(ST_Area(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)), 1, 3); +select ST_IsEmpty(ST_Intersection(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(8,7, 7,8), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3))); +select ST_IsEmpty(ST_Intersection(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(2,0, 2,3), ST_linestring(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(8,7, 7,8), ST_linestring(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(0,0, 1,2, 1,5), ST_linestring(1,1, 1,4, 4,4, 4,1))); +select ST_IsEmpty(ST_Intersection(st_linestring(0,0, 1,1), ST_linestring(2,2, 4,4))); +select ST_IsEmpty(ST_Intersection(ST_LineString(0,2, 0,4), ST_Point(3,3))); +select ST_IsEmpty(ST_Intersection(st_point(1,1), ST_Point(1,1))); +select ST_IsEmpty(ST_Intersection(ST_Point(2,0), ST_Point(1,1))); +select ST_Dimension(ST_Intersection(st_linestring(0,2, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_Dimension(ST_Intersection(st_linestring(2,0, 2,3), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_Dimension(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), st_linestring(2,0, 2,3))); +select ST_Dimension(ST_Intersection(st_polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 1,4, 4,4, 4,1))); +select ST_Dimension(ST_Intersection(st_point(1,1), ST_Point(1,1))); +select ST_Equals(ST_Intersection(ST_Polygon(1,0, 3,0, 1,2), ST_Polygon(0,1, 2,1, 0,3)), ST_Polygon(1,1, 2,1, 1,2)); +SELECT ST_AsText(ST_SymmetricDiff(ST_Point('point(0 0)'), ST_Point('point(2 2)'))); +SELECT ST_AsText(ST_SymmetricDiff(ST_MultiPoint('multipoint((0 0))'), ST_MultiPoint('multipoint((2 2))'))); +SELECT ST_Equals(ST_SymmetricDiff(ST_LineString('linestring(0 2, 2 2)'), ST_LineString('linestring(1 2, 3 2)')), ST_GeomFromText('multilinestring((0 2, 1 2), (2 2, 3 2))')); +SELECT ST_Equals(ST_SymmetricDiff(ST_Polygon('polygon((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 3 1, 3 3, 1 3, 1 1))')), ST_MultiPolygon('multipolygon(((0 0, 2 0, 2 1, 1 1, 1 2, 0 2, 0 0)), ((3 1, 3 3, 1 3, 1 2, 2 2, 2 1, 3 1)))')); +select ST_Equals(ST_Boundary(ST_LineString(0,1, 1,0)), ST_MultiPoint('multipoint((1 0),(0 1))')); +select ST_GeometryType(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4))); +select ST_Equals(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4)), ST_LineString(1,1, 4,1, 1,4, 1,1)); +select ST_GeometryType(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))); +select ST_Equals(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')), ST_MultiLineString('multilinestring((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')); +select ST_Equals(ST_ExteriorRing(ST_Polygon(1,1, 1,4, 4,1)), ST_LineString(1,1, 4,1, 1,4, 1,1)); +select ST_Equals(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))')), ST_LineString('linestring(1 1, 4 1, 1 4, 1 1)')); +select ST_GeometryType(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))'))); +select ST_Equals(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))')), ST_LineString('linestring (0 0, 8 0, 0 8, 0 0)')); +select ST_GeometryType(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))); +select ST_NumGeometries(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)', 0)); +select ST_NumGeometries(ST_GeomFromText('multipoint ((10 40), (40 30))', 0)); +select ST_NumGeometries(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))', 0)); +select ST_NumGeometries(ST_GeomFromText('multilinestring ((2 4, 10 10, 20 20, 7 8))', 0)); +select ST_NumGeometries(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)),((8 24, 1 28, 9 25, 8 24)), ((13 33, 7 36, 1 40, 10 43, 13 33)))')); +select ST_NumGeometries(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)))')); +select ST_NumGeometries(ST_GeomFromText('multipolygon (((0 0, 9 0, 9 9, 0 9, 0 0),(1 2, 1 7, 5 7, 1 2), (2 1, 7 5, 7 1, 2 1)))')); +select ST_GeometryType(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3)); +select ST_Equals(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3), ST_GeomFromText('point (20 20)')); +select ST_GeometryType(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)); +select ST_Equals(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2), ST_GeomFromText('linestring (20 20, 7 8)')); +select ST_GeometryType(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1)); +select ST_Equals(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1), ST_LineString('linestring(1 1, 5 1, 1 5, 1 1)')); +select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('point (10.02 20.01)')))); +select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('point (10.02 20.01)'))),ST_GeomFromText('point (10.02 20.01)')); +select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)')))); +select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)'))), ST_GeomFromText('linestring (10 10, 20 20)')); +select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))')))); +select ST_Equals(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))'))), ST_GeomFromText('polygon ((0 0, 0 10, 10 10, 0 0))')); +select ST_GeometryType(ST_GeomFromWKB(ST_AsBinary(ST_GeomFromText('MULTIPOINT ((10 40), (40 30), (20 20), (30 10))')))); +select ST_GeometryType(ST_PointFromWKB(ST_AsBinary(ST_GeomFromText('point (10 10)')))); +select ST_Equals(ST_PointFromWKB(ST_AsBinary(ST_GeomFromText('point (10 10)'))), ST_GeomFromText('point (10 10)')); +select ST_GeometryType(ST_LineFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)')))); +select ST_Equals(ST_LineFromWKB(ST_AsBinary(ST_GeomFromText('linestring (10 10, 20 20)'))), ST_GeomFromText('linestring (10 10, 20 20)')); +select ST_GeometryType(ST_PolyFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))')))); +select ST_Equals(ST_PolyFromWKB(ST_AsBinary(ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))'))), ST_GeomFromText('polygon ((0 0, 1 0, 0 1, 0 0))')); +select ST_GeometryType(ST_MPointFromWKB(ST_AsBinary(ST_GeomFromText('multipoint ((10 10), (20 20))')))); +select ST_Equals(ST_MPointFromWKB(ST_AsBinary(ST_GeomFromText('multipoint ((10 10), (20 20))'))), ST_GeomFromText('multipoint ((10 10), (20 20))')); +select ST_GeometryType(ST_MLineFromWKB(ST_AsBinary(ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))')))); +select ST_Equals(ST_MLineFromWKB(ST_AsBinary(ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))'))), ST_GeomFromText('multilinestring ((1 2, 2 1),(10 10, 20 20))')); +select ST_GeometryType(ST_MPolyFromWKB(ST_AsBinary(ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1, 0 0)), ((2 2, 1 2, 2 1, 2 2)))')))); +select ST_Equals(ST_MPolyFromWKB(ST_AsBinary(ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1, 0 0)), ((2 2, 1 2, 2 1, 2 2)))'))), ST_GeomFromText('multipolygon (((0 0, 1 0, 0 1)), ((2 2, 1 2, 2 1)))')); diff --git a/hive/test/st-geom-text.ref b/hive/test/st-geom-text.ref index 85eeaec..c3aef75 100644 --- a/hive/test/st-geom-text.ref +++ b/hive/test/st-geom-text.ref @@ -30,9 +30,11 @@ POLYGON ((1 1, 2 1, 1 2, 1 1)) POLYGON ((1 0, 1 1, 0 1, 1 0)) POLYGON ((0 0, 1 0, 0 1, 0 0)) MULTIPOLYGON (((2 0, 3 0, 2 1, 2 0)), ((0 2, 1 2, 0 3, 0 2))) -POINT (3 3) +POINT (2 3) +POINT (2 0) +POINT (3 4) POINT (4 4) -POINT (2.5 2.5) +POINT (3 2) 3.139350203046865 3438.190416575652 3438.190416575652 diff --git a/hive/test/st-geom-text.sql b/hive/test/st-geom-text.sql index 4068692..fd3fa77 100644 --- a/hive/test/st-geom-text.sql +++ b/hive/test/st-geom-text.sql @@ -1,84 +1,87 @@ -select ST_AsJson(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)) from onerow; -select ST_AsJson(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5, 2.5)) from onerow; -select ST_AsJson(ST_Polygon(0.1,2.2, 3.0,2.2, 2.2,1.1, 0.1, 2.2)) from onerow; -select ST_AsJson(ST_Polygon(1,1, 1,4, 4,4, 4,1)) from onerow; -select ST_AsText(ST_Polygon(1,1, 1,4, 4,1)) from onerow; -select ST_AsText(ST_Polygon(1,1, 4,1, 1,4)) from onerow; -select ST_AsText(ST_Polygon(1,1, 1,4, 4,1, 1,1)) from onerow; -select ST_AsText(ST_Polygon(1,1, 4,1, 1,4, 1,1)) from onerow; -select ST_AsText(ST_LineString(array(0,0), array(2,2))) from onerow; -select ST_AsText(ST_LineString(array(ST_Point(0,0), ST_Point(2,2)))) from onerow; -select st_AsText(ST_Envelope(ST_LineString(0,0, 2,2))) from onerow; -select st_AsText(ST_Envelope(ST_Polygon(1,1, 4,1, 4,4, 1,4))) from onerow; -select st_AsText(ST_Envelope(st_polygon(2,0, 2,3, 3,0))) from onerow; -select ST_AsText(ST_Intersection(ST_Point(1,1), ST_Point(1,1))) from onerow; -select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_Point(0,3))) from onerow; -select ST_AsText(ST_Intersection(ST_GeomFromText('linestring(0 2, 0 0, 2 0)'), ST_GeomFromText('linestring(0 3, 0 1, 1 0, 3 0)'))) from onerow; -select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_LineString(0,2, 0,4))) from onerow; -select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_LineString(0,3, 0,5))) from onerow; -select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,5), ST_LineString(1,3, 0,3, 0,4, 1,4))) from onerow; -select ST_AsText(ST_Intersection(ST_LineString(0,2, 2,3), ST_Polygon(1,1, 4,1, 4,4, 1,4))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), ST_LineString(1,1, 1,4))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), ST_LineString(1,3, 1,4, 0,4))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 4,1, 4,4, 1,4))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon(1,0, 3,0, 1,2), ST_Polygon(0,1, 2,1, 0,3))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((1 0, 3 0, 1 2, 1 0))'), ST_Polygon('polygon((0 1, 2 1, 0 3, 0 1))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((3 0, 3 3, 0 3, 3 0))'), ST_Polygon('polygon((2 2, 5 2, 2 5, 2 2))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((2 0, 2 2, 0 2, 2 0))'), ST_Polygon('polygon((1 1, 3 1, 1 3, 1 1))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((1 1, 2 1, 1 2, 1 1))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 1 0, 0 1, 1 1))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'))) from onerow; -select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((2 2, 2 0, 3 0, 3 3, 0 3, 0 2, 2 2))'))) from onerow; -select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 3 6, 6 0, 0 0))'))) from onerow; -select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 0 8, 8 0, 0 0))'))) from onerow; -select ST_AsText(ST_Centroid(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3)))) from onerow; -select ST_Area(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,-80, -179.98, -80.03), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,80, -179.98, 80.03), 4326)) from onerow; -select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,-0.01, -179.98, 0.02), 4326)) from onerow; -select ST_AsText(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)) from onerow; -select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 3 6, 6 0, 0 0))'))) from onerow; -select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 0 8, 8 0, 0 0))'))) from onerow; -select ST_AsText(ST_Centroid(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3)))) from onerow; -SELECT ST_AsText(ST_Difference(ST_MultiPoint(1, 1, 1.5, 1.5, 2, 2), ST_Point(1.5, 1.5))) FROM onerow; -SELECT ST_AsText(ST_Difference(ST_Polygon(0, 0, 0, 10, 10, 10, 10, 0), ST_Polygon(0, 0, 0, 5, 5, 5, 5, 0))) from onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_Point('point(0 0)'), ST_Point('point(2 2)'))) FROM onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_MultiPoint('multipoint((0 0))'), ST_MultiPoint('multipoint((2 2))'))) FROM onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_LineString('linestring(0 2, 2 2)'), ST_LineString('linestring(1 2, 3 2)'))) FROM onerow; -SELECT ST_AsText(ST_SymmetricDiff(ST_Polygon('polygon((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 3 1, 3 3, 1 3, 1 1))'))) FROM onerow; -select ST_AsText(ST_SetSRID(ST_MultiLineString(array(0,80, 0.03, 80.04)), 4326)) from onerow; -select ST_AsText(ST_SetSRID(ST_MultiLineString(array(0.0, 80.0, 0.03, 80.04)), 4326)) from onerow; -select ST_AsText(ST_SetSRID(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))'), 4326)) from onerow; -select ST_AsText(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)) from onerow; -select ST_AsJson(ST_Intersection(ST_Linestring(0,0, 1,1), ST_Linestring(2,2, 3,3))) from onerow; -select ST_AsJson(ST_GeomFromJson('{"x":0.0,"y":0.0}')) from onerow; -select ST_AsText(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')) from onerow; -select ST_AsJson(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')) from onerow; -select ST_AsText(ST_GeomFromGeoJson('{"type":"LineString", "coordinates":[[1,2], [3,4]]}')) from onerow; -select ST_AsJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid":4326}}')) from onerow; -select ST_AsJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid": 0}}')) from onerow; -select ST_AsGeoJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid":4326}}')) from onerow; -select ST_AsGeoJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid": 0}}')) from onerow; -SELECT ST_AsGeoJSON(ST_MultiLineString(array(1, 1, 2, 2, 3, 3), array(10, 10, 11, 11, 12, 12))) from onerow; -select ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJson(ST_Point(1.2, 2.4)))) from onerow; -select ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJson(ST_LineString(1,2, 3,4)))) from onerow; -select ST_AsText(ST_Boundary(ST_LineString(0,1, 1,0))) from onerow; -select ST_AsText(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4))) from onerow; -select ST_AsText(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 0)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 1)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 2)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 4)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 0)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 1)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 2)) from onerow; -select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 3)) from onerow; -select ST_AsText(ST_ExteriorRing(ST_Polygon(1,1, 1,4, 4,1))) from onerow; -select ST_AsText(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))'))) from onerow; -select ST_AsText(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))) from onerow; -select ST_AsText(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3)) from onerow; -select ST_AsText(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)) from onerow; -select ST_AsJson(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)) from onerow; -select ST_AsText(ST_GeometryN(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)),((8 24, 1 28, 9 25, 8 24)), ((13 33, 7 36, 1 40, 10 43, 13 33)))'), 1)) from onerow; -select ST_AsText(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1)) from onerow; +select ST_AsJson(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1)); +select ST_AsJson(ST_Polygon(1.5,2.5, 3.0,2.2, 2.2,1.1, 1.5, 2.5)); +select ST_AsJson(ST_Polygon(0.1,2.2, 3.0,2.2, 2.2,1.1, 0.1, 2.2)); +select ST_AsJson(ST_Polygon(1,1, 1,4, 4,4, 4,1)); +select ST_AsText(ST_Polygon(1,1, 1,4, 4,1)); +select ST_AsText(ST_Polygon(1,1, 4,1, 1,4)); +select ST_AsText(ST_Polygon(1,1, 1,4, 4,1, 1,1)); +select ST_AsText(ST_Polygon(1,1, 4,1, 1,4, 1,1)); +select ST_AsText(ST_LineString(array(0,0), array(2,2))); +select ST_AsText(ST_LineString(array(ST_Point(0,0), ST_Point(2,2)))); +select st_AsText(ST_Envelope(ST_LineString(0,0, 2,2))); +select st_AsText(ST_Envelope(ST_Polygon(1,1, 4,1, 4,4, 1,4))); +select st_AsText(ST_Envelope(st_polygon(2,0, 2,3, 3,0))); +select ST_AsText(ST_Intersection(ST_Point(1,1), ST_Point(1,1))); +select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_Point(0,3))); +select ST_AsText(ST_Intersection(ST_GeomFromText('linestring(0 2, 0 0, 2 0)'), ST_GeomFromText('linestring(0 3, 0 1, 1 0, 3 0)'))); +select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_LineString(0,2, 0,4))); +select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,4), ST_LineString(0,3, 0,5))); +select ST_AsText(ST_Intersection(ST_LineString(0,2, 0,5), ST_LineString(1,3, 0,3, 0,4, 1,4))); +select ST_AsText(ST_Intersection(ST_LineString(0,2, 2,3), ST_Polygon(1,1, 4,1, 4,4, 1,4))); +select ST_AsText(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), ST_LineString(1,1, 1,4))); +select ST_AsText(ST_Intersection(ST_Polygon(1,1, 1,4, 4,4, 4,1), ST_LineString(1,3, 1,4, 0,4))); +select ST_AsText(ST_Intersection(ST_Polygon(2,0, 2,3, 3,0), ST_Polygon(1,1, 4,1, 4,4, 1,4))); +select ST_AsText(ST_Intersection(ST_Polygon(1,0, 3,0, 1,2), ST_Polygon(0,1, 2,1, 0,3))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((1 0, 3 0, 1 2, 1 0))'), ST_Polygon('polygon((0 1, 2 1, 0 3, 0 1))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((3 0, 3 3, 0 3, 3 0))'), ST_Polygon('polygon((2 2, 5 2, 2 5, 2 2))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((2 0, 2 2, 0 2, 2 0))'), ST_Polygon('polygon((1 1, 3 1, 1 3, 1 1))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((1 1, 2 1, 1 2, 1 1))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 2 0, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 1 0, 0 1, 1 1))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'), ST_Polygon('polygon((0 0, 1 0, 0 1, 0 0))'))); +select ST_AsText(ST_Intersection(ST_Polygon('polygon((0 0, 3 0, 0 3, 0 0))'), ST_Polygon('polygon((2 2, 2 0, 3 0, 3 3, 0 3, 0 2, 2 2))'))); +select ST_AsText(ST_Centroid(ST_Point(2, 3))); +select ST_AsText(ST_Centroid(ST_GeomFromText('multipoint ((0 0), (1 1), (1 -1), (6 0))'))); +select ST_AsText(ST_Centroid(ST_GeomFromText('linestring (0 0, 6 0)'))); +select ST_AsText(ST_Centroid(ST_GeomFromText('linestring (0 0, 2 4, 6 8)'))); +select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 0 8, 8 8, 8 0, 0 0))'))); +select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((1 1, 5 1, 3 4))'))); +select ST_Area(ST_Buffer(ST_GeomFromText('point (0 0)'), 1)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,-80, -179.98, -80.03), 4326)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,80, -179.98, 80.03), 4326)); +select ST_GeodesicLengthWGS84(ST_SetSRID(ST_LineString(179.98,-0.01, -179.98, 0.02), 4326)); +select ST_AsText(ST_Buffer(ST_GeomFromText('polygon ((0 0, 3 0, 3 2, 5 2, 5 5, 2 5, 2 3, 0 3, 0 0))'), -1)); +select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 3 6, 6 0, 0 0))'))); +select ST_AsText(ST_Centroid(ST_GeomFromText('polygon ((0 0, 0 8, 8 0, 0 0))'))); +select ST_AsText(ST_Centroid(ST_MultiPolygon(array(1,1, 1,2, 2,2, 2,1), array(3,3, 3,4, 4,4, 4,3)))); +SELECT ST_AsText(ST_Difference(ST_MultiPoint(1, 1, 1.5, 1.5, 2, 2), ST_Point(1.5, 1.5))); +SELECT ST_AsText(ST_Difference(ST_Polygon(0, 0, 0, 10, 10, 10, 10, 0), ST_Polygon(0, 0, 0, 5, 5, 5, 5, 0))); +SELECT ST_AsText(ST_SymmetricDiff(ST_Point('point(0 0)'), ST_Point('point(2 2)'))); +SELECT ST_AsText(ST_SymmetricDiff(ST_MultiPoint('multipoint((0 0))'), ST_MultiPoint('multipoint((2 2))'))); +SELECT ST_AsText(ST_SymmetricDiff(ST_LineString('linestring(0 2, 2 2)'), ST_LineString('linestring(1 2, 3 2)'))); +SELECT ST_AsText(ST_SymmetricDiff(ST_Polygon('polygon((0 0, 2 0, 2 2, 0 2, 0 0))'), ST_Polygon('polygon((1 1, 3 1, 3 3, 1 3, 1 1))'))); +select ST_AsText(ST_SetSRID(ST_MultiLineString(array(0,80, 0.03, 80.04)), 4326)); +select ST_AsText(ST_SetSRID(ST_MultiLineString(array(0.0, 80.0, 0.03, 80.04)), 4326)); +select ST_AsText(ST_SetSRID(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))'), 4326)); +select ST_AsText(ST_GeomFromText('MultiLineString((0 80, 0.03 80.04))', 4326)); +select ST_AsJson(ST_Intersection(ST_Linestring(0,0, 1,1), ST_Linestring(2,2, 3,3))); +select ST_AsJson(ST_GeomFromJson('{"x":0.0,"y":0.0}')); +select ST_AsText(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')); +select ST_AsJson(ST_GeomFromGeoJson('{"type":"Point", "coordinates":[1.2, 2.4]}')); +select ST_AsText(ST_GeomFromGeoJson('{"type":"LineString", "coordinates":[[1,2], [3,4]]}')); +select ST_AsJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid":4326}}')); +select ST_AsJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid": 0}}')); +select ST_AsGeoJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid":4326}}')); +select ST_AsGeoJson(ST_GeomFromJson('{"x":1.2,"y":2.4,"spatialReference":{"wkid": 0}}')); +SELECT ST_AsGeoJSON(ST_MultiLineString(array(1, 1, 2, 2, 3, 3), array(10, 10, 11, 11, 12, 12))); +select ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJson(ST_Point(1.2, 2.4)))); +select ST_AsText(ST_GeomFromGeoJson(ST_AsGeoJson(ST_LineString(1,2, 3,4)))); +select ST_AsText(ST_Boundary(ST_LineString(0,1, 1,0))); +select ST_AsText(ST_Boundary(ST_Polygon(1,1, 4,1, 1,4))); +select ST_AsText(ST_Boundary(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))); +select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 0)); +select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 1)); +select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 2)); +select ST_AsJson(ST_PointN(ST_GeomFromText('multipoint ((10 40), (40 30), (20 20), (30 10))', 0), 4)); +select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 0)); +select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 1)); +select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 2)); +select ST_AsJson(ST_PointN(ST_GeomFromText('linestring (10.02 20.01, 10.32 23.98, 11.92 25.64)'), 3)); +select ST_AsText(ST_ExteriorRing(ST_Polygon(1,1, 1,4, 4,1))); +select ST_AsText(ST_ExteriorRing(ST_Polygon('polygon ((1 1, 4 1, 1 4))'))); +select ST_AsText(ST_ExteriorRing(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'))); +select ST_AsText(ST_GeometryN(ST_GeomFromText('multipoint (10 40, 40 30, 20 20, 30 10)'), 3)); +select ST_AsText(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)); +select ST_AsJson(ST_GeometryN(ST_GeomFromText('multilinestring ((2 4, 10 10), (20 20, 7 8))'), 2)); +select ST_AsText(ST_GeometryN(ST_GeomFromText('multipolygon (((3 3, 4 6, 5 3, 3 3)),((8 24, 1 28, 9 25, 8 24)), ((13 33, 7 36, 1 40, 10 43, 13 33)))'), 1)); +select ST_AsText(ST_InteriorRingN(ST_Polygon('polygon ((0 0, 8 0, 0 8, 0 0), (1 1, 1 5, 5 1, 1 1))'), 1)); diff --git a/json/build.xml b/json/build.xml index 1871084..5e02873 100755 --- a/json/build.xml +++ b/json/build.xml @@ -3,11 +3,10 @@ - - - - - + + + + diff --git a/json/pom.xml b/json/pom.xml index d6e880b..604d7c8 100644 --- a/json/pom.xml +++ b/json/pom.xml @@ -4,7 +4,7 @@ com.esri.hadoop spatial-sdk-hadoop - 2.0.0-SNAPSHOT + 2.2.1-SNAPSHOT ../ diff --git a/pom.xml b/pom.xml old mode 100755 new mode 100644 index ffa36e1..823fb26 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ com.esri.hadoop spatial-sdk-hadoop - 2.0.0-SNAPSHOT + 2.2.1-SNAPSHOT pom Spatial Framework for Hadoop @@ -11,11 +11,11 @@ Enables developers and data scientists to use the Hadoop data processing system for spatial data analysis. - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + @@ -25,7 +25,7 @@ Esri http://www.esri.com - developer + developer @@ -34,7 +34,7 @@ Esri http://www.esri.com - developer + developer @@ -69,6 +69,7 @@ + java-6 @@ -90,41 +91,141 @@ 1.8 - - java-9 + java-disable-doclint - [1.8,) + [1.8,) - -Xdoclint:none + -Xdoclint:none + + + jackson-2.6 + + 2.6.7.1 + + + + jackson-2.8 + + 2.8.11.2 + + + + jackson-2.9 + + 2.9.10 + + + + jackson-2.10 + + 2.10.5 + + + + jackson-2.11 + + 2.11.4 + + + + jackson-2.12 + + 2.12.7 + + + + jackson-2.13 + + 2.13.5 + + + + jackson-2.14 + + 2.14.3 + + + + jackson-2.15 + + 2.15.4 + + + + jackson-2.16 + + 2.16.2 + + + + jackson-2.17 + + 2.17.3 + + + + jackson-2.18 + + 2.18.2 + + + + + geometry-2.2.0 + + 2.2.0 + + + + geometry-2.2.1 + + 2.2.1 + + + + geometry-2.2.2 + + 2.2.2 + + - hadoop-1.1 + geometry-2.2.3 - 1.1.1 + 2.2.3 - hadoop-1.2 + geometry-2.2.4 - 1.2.1 + 2.2.4 + hadoop-2.2 2.2.0 + + hadoop-2.3 + + 2.3.0 + + hadoop-2.4 @@ -146,83 +247,58 @@ hadoop-2.7 - 2.7.4 + 2.7.7 hadoop-2.8 - 2.8.2 + 2.8.5 + + + + hadoop-2.9 + + 2.9.2 + + + + hadoop-2.10 + + 2.10.2 hadoop-3.0 - 3.0.0-beta1 + 3.0.3 - - hive-.11 + hadoop-3.1 - 0.11.0 + 3.1.4 - - hive-.12 + hadoop-3.2 - 0.12.0 + 3.2.4 - hive-.13 + hadoop-3.3 - 0.13.0 + 3.3.6 - hive-.14 + hadoop-3.4 - 0.14.0 + 3.4.1 - - - org.apache.calcite - calcite-core - 1.0.0-incubating - - - org.apache.calcite - calcite-avatica - 1.0.0-incubating - - - org.apache.hive - hive-exec - 0.14.0 - - - org.apache.calcite - * - - - - - + + hive-1.0 @@ -262,7 +338,25 @@ hive-2.3 - 2.3.1 + 2.3.10 + + + + hive-3.0 + + 3.0.0 + + + + hive-3.1 + + 3.1.3 + + + + hive-4.0 + + 4.0.1 @@ -275,21 +369,21 @@ - - - org.apache.maven.plugins - maven-gpg-plugin - - - sign-artifacts - verify - - sign - - - - - + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + @@ -298,16 +392,16 @@ UTF-8 - 1.6 - 1.6 + 1.8 + 1.8 - 2.2.0 - 0.12.0 - 2.6.5 - 1.1.3 - 2.0.0 - 4.11 + 3.3.6 + 3.1.3 + 2.16.2 + 1.3.4 + 2.2.4 + 4.13.2 2.3.2 @@ -341,15 +435,15 @@ - com.fasterxml.jackson.core - jackson-core - ${jackson.version} + com.fasterxml.jackson.core + jackson-core + ${jackson.version} - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} @@ -365,11 +459,11 @@ - junit - junit - ${junit.version} - test - + junit + junit + ${junit.version} + test + @@ -381,7 +475,7 @@ org.apache.maven.plugins maven-compiler-plugin ${compiler.plugin.version} - + ${java.source.version} ${java.target.version} @@ -394,19 +488,19 @@ -Xmx1024m - - org.apache.maven.plugins - maven-source-plugin - ${source.plugin.version} - - - attach-sources - - jar-no-fork - - - - + + org.apache.maven.plugins + maven-source-plugin + ${source.plugin.version} + + + attach-sources + + jar-no-fork + + + + org.apache.maven.plugins maven-javadoc-plugin @@ -417,23 +511,23 @@ jar - - ${javadoc.doclint.param} - + + ${javadoc.doclint.param} + - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.7 - true - - ossrh - https://oss.sonatype.org/ - true - - + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://oss.sonatype.org/ + true + +