Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
cccfa9dc
Commit
cccfa9dc
authored
Jun 29, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19908 Add class Type_collection
parent
5de9dd7b
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
225 additions
and
138 deletions
+225
-138
mysql-test/main/gis-debug.result
mysql-test/main/gis-debug.result
+10
-16
mysql-test/main/gis-debug.test
mysql-test/main/gis-debug.test
+15
-9
sql/sql_type.cc
sql/sql_type.cc
+179
-110
sql/sql_type.h
sql/sql_type.h
+21
-3
No files found.
mysql-test/main/gis-debug.result
View file @
cccfa9dc
...
...
@@ -356,22 +356,16 @@ SET SESSION debug_dbug="-d,Item_func_in";
# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
#
SET debug_dbug='+d,num_op';
CREATE TABLE t1 AS SELECT
POINT(0,0)+POINT(0,0),
POINT(0,0)-POINT(0,0),
POINT(0,0)*POINT(0,0),
POINT(0,0)/POINT(0,0),
POINT(0,0) MOD POINT(0,0) LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`POINT(0,0)+POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)-POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)*POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)/POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0) MOD POINT(0,0)` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT POINT(0,0)+POINT(0,0);
ERROR HY000: Illegal parameter data types geometry and geometry for operation '+'
SELECT POINT(0,0)-POINT(0,0);
ERROR HY000: Illegal parameter data types geometry and geometry for operation '-'
SELECT POINT(0,0)*POINT(0,0);
ERROR HY000: Illegal parameter data types geometry and geometry for operation '*'
SELECT POINT(0,0)/POINT(0,0);
ERROR HY000: Illegal parameter data types geometry and geometry for operation '/'
SELECT POINT(0,0) MOD POINT(0,0);
ERROR HY000: Illegal parameter data types geometry and geometry for operation 'MOD'
CREATE TABLE t1 AS SELECT
POINT(0,0)+'0',
POINT(0,0)-'0',
...
...
mysql-test/main/gis-debug.test
View file @
cccfa9dc
...
...
@@ -73,15 +73,21 @@ SET SESSION debug_dbug="-d,Item_func_in";
SET
debug_dbug
=
'+d,num_op'
;
# (GEOMETRY,GEOMETRY) gives GEOMETRY for all operators
CREATE
TABLE
t1
AS
SELECT
POINT
(
0
,
0
)
+
POINT
(
0
,
0
),
POINT
(
0
,
0
)
-
POINT
(
0
,
0
),
POINT
(
0
,
0
)
*
POINT
(
0
,
0
),
POINT
(
0
,
0
)
/
POINT
(
0
,
0
),
POINT
(
0
,
0
)
MOD
POINT
(
0
,
0
)
LIMIT
0
;
SHOW
CREATE
TABLE
t1
;
DROP
TABLE
t1
;
# (GEOMETRY,GEOMETRY) goes through
# Type_collection_geometry::aggregate_for_num_op() which fails.
# Type pairs from Type_handler_data::m_type_aggregator_xxx are not even tested,
# as both sides are from the same type collection.
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
POINT
(
0
,
0
)
+
POINT
(
0
,
0
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
POINT
(
0
,
0
)
-
POINT
(
0
,
0
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
POINT
(
0
,
0
)
*
POINT
(
0
,
0
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
POINT
(
0
,
0
)
/
POINT
(
0
,
0
);
--
error
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT
POINT
(
0
,
0
)
MOD
POINT
(
0
,
0
);
# (GEOMETRY,VARCHAR) gives GEOMETRY for all operators
CREATE
TABLE
t1
AS
SELECT
...
...
sql/sql_type.cc
View file @
cccfa9dc
This diff is collapsed.
Click to expand it.
sql/sql_type.h
View file @
cccfa9dc
...
...
@@ -87,6 +87,7 @@ class Vers_history_point;
class
Virtual_column_info
;
class
Conv_source
;
class
ST_FIELD_INFO
;
class
Type_collection
;
#define my_charset_numeric my_charset_latin1
...
...
@@ -3281,12 +3282,10 @@ class Type_handler
DBUG_ASSERT
(
type
!=
TIME_RESULT
);
return
get_handler_by_cmp_type
(
type
);
}
virtual
const
Type_collection
*
type_collection
()
const
;
static
const
Type_handler
*
aggregate_for_result_traditional
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
);
static
const
Type_handler
*
aggregate_for_num_op_traditional
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
);
virtual
const
Name
name
()
const
=
0
;
virtual
const
Name
version
()
const
{
return
m_version_default
;
}
...
...
@@ -6372,6 +6371,7 @@ class Type_handler_geometry: public Type_handler_string_result
bool
is_param_long_data_type
()
const
{
return
true
;
}
uint32
max_display_length_for_field
(
const
Conv_source
&
src
)
const
;
uint32
calc_pack_length
(
uint32
length
)
const
;
const
Type_collection
*
type_collection
()
const
override
;
const
Type_handler
*
type_handler_for_comparison
()
const
;
bool
type_can_have_key_part
()
const
{
...
...
@@ -6570,6 +6570,24 @@ class Type_handler_interval_DDhhmmssff: public Type_handler_long_blob
};
class
Type_collection
{
public:
virtual
~
Type_collection
()
{}
virtual
const
Type_handler
*
aggregate_for_result
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
)
const
=
0
;
virtual
const
Type_handler
*
aggregate_for_comparison
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
)
const
=
0
;
virtual
const
Type_handler
*
aggregate_for_min_max
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
)
const
=
0
;
virtual
const
Type_handler
*
aggregate_for_num_op
(
const
Type_handler
*
h1
,
const
Type_handler
*
h2
)
const
=
0
;
};
/**
A handler for hybrid type functions, e.g.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment