Skip to content

Commit e362e57

Browse files
committed
Support geo-bounded-predicate for geohash and geohex
This involved copying the H3 utils from spatial plugin to esql. We should rather find a common location or dependency for these.
1 parent 6075bb2 commit e362e57

24 files changed

+1464
-229
lines changed

server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashBoundedPredicate.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
*/
1919
public class GeoHashBoundedPredicate {
2020

21+
private final int precision;
2122
private final boolean crossesDateline;
2223
private final long maxHashes;
2324
private final GeoBoundingBox bbox;
2425

2526
public GeoHashBoundedPredicate(int precision, GeoBoundingBox bbox) {
27+
this.precision = precision;
2628
this.crossesDateline = bbox.right() < bbox.left();
2729
this.bbox = bbox;
2830
final long hashesY = (long) Math.ceil(((bbox.top() - bbox.bottom()) / Geohash.latHeightInDegrees(precision)) + 1);
@@ -69,4 +71,8 @@ private boolean intersects(double minX, double maxX, double minY, double maxY) {
6971
public long getMaxHashes() {
7072
return maxHashes;
7173
}
74+
75+
public int precision() {
76+
return precision;
77+
}
7278
}

x-pack/plugin/esql/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ dependencies {
4040
implementation project('compute:ann')
4141
implementation project(':libs:dissect')
4242
implementation project(':libs:grok')
43-
implementation project(':libs:h3')
43+
api "org.apache.lucene:lucene-spatial3d:${versions.lucene}"
44+
api project(":libs:h3")
4445
implementation project('arrow')
4546

4647
// Also contains a dummy processor to allow compilation with unused annotations.
@@ -69,6 +70,10 @@ dependencies {
6970
internalClusterTestImplementation project(":modules:mapper-extras")
7071
}
7172

73+
tasks.named("dependencyLicenses").configure {
74+
mapping from: /lucene-.*/, to: 'lucene'
75+
}
76+
7277
def generatedPath = "src/main/generated"
7378
def projectDirectory = project.layout.projectDirectory
7479
def generatedSourceDir = projectDirectory.dir(generatedPath)

x-pack/plugin/esql/licenses/lucene-LICENSE.txt

Lines changed: 475 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
Apache Lucene
2+
Copyright 2014 The Apache Software Foundation
3+
4+
This product includes software developed at
5+
The Apache Software Foundation (http://www.apache.org/).
6+
7+
Includes software from other Apache Software Foundation projects,
8+
including, but not limited to:
9+
- Apache Ant
10+
- Apache Jakarta Regexp
11+
- Apache Commons
12+
- Apache Xerces
13+
14+
ICU4J, (under analysis/icu) is licensed under an MIT styles license
15+
and Copyright (c) 1995-2008 International Business Machines Corporation and others
16+
17+
Some data files (under analysis/icu/src/data) are derived from Unicode data such
18+
as the Unicode Character Database. See http://unicode.org/copyright.html for more
19+
details.
20+
21+
Brics Automaton (under core/src/java/org/apache/lucene/util/automaton) is
22+
BSD-licensed, created by Anders Møller. See http://www.brics.dk/automaton/
23+
24+
The levenshtein automata tables (under core/src/java/org/apache/lucene/util/automaton) were
25+
automatically generated with the moman/finenight FSA library, created by
26+
Jean-Philippe Barrette-LaPierre. This library is available under an MIT license,
27+
see http://sites.google.com/site/rrettesite/moman and
28+
http://bitbucket.org/jpbarrette/moman/overview/
29+
30+
The class org.apache.lucene.util.WeakIdentityMap was derived from
31+
the Apache CXF project and is Apache License 2.0.
32+
33+
The Google Code Prettify is Apache License 2.0.
34+
See http://code.google.com/p/google-code-prettify/
35+
36+
JUnit (junit-4.10) is licensed under the Common Public License v. 1.0
37+
See http://junit.sourceforge.net/cpl-v10.html
38+
39+
This product includes code (JaspellTernarySearchTrie) from Java Spelling Checkin
40+
g Package (jaspell): http://jaspell.sourceforge.net/
41+
License: The BSD License (http://www.opensource.org/licenses/bsd-license.php)
42+
43+
The snowball stemmers in
44+
analysis/common/src/java/net/sf/snowball
45+
were developed by Martin Porter and Richard Boulton.
46+
The snowball stopword lists in
47+
analysis/common/src/resources/org/apache/lucene/analysis/snowball
48+
were developed by Martin Porter and Richard Boulton.
49+
The full snowball package is available from
50+
http://snowball.tartarus.org/
51+
52+
The KStem stemmer in
53+
analysis/common/src/org/apache/lucene/analysis/en
54+
was developed by Bob Krovetz and Sergio Guzman-Lara (CIIR-UMass Amherst)
55+
under the BSD-license.
56+
57+
The Arabic,Persian,Romanian,Bulgarian, Hindi and Bengali analyzers (common) come with a default
58+
stopword list that is BSD-licensed created by Jacques Savoy. These files reside in:
59+
analysis/common/src/resources/org/apache/lucene/analysis/ar/stopwords.txt,
60+
analysis/common/src/resources/org/apache/lucene/analysis/fa/stopwords.txt,
61+
analysis/common/src/resources/org/apache/lucene/analysis/ro/stopwords.txt,
62+
analysis/common/src/resources/org/apache/lucene/analysis/bg/stopwords.txt,
63+
analysis/common/src/resources/org/apache/lucene/analysis/hi/stopwords.txt,
64+
analysis/common/src/resources/org/apache/lucene/analysis/bn/stopwords.txt
65+
See http://members.unine.ch/jacques.savoy/clef/index.html.
66+
67+
The German,Spanish,Finnish,French,Hungarian,Italian,Portuguese,Russian and Swedish light stemmers
68+
(common) are based on BSD-licensed reference implementations created by Jacques Savoy and
69+
Ljiljana Dolamic. These files reside in:
70+
analysis/common/src/java/org/apache/lucene/analysis/de/GermanLightStemmer.java
71+
analysis/common/src/java/org/apache/lucene/analysis/de/GermanMinimalStemmer.java
72+
analysis/common/src/java/org/apache/lucene/analysis/es/SpanishLightStemmer.java
73+
analysis/common/src/java/org/apache/lucene/analysis/fi/FinnishLightStemmer.java
74+
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchLightStemmer.java
75+
analysis/common/src/java/org/apache/lucene/analysis/fr/FrenchMinimalStemmer.java
76+
analysis/common/src/java/org/apache/lucene/analysis/hu/HungarianLightStemmer.java
77+
analysis/common/src/java/org/apache/lucene/analysis/it/ItalianLightStemmer.java
78+
analysis/common/src/java/org/apache/lucene/analysis/pt/PortugueseLightStemmer.java
79+
analysis/common/src/java/org/apache/lucene/analysis/ru/RussianLightStemmer.java
80+
analysis/common/src/java/org/apache/lucene/analysis/sv/SwedishLightStemmer.java
81+
82+
The Stempel analyzer (stempel) includes BSD-licensed software developed
83+
by the Egothor project http://egothor.sf.net/, created by Leo Galambos, Martin Kvapil,
84+
and Edmond Nolan.
85+
86+
The Polish analyzer (stempel) comes with a default
87+
stopword list that is BSD-licensed created by the Carrot2 project. The file resides
88+
in stempel/src/resources/org/apache/lucene/analysis/pl/stopwords.txt.
89+
See http://project.carrot2.org/license.html.
90+
91+
The SmartChineseAnalyzer source code (smartcn) was
92+
provided by Xiaoping Gao and copyright 2009 by www.imdict.net.
93+
94+
WordBreakTestUnicode_*.java (under modules/analysis/common/src/test/)
95+
is derived from Unicode data such as the Unicode Character Database.
96+
See http://unicode.org/copyright.html for more details.
97+
98+
The Morfologik analyzer (morfologik) includes BSD-licensed software
99+
developed by Dawid Weiss and Marcin Miłkowski (http://morfologik.blogspot.com/).
100+
101+
Morfologik uses data from Polish ispell/myspell dictionary
102+
(http://www.sjp.pl/slownik/en/) licenced on the terms of (inter alia)
103+
LGPL and Creative Commons ShareAlike.
104+
105+
Morfologic includes data from BSD-licensed dictionary of Polish (SGJP)
106+
(http://sgjp.pl/morfeusz/)
107+
108+
Servlet-api.jar and javax.servlet-*.jar are under the CDDL license, the original
109+
source code for this can be found at http://www.eclipse.org/jetty/downloads.php
110+
111+
===========================================================================
112+
Kuromoji Japanese Morphological Analyzer - Apache Lucene Integration
113+
===========================================================================
114+
115+
This software includes a binary and/or source version of data from
116+
117+
mecab-ipadic-2.7.0-20070801
118+
119+
which can be obtained from
120+
121+
http://atilika.com/releases/mecab-ipadic/mecab-ipadic-2.7.0-20070801.tar.gz
122+
123+
or
124+
125+
http://jaist.dl.sourceforge.net/project/mecab/mecab-ipadic/2.7.0-20070801/mecab-ipadic-2.7.0-20070801.tar.gz
126+
127+
===========================================================================
128+
mecab-ipadic-2.7.0-20070801 Notice
129+
===========================================================================
130+
131+
Nara Institute of Science and Technology (NAIST),
132+
the copyright holders, disclaims all warranties with regard to this
133+
software, including all implied warranties of merchantability and
134+
fitness, in no event shall NAIST be liable for
135+
any special, indirect or consequential damages or any damages
136+
whatsoever resulting from loss of use, data or profits, whether in an
137+
action of contract, negligence or other tortuous action, arising out
138+
of or in connection with the use or performance of this software.
139+
140+
A large portion of the dictionary entries
141+
originate from ICOT Free Software. The following conditions for ICOT
142+
Free Software applies to the current dictionary as well.
143+
144+
Each User may also freely distribute the Program, whether in its
145+
original form or modified, to any third party or parties, PROVIDED
146+
that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
147+
on, or be attached to, the Program, which is distributed substantially
148+
in the same form as set out herein and that such intended
149+
distribution, if actually made, will neither violate or otherwise
150+
contravene any of the laws and regulations of the countries having
151+
jurisdiction over the User or the intended distribution itself.
152+
153+
NO WARRANTY
154+
155+
The program was produced on an experimental basis in the course of the
156+
research and development conducted during the project and is provided
157+
to users as so produced on an experimental basis. Accordingly, the
158+
program is provided without any warranty whatsoever, whether express,
159+
implied, statutory or otherwise. The term "warranty" used herein
160+
includes, but is not limited to, any warranty of the quality,
161+
performance, merchantability and fitness for a particular purpose of
162+
the program and the nonexistence of any infringement or violation of
163+
any right of any third party.
164+
165+
Each user of the program will agree and understand, and be deemed to
166+
have agreed and understood, that there is no warranty whatsoever for
167+
the program and, accordingly, the entire risk arising from or
168+
otherwise connected with the program is assumed by the user.
169+
170+
Therefore, neither ICOT, the copyright holder, or any other
171+
organization that participated in or was otherwise related to the
172+
development of the program and their respective officials, directors,
173+
officers and other employees shall be held liable for any and all
174+
damages, including, without limitation, general, special, incidental
175+
and consequential damages, arising out of or otherwise in connection
176+
with the use or inability to use the program or any product, material
177+
or result produced or otherwise obtained by using the program,
178+
regardless of whether they have been advised of, or otherwise had
179+
knowledge of, the possibility of such damages at any time during the
180+
project or thereafter. Each user will be deemed to have agreed to the
181+
foregoing by his or her commencement of use of the program. The term
182+
"use" as used herein includes, but is not limited to, the use,
183+
modification, copying and distribution of the program and the
184+
production of secondary products from the program.
185+
186+
In the case where the program, whether in its original form or
187+
modified, was distributed or delivered to or received by a user from
188+
any person, organization or entity other than ICOT, unless it makes or
189+
grants independently of ICOT any specific warranty to the user in
190+
writing, such person, organization or entity, will also be exempted
191+
from and not be held liable to the user for any such damages as noted
192+
above as far as the program is concerned.

x-pack/plugin/esql/qa/testFixtures/src/main/java/org/elasticsearch/xpack/esql/CsvAssert.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ private static String pipeTable(
322322
if (values.size() > rows) {
323323
result.append("...").append(System.lineSeparator());
324324
}
325-
return result.toString();
325+
return result.toString().replaceAll("\\s+" + System.lineSeparator(), System.lineSeparator());
326326
}
327327

328328
private static String header(String name, Type type) {

0 commit comments

Comments
 (0)