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
ec7c4fb4
Commit
ec7c4fb4
authored
Oct 19, 2009
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
port of fixes for bug-20577 and 46362 for TO_SECONDS
parent
93e02adc
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
378 additions
and
9 deletions
+378
-9
mysql-test/r/partition_pruning.result
mysql-test/r/partition_pruning.result
+329
-0
mysql-test/t/partition_pruning.test
mysql-test/t/partition_pruning.test
+20
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+29
-9
No files found.
mysql-test/r/partition_pruning.result
View file @
ec7c4fb4
This diff is collapsed.
Click to expand it.
mysql-test/t/partition_pruning.test
View file @
ec7c4fb4
...
...
@@ -51,6 +51,26 @@ INSERT INTO t1 VALUES ('0000-00-00'), ('0000-01-02'), ('0001-01-01'),
ALTER
TABLE
t1
DROP
KEY
a
;
--
source
include
/
partition_date_range
.
inc
DROP
TABLE
t1
;
--
echo
# TO_SECONDS, test of LIST and index
CREATE
TABLE
t1
(
a
DATE
,
KEY
(
a
))
PARTITION
BY
LIST
(
TO_SECONDS
(
a
))
(
PARTITION
`p0001-01-01`
VALUES
IN
(
TO_SECONDS
(
'0001-01-01'
)),
PARTITION
`p2001-01-01`
VALUES
IN
(
TO_SECONDS
(
'2001-01-01'
)),
PARTITION
`pNULL`
VALUES
IN
(
NULL
),
PARTITION
`p0000-01-02`
VALUES
IN
(
TO_SECONDS
(
'0000-01-02'
)),
PARTITION
`p1001-01-01`
VALUES
IN
(
TO_SECONDS
(
'1001-01-01'
)));
if
(
$verify_without_partitions
)
{
ALTER
TABLE
t1
REMOVE
PARTITIONING
;
}
INSERT
INTO
t1
VALUES
(
'0000-00-00'
),
(
'0000-01-02'
),
(
'0001-01-01'
),
(
'1001-00-00'
),
(
'1001-01-01'
),
(
'1002-00-00'
),
(
'2001-01-01'
);
--
source
include
/
partition_date_range
.
inc
--
echo
# test without index
ALTER
TABLE
t1
DROP
KEY
a
;
--
source
include
/
partition_date_range
.
inc
DROP
TABLE
t1
;
#
# Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
...
...
sql/item_timefunc.cc
View file @
ec7c4fb4
...
...
@@ -944,8 +944,29 @@ longlong Item_func_to_days::val_int()
longlong
Item_func_to_seconds
::
val_int_endpoint
(
bool
left_endp
,
bool
*
incl_endp
)
{
longlong
res
=
val_int
();
return
null_value
?
LONGLONG_MIN
:
res
;
DBUG_ASSERT
(
fixed
==
1
);
MYSQL_TIME
ltime
;
longlong
seconds
;
longlong
days
;
int
dummy
;
/* unused */
if
(
get_arg0_date
(
&
ltime
,
TIME_FUZZY_DATE
))
{
/* got NULL, leave the incl_endp intact */
return
LONGLONG_MIN
;
}
seconds
=
ltime
.
hour
*
3600L
+
ltime
.
minute
*
60
+
ltime
.
second
;
seconds
=
ltime
.
neg
?
-
seconds
:
seconds
;
days
=
(
longlong
)
calc_daynr
(
ltime
.
year
,
ltime
.
month
,
ltime
.
day
);
seconds
+=
days
*
24L
*
3600L
;
/* Set to NULL if invalid date, but keep the value */
null_value
=
check_date
(
&
ltime
,
(
ltime
.
year
||
ltime
.
month
||
ltime
.
day
),
(
TIME_NO_ZERO_IN_DATE
|
TIME_NO_ZERO_DATE
),
&
dummy
);
/*
Even if the evaluation return NULL, seconds is useful for pruning
*/
return
seconds
;
}
longlong
Item_func_to_seconds
::
val_int
()
...
...
@@ -956,10 +977,10 @@ longlong Item_func_to_seconds::val_int()
longlong
days
;
if
(
get_arg0_date
(
&
ltime
,
TIME_NO_ZERO_DATE
))
return
0
;
seconds
=
ltime
.
hour
*
3600L
+
ltime
.
minute
*
60
+
ltime
.
second
;
seconds
=
ltime
.
hour
*
3600L
+
ltime
.
minute
*
60
+
ltime
.
second
;
seconds
=
ltime
.
neg
?
-
seconds
:
seconds
;
days
=
(
longlong
)
calc_daynr
(
ltime
.
year
,
ltime
.
month
,
ltime
.
day
);
return
(
seconds
+
days
*
(
24L
*
3600L
))
;
days
=
(
longlong
)
calc_daynr
(
ltime
.
year
,
ltime
.
month
,
ltime
.
day
);
return
seconds
+
days
*
24L
*
3600L
;
}
/*
...
...
@@ -992,10 +1013,9 @@ enum_monotonicity_info Item_func_to_seconds::get_monotonicity_info() const
{
if
(
args
[
0
]
->
type
()
==
Item
::
FIELD_ITEM
)
{
if
(
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_DATE
)
return
MONOTONIC_STRICT_INCREASING
;
if
(
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_DATETIME
)
return
MONOTONIC_INCREASING
;
if
(
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_DATE
||
args
[
0
]
->
field_type
()
==
MYSQL_TYPE_DATETIME
)
return
MONOTONIC_STRICT_INCREASING_NOT_NULL
;
}
return
NON_MONOTONIC
;
}
...
...
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