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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
apachedoris/doris-dev build-env f8bc5d4024e0 21 hours ago 3.28GB
```
**NOTE**: If you want to compile soure code which is later than 0.10, such as master, you should use apachedoris/doris-dev:build-env-0.11 image


#### Step2: Run the Docker image

Expand Down
8 changes: 8 additions & 0 deletions be/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ set_target_properties(librdkafka_cpp PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_D
add_library(librdkafka STATIC IMPORTED)
set_target_properties(librdkafka PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib/librdkafka.a)

add_library(libs2 STATIC IMPORTED)
set_target_properties(libs2 PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib/libs2.a)

find_program(THRIFT_COMPILER thrift ${CMAKE_SOURCE_DIR}/bin)

# llvm-config
Expand Down Expand Up @@ -269,6 +272,7 @@ set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFI
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DBOOST_SYSTEM_NO_DEPRECATED")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -msse4.2")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -DLLVM_ON_UNIX")
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-attributes -DS2_USE_GFLAGS -DS2_USE_GLOG")

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -faligned-new")
Expand Down Expand Up @@ -435,6 +439,7 @@ set(DORIS_LINK_LIBS
DorisGen
Webserver
TestUtil
Geo
${WL_END_GROUP}
)

Expand All @@ -444,6 +449,7 @@ set(DORIS_DEPENDENCIES
rocksdb
librdkafka_cpp
librdkafka
libs2
lzo
snappy
${Boost_LIBRARIES}
Expand Down Expand Up @@ -535,6 +541,7 @@ add_subdirectory(${SRC_DIR}/runtime)
add_subdirectory(${SRC_DIR}/testutil)
add_subdirectory(${SRC_DIR}/tools)
add_subdirectory(${SRC_DIR}/udf_samples)
add_subdirectory(${SRC_DIR}/geo)

# Utility CMake function to make specifying tests and benchmarks less verbose
FUNCTION(ADD_BE_TEST TEST_NAME)
Expand Down Expand Up @@ -563,6 +570,7 @@ if (${MAKE_TEST} STREQUAL "ON")
add_subdirectory(${TEST_DIR}/exprs)
add_subdirectory(${TEST_DIR}/runtime)
add_subdirectory(${TEST_DIR}/http)
add_subdirectory(${TEST_DIR}/geo)
endif ()

# Install be
Expand Down
2 changes: 2 additions & 0 deletions be/src/common/daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "exprs/utility_functions.h"
#include "exprs/json_functions.h"
#include "exprs/hll_hash_function.h"
#include "geo/geo_functions.h"
#include "olap/options.h"
#include "util/time.h"
#include "util/system_metrics.h"
Expand Down Expand Up @@ -264,6 +265,7 @@ void init_daemon(int argc, char** argv, const std::vector<StorePath>& paths) {
JsonFunctions::init();
HllHashFunctions::init();
ESFunctions::init();
GeoFunctions::init();

pthread_t tc_malloc_pid;
pthread_create(&tc_malloc_pid, NULL, tcmalloc_gc_thread, NULL);
Expand Down
47 changes: 47 additions & 0 deletions be/src/geo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# where to put generated libraries
set(LIBRARY_OUTPUT_PATH "${BUILD_DIR}/src/geo")

# where to put generated binaries
set(EXECUTABLE_OUTPUT_PATH "${BUILD_DIR}/src/geo")

add_library(Geo STATIC
geo_common.cpp
geo_functions.cpp
geo_types.cpp
wkt_parse.cpp
${GENSRC_DIR}/geo/wkt_lex.l.cpp
${GENSRC_DIR}/geo/wkt_yacc.y.cpp
)

add_custom_command(
OUTPUT ${GENSRC_DIR}/geo/wkt_lex.l.cpp ${GENSRC_DIR}/geo/wkt_lex.l.h
COMMAND mkdir -p ${GENSRC_DIR}/geo
COMMAND flex --header-file=${GENSRC_DIR}/geo/wkt_lex.l.h --outfile=${GENSRC_DIR}/geo/wkt_lex.l.cpp
${CMAKE_CURRENT_SOURCE_DIR}/wkt_lex.l
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/wkt_lex.l)
set_source_files_properties(${GENSRC_DIR}/geo/wkt_lex.l.cpp PROPERTIES GENERATED TRUE)

add_custom_command(
OUTPUT ${GENSRC_DIR}/geo/wkt_yacc.y.cpp ${GENSRC_DIR}/geo/wkt_yacc.y.hpp
COMMAND mkdir -p ${GENSRC_DIR}/geo
COMMAND bison --output=${GENSRC_DIR}/geo/wkt_yacc.y.cpp ${CMAKE_CURRENT_SOURCE_DIR}/wkt_yacc.y
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/wkt_yacc.y)
set_source_files_properties(${GENSRC_DIR}/geo/wkt_yacc.y.cpp PROPERTIES GENERATED TRUE)

54 changes: 54 additions & 0 deletions be/src/geo/geo_common.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

#include "geo/geo_common.h"

namespace doris {

std::string to_string(GeoParseStatus status) {
switch (status) {
case GEO_PARSE_OK:
return "OK";
case GEO_PARSE_COORD_INVALID:
return "Coordinate invalid";
case GEO_PARSE_LOOP_NOT_CLOSED:
return "Loop is not closed";
case GEO_PARSE_LOOP_LACK_VERTICES:
return "Loop lack enough vertices";
case GEO_PARSE_LOOP_INVALID:
return "Loop invalid";
case GEO_PARSE_POLYGON_NOT_HOLE:
return "Loop not contained in the first loop";
case GEO_PARSE_POLYLINE_LACK_VERTICES:
return "Line string lack vertices";
case GEO_PARSE_POLYLINE_INVALID:
return "Line string invalid";
case GEO_PARSE_CIRCLE_INVALID:
return "Circle invalid";
case GEO_PARSE_WKT_SYNTAX_ERROR:
return "WKT syntax error";
default:
return "Unknown";
}
}

std::ostream& operator<<(std::ostream& os, GeoParseStatus status) {
os << to_string(status);
return os;
}

}
52 changes: 52 additions & 0 deletions be/src/geo/geo_common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

#pragma once

#include <ostream>
#include <string>

namespace doris {

enum GeoShapeType {
GEO_SHAPE_ANY = 0,
GEO_SHAPE_POINT = 1,
GEO_SHAPE_LINE_STRING = 2,
GEO_SHAPE_POLYGON = 3,
GEO_SHAPE_MULTI_POINT = 4,
GEO_SHAPE_MULTI_LINE_STRING = 5,
GEO_SHAPE_MULTI_POLYGON = 6,
GEO_SHAPE_CIRCLE = 7,
};

enum GeoParseStatus {
GEO_PARSE_OK = 0,
GEO_PARSE_COORD_INVALID = 1,
GEO_PARSE_LOOP_NOT_CLOSED = 2,
GEO_PARSE_LOOP_LACK_VERTICES = 3,
GEO_PARSE_LOOP_INVALID = 4,
GEO_PARSE_POLYGON_NOT_HOLE = 5,
GEO_PARSE_POLYLINE_LACK_VERTICES = 6,
GEO_PARSE_POLYLINE_INVALID = 7,
GEO_PARSE_CIRCLE_INVALID = 8,
GEO_PARSE_WKT_SYNTAX_ERROR = 9,
};

std::string to_string(GeoParseStatus status);
std::ostream& operator<<(std::ostream& os, GeoParseStatus status);

}
Loading