Merged PRs
dolt
- 7327: fix tests from string to bool conversion change
A GMS PR changed the conversion of boolean values to string fromtrue = 'true'
andfalse = 'false'
totrue = '1'
andfalse = '0'
. - 7312: /.github/{scripts,workflows}: working through some pr regressions labeling
- 7311: go/store/nbs: Flush a journal writer to fsync and write index records when it builds up substantial unflushed data, even if there is no commit yet.
- 7285: Bug fix: keyless table constraint violations
Keyless tables didn't expose a unique row identifier in thedolt_constraint_violations_<table>
system tables. This manifested as a panic when trying to delete the violation artifacts from the system table, but it also meant that we couldn't uniquely identify rows in the system table by the system table's PK for keyless tables. To enable keyless tables to use constraint violation artifacts, we now return the row's identifying hash from the source keyless table in the system table. Note that thedolt_conflicts_<table>
system table did not have a similar issue because its primary key is a unique ID generated in thedolt_conflict_id
field.
Related to: #7275
go-mysql-server
- 2263: Insert VALUES statements with subqueries index correctly
fixes: #7322
A couple things I noticed in the process of debugging this:- We appear to inline inject an empty row when evaluating VALUES statements. Code comments suggest TRIGGERS are the reason for this. Most of the time this doesn't impact other value statements, and I think we've adapted VALUE expressions to use this pattern, but it shifts subquery expression indexes in a way that we were not accounting for. The change here updates subqueries in INSERT VALUES to expect this offset.
- We can't fix this during expression indexing at the INSERT level, because a second analysis of VALUES statements is necessary, for unclear reasons.
- We differentiate between INSERT VALUES and INSERT SELECTs, because INSERT SELECTs do not inject an offset row. In theory we could probably normalize these two cases and inject an empty row into insert select sources, but I ran into problems trying to implement the fix this way.
- 2262: implement
elt()
andfield()
function
This PR implements theELT()
function, which just returns the nth argument as a string.
This PR also implements theFIELD()
function, which returns the first case-insensitive match to the first argument.
MySQL Docs: - 2261: implement
exp()
function
This PR adds support for theEXP()
function in MySQL.
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_exp - 2260: implementing
bit_count()
function
This PR implements theBIT_COUNT()
function, which counts the number of 1s in the binary representation of the integer argument.
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html#function_bit-count - 2259: implement
atan2()
function and support second argument foratan
This PR adds support forATAN()
andATAN2()
, which just computes atan
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_atan2 - 2257: preserve original col name for subqueries
There are likely other places where we don't copy overoriginalCol
name when creating scope columns, but I can't tell which should be left as empty and which should be filled out.
fixes #7316 - 2256: implementing
ORD()
function
This PR adds support for theORD()
function in MySQL, which converts a unicode character into its numerical representation.
In the case ofSTRINGS
, only the leftmost unicode character is evaluated.
Additionally, this PR fixes the bool -> string coversion to match MySQL.
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_ord
Also fixes: #7323 - 2254: implementing
pi()
function
Implements the PI() function, which just returns the value of PI
MySQL docs: https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_pi - 2253: implement
SPACE()
function
This function outputs a string containing the number of space characters specified by its argument.
MySQL Docs: https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_space - 2251: fix order by optimization
This hopefully fixes 24 sqllogictests.
We introduced an optimization where we would dropSort
nodes for queries that includedORDER BY
s if there wereIndexLookup
s that were a matching prefix over the sortfields. The idea was that since indexes are already in order there was no need to sort.
However, there is a case when that isn't necessarily true. If the index is created from a filter over multiple columns, specifically when that filter contains anOR
expression, it is possible to iterate over columns in a non-sorted order. During analysis, the filters are converted into several non-overlapping ranges; it is possible for a range expression in the range to overlap with another range's range expression, but for the two ranges to not overlap. It's clearer to look at the test.
We didn't catch this bug earlier, as it only affects queries in dolt. We iterate over rows in the in-memory tables in such a way that the rows will still appear in order. - 2250: Add support for
SUBDATE()
Implements theSUBDATE()
built-in function and cleans up a few other spots.
Related to: #7277
Closed Issues
- 7323: Unexpected results when comparing with empty string
- 7322: Subquery in an INSERT statement return NULL
- 7316: Subqueries lowercase the column names
Latency
Read Tests | MySQL | Dolt | Multiple |
---|---|---|---|
covering_index_scan | 2.14 | 2.81 | 1.3 |
groupby_scan | 13.22 | 17.63 | 1.3 |
index_join | 1.34 | 5.0 | 3.7 |
index_join_scan | 1.27 | 2.07 | 1.6 |
index_scan | 34.33 | 63.32 | 1.8 |
oltp_point_select | 0.17 | 0.46 | 2.7 |
oltp_read_only | 3.3 | 7.98 | 2.4 |
select_random_points | 0.32 | 0.74 | 2.3 |
select_random_ranges | 0.38 | 0.9 | 2.4 |
table_scan | 34.33 | 63.32 | 1.8 |
types_table_scan | 74.46 | 173.58 | 2.3 |
reads_mean_multiplier | 2.1 |
Write Tests | MySQL | Dolt | Multiple |
---|---|---|---|
oltp_delete_insert | 5.77 | 5.88 | 1.0 |
oltp_insert | 2.71 | 2.97 | 1.1 |
oltp_read_write | 7.3 | 15.0 | 2.1 |
oltp_update_index | 2.76 | 3.02 | 1.1 |
oltp_update_non_index | 2.86 | 3.02 | 1.1 |
oltp_write_only | 4.03 | 7.43 | 1.8 |
types_delete_insert | 5.77 | 6.55 | 1.1 |
writes_mean_multiplier | 1.3 |
Overall Mean Multiple | 1.7 |
---|