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
cd29aee5
Commit
cd29aee5
authored
Nov 16, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc cleanup
parent
1823ce73
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
25 deletions
+19
-25
sql/filesort.cc
sql/filesort.cc
+13
-19
sql/item_subselect.cc
sql/item_subselect.cc
+2
-2
sql/sql_select.cc
sql/sql_select.cc
+4
-3
sql/sql_sort.h
sql/sql_sort.h
+0
-1
No files found.
sql/filesort.cc
View file @
cd29aee5
...
...
@@ -60,9 +60,7 @@ static bool save_index(Sort_param *param, uint count,
static
uint
suffix_length
(
ulong
string_length
);
static
uint
sortlength
(
THD
*
thd
,
SORT_FIELD
*
sortorder
,
uint
s_length
,
bool
*
multi_byte_charset
);
static
SORT_ADDON_FIELD
*
get_addon_fields
(
ulong
max_length_for_sort_data
,
Field
**
ptabfield
,
uint
sortlength
,
static
SORT_ADDON_FIELD
*
get_addon_fields
(
TABLE
*
table
,
uint
sortlength
,
LEX_STRING
*
addon_buf
);
static
void
unpack_addon_fields
(
struct
st_sort_addon_field
*
addon_field
,
uchar
*
buff
,
uchar
*
buff_end
);
...
...
@@ -71,7 +69,6 @@ static bool check_if_pq_applicable(Sort_param *param, SORT_INFO *info,
ha_rows
records
,
size_t
memory_available
);
void
Sort_param
::
init_for_filesort
(
uint
sortlen
,
TABLE
*
table
,
ulong
max_length_for_sort_data
,
ha_rows
maxrows
,
bool
sort_positions
)
{
DBUG_ASSERT
(
addon_field
==
0
&&
addon_buf
.
length
==
0
);
...
...
@@ -85,8 +82,7 @@ void Sort_param::init_for_filesort(uint sortlen, TABLE *table,
Get the descriptors of all fields whose values are appended
to sorted fields and get its total length in addon_buf.length
*/
addon_field
=
get_addon_fields
(
max_length_for_sort_data
,
table
->
field
,
sort_length
,
&
addon_buf
);
addon_field
=
get_addon_fields
(
table
,
sort_length
,
&
addon_buf
);
}
if
(
addon_field
)
{
...
...
@@ -190,9 +186,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
param
.
init_for_filesort
(
sortlength
(
thd
,
filesort
->
sortorder
,
s_length
,
&
multi_byte_charset
),
table
,
thd
->
variables
.
max_length_for_sort_data
,
max_rows
,
filesort
->
sort_positions
);
table
,
max_rows
,
filesort
->
sort_positions
);
sort
->
addon_buf
=
param
.
addon_buf
;
sort
->
addon_field
=
param
.
addon_field
;
...
...
@@ -1992,8 +1986,7 @@ sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
*/
static
SORT_ADDON_FIELD
*
get_addon_fields
(
ulong
max_length_for_sort_data
,
Field
**
ptabfield
,
uint
sortlength
,
LEX_STRING
*
addon_buf
)
get_addon_fields
(
TABLE
*
table
,
uint
sortlength
,
LEX_STRING
*
addon_buf
)
{
Field
**
pfield
;
Field
*
field
;
...
...
@@ -2001,7 +1994,8 @@ get_addon_fields(ulong max_length_for_sort_data,
uint
length
=
0
;
uint
fields
=
0
;
uint
null_fields
=
0
;
MY_BITMAP
*
read_set
=
(
*
ptabfield
)
->
table
->
read_set
;
MY_BITMAP
*
read_set
=
table
->
read_set
;
ulong
max_sort_len
=
table
->
in_use
->
variables
.
max_length_for_sort_data
;
DBUG_ENTER
(
"get_addon_fields"
);
/*
...
...
@@ -2017,7 +2011,7 @@ get_addon_fields(ulong max_length_for_sort_data,
addon_buf
->
str
=
0
;
addon_buf
->
length
=
0
;
for
(
pfield
=
ptab
field
;
(
field
=
*
pfield
)
;
pfield
++
)
for
(
pfield
=
table
->
field
;
(
field
=
*
pfield
)
;
pfield
++
)
{
if
(
!
bitmap_is_set
(
read_set
,
field
->
field_index
))
continue
;
...
...
@@ -2032,7 +2026,7 @@ get_addon_fields(ulong max_length_for_sort_data,
DBUG_RETURN
(
0
);
length
+=
(
null_fields
+
7
)
/
8
;
if
(
length
+
sortlength
>
max_
length_for_sort_data
||
if
(
length
+
sortlength
>
max_
sort_len
||
!
my_multi_malloc
(
MYF
(
MY_WME
|
MY_THREAD_SPECIFIC
),
&
addonf
,
sizeof
(
SORT_ADDON_FIELD
)
*
(
fields
+
1
),
&
addon_buf
->
str
,
length
,
...
...
@@ -2043,7 +2037,7 @@ get_addon_fields(ulong max_length_for_sort_data,
addon_buf
->
length
=
length
;
length
=
(
null_fields
+
7
)
/
8
;
null_fields
=
0
;
for
(
pfield
=
ptab
field
;
(
field
=
*
pfield
)
;
pfield
++
)
for
(
pfield
=
table
->
field
;
(
field
=
*
pfield
)
;
pfield
++
)
{
if
(
!
bitmap_is_set
(
read_set
,
field
->
field_index
))
continue
;
...
...
sql/item_subselect.cc
View file @
cd29aee5
...
...
@@ -5795,7 +5795,7 @@ int
Ordered_key
::
cmp_keys_by_row_data
(
ha_rows
a
,
ha_rows
b
)
{
uchar
*
rowid_a
,
*
rowid_b
;
int
__attribute__
((
unused
))
error
;
int
error
;
int
cmp_res
;
/* The length in bytes of the rowids (positions) of tmp_table. */
uint
rowid_length
=
tbl
->
file
->
ref_length
;
...
...
@@ -5892,7 +5892,7 @@ int Ordered_key::cmp_key_with_search_key(rownum_t row_num)
/* The length in bytes of the rowids (positions) of tmp_table. */
uint
rowid_length
=
tbl
->
file
->
ref_length
;
uchar
*
cur_rowid
=
row_num_to_rowid
+
row_num
*
rowid_length
;
int
__attribute__
((
unused
))
error
;
int
error
;
int
cmp_res
;
if
(
unlikely
((
error
=
tbl
->
file
->
ha_rnd_pos
(
tbl
->
record
[
0
],
cur_rowid
))))
...
...
sql/sql_select.cc
View file @
cd29aee5
...
...
@@ -2501,7 +2501,7 @@ int JOIN::optimize_stage2()
{
JOIN_TAB
*
tab
=
&
join_tab
[
const_tables
];
if
(
order
)
if
(
order
&&
!
need_tmp
)
{
/*
Force using of tmp table if sorting by a SP or UDF function due to
...
...
@@ -3206,7 +3206,7 @@ bool JOIN::make_aggr_tables_info()
or end_write_group()) if JOIN::group is set to false.
*/
// the temporary table was explicitly requested
DBUG_ASSERT
(
MY_TEST
(
select_options
&
OPTION_BUFFER_RESULT
)
);
DBUG_ASSERT
(
select_options
&
OPTION_BUFFER_RESULT
);
// the temporary table does not have a grouping expression
DBUG_ASSERT
(
!
curr_tab
->
table
->
group
);
}
...
...
@@ -13191,7 +13191,8 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
tab
++
)
tab
->
cached_eq_ref_table
=
FALSE
;
*
simple_order
=
*
join
->
join_tab
[
join
->
const_tables
].
on_expr_ref
?
0
:
1
;
JOIN_TAB
*
head
=
join
->
join_tab
+
join
->
const_tables
;
*
simple_order
=
head
->
on_expr_ref
[
0
]
==
NULL
;
}
else
{
...
...
sql/sql_sort.h
View file @
cd29aee5
...
...
@@ -92,7 +92,6 @@ class Sort_param {
memset
(
this
,
0
,
sizeof
(
*
this
));
}
void
init_for_filesort
(
uint
sortlen
,
TABLE
*
table
,
ulong
max_length_for_sort_data
,
ha_rows
maxrows
,
bool
sort_positions
);
};
...
...
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