[Maria-developers] Weekly Report

2019-08-18 Thread Rucha Deodhar
Report for week 12:

Hi!

This week I merged some test cases in respective files into one so that the
tests can be under 80 lines and also improved the documentation.
Documentation for INSERT...RETURNING:
https://docs.google.com/document/d/1EknNlh-J72cUlCg9rvcujUeZdzu5uzm0hmHG3qgbrnI/edit?usp=sharing
REPLACE...RETURNING:
https://docs.google.com/document/d/1UMy5fi-j6yIObYIRwTteaJKHU5F-wPoEAVgVbeuo6pE/edit?usp=sharing

I also fixed feature_insert_returning system variable by adding some code
and improving the test file. The test is passing.

insert_returning_datatypes.result and replace_returning_datatypes.result
files were showing binary data. To fix it, it was suggested to create a
.reject and .result files, hexdump of the files, diff and giving a
printable ASCII character as the input in BIT field because BIT is printed
as VARCHAR.

One thing I noticed was, after fixing the files they were still showing as
binary files, which was probably because of the diffs. So I removed the
existing files from my repo and pushed new files then cleaned up the
commits again and fixed the 80 character per line rule for new tests. My
github repo is up to date with latest changes.

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-08-11 Thread Rucha Deodhar
Report for week 11:

Hello!

This week I worked on cleaning up the code, commits and test cases.
I was a little less familiar with git rebase -i so tried a couple of things
on a dummy repo first and then cleaned up the commits on my repo. I also
worked on the coding style review and removed all the trailing white spaces
and tabs mentioned in the review. To remove the last argument of
mysql_prepare_insert() I tried a couple of things like not calling
setup_fields() and setup_wild() separately for INSERT...SELECT...RETURNING
and calling std::swap if select_insert is true. Like so
if(!lex->returning_list.is_empty())
{
  if (select_insert)
//std::swap()
  setup_fields() and setup_wild()
  if (selec_insert)
//std::swap()
}
and also changing where the above functions are called. But that didn't
work. So now calling it separately for INSERT..SELECT..RETURNING and other
variants. I added separate function to sql_base.cc and sql_base.h which
calls setup_fields() and setup_wild() so that not only the last argument
can be removed but also lines of code can be reduced. All the occurrences
of

(wild_num && setup_wild(thd, table_list, field_list, NULL, wild_num,
  _lex->hidden_bit_fields)) ||
  setup_fields(thd, Ref_ptr_array(),
   field_list, MARK_COLUMNS_READ, NULL, NULL, 0)

can be replaced with setup_returning_fields(). (Since this is used in
insert..returning, insert..select..returning, delete...returning and
update...returning too).

On some lines of the test cases, the characters were coming to more than 80
characters. So fixed that and added some more test cases
(INSERT...IGNORE..RETURNING and fields with auto_increment). Finally I
merged all the commits made this week into one commit. My github repo is up
to date with the latest changes.
Here is the link for the same:
https://github.com/rucha174/server/commit/0d7eb4198cc0aadba42acb4960c17570270423f5

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-08-04 Thread Rucha Deodhar
Report for week 10:

Hello!

Report for Week 10:

Hello!

This week I worked on adding system variable feature_insert_returning which
is useful for feedback plugin. This variable increments each time
INSERT...RETURNING or REPLACE...RETURNING is used. Before beginning, I did
some reading about feedback plugin and referred feature_subquery for adding
feature_insert_returning. Initially I was facing difficulty in finding the
test file that was to be updated. I was searching for test file in sys_vars
test suite. Zulip conversation helped me find the right test file and also
a missed step for publishing variable for SHOW STATUS. I have made
necessary changes in the code and have updated the test and result file.

I also found out that the current implementation was not showing the
expected output when AUTO_INCREMENT is used and the fields are not given
explicitly. On using RETURNING it was showing the value of all the rows in
auto_increment field as 0. Fixed that by calling send_data() after
write_record(). This also fixed another thing. The previous implementation,
for INSERT ... ON DUPLICATE KEY UPDATE...RETURNING was not showing the
updated value in the result set.
Example: If the table t1 has 1 row: id1=1 and val1='A'.
The below statement
INSERT INTO t1(id1,val1) VALUES(1,'B') ON DUPLICATE KEY UPDATE val1='C'
returning *;
was showing id1=1 and val='B' for the result even if it inserts val1='C'.
Now it is fixed and is returning val1='C'.
I have updated the result file for insert_returning.

I also fixed line endings for tests and added more comments to make our
implementation more understandable. I github repo is up to date with the
latest changes.

Regards,
Rucha Deodhar.
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-07-28 Thread Rucha Deodhar
Report for week 9:

Hello!

This week I worked on documentation, added some comments to the code and
removed some lines of code from parser as it was still making use of
SELECT_LEX::item_list after opt_select_expressions.

I was referring DELETE...RETURNING test case and noticed case for using
stored functions was missing. I added that to INSERT...RETURNING and
REPLACE...RETURNING.

Also checked if the implementation supports other functions like string
functions, date-time functions, control flow functions, numeric function
and secondary functions(Since the aggregate functions cannot be used, I
wanted to check if these functions can be used)

I have made related changes in the documentation and my github repo is up
to date with latest changes.

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-07-21 Thread Rucha Deodhar
Report for week 8:

Hello!

This week I worked on the parser. I removed the hack "swapping lists" we
had used earlier. Now the grammar uses values from the bison stack.
However, I was making the list rule return the SELECT_LEX :: item_list.
This was fixed after the intermediate review.

I changed the grammar for INSERT...RETURNING and REPLACE...RETURNING, added
test and result files for REPLACE...RETURNING and modified the comments of
one test file.

I also worked on the intermediate review. Now the parser code doesn't rely
on SELECT_LEX :: item_list. In REPLACE...RETURNING a list was declared
inside the scope of "if" and using it outside the scope was illegal. So I
moved it to the scope outside of if and made the grammar return:
 if select_lex::item_list is not empty else NULL.

My github repo is up to date with latest changes.

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-07-14 Thread Rucha Deodhar
Report for week 7:

Hello!

This week I worked on the initial review for INSERT...RETURNING.  I removed
some lines from my code, used select_result* instead of using
with_returning_list, improved formatting, restored the structure of
SQL_I_List by removing *saved_first, moved returning_list to LEX so that
current_select and lex->first_select_lex() is not used, fixed the logic of
my_ok() and send_eof(), and made some part more readable. Now
INSERT...IGNORE is working too. For tests, I merged some test cases,
removed the other ones and added some cases for existing tests.

I also read about bison and how to use its stack to return items so that it
can be used instead of list swapping.
As suggested, I am making the list rule return the List as a return
value, then the rule that uses select_item_list uses something like this:
 lex->returning=$n

I have started implementing it but getting errors during build. Initially I
was getting error: opt_select_expressions has no declared type
when I tried making the entire rule return item_list.
To fix that I added opt_select_expressions to %type 
I am still trying to fix other errors.

Could you give me feedback whether I am moving along the right path, have I
missed something?

opt_select_expressions:
   /*empty*/ {$$=NULL}
  | RETURNING select_item_list
{  //Make this entire rule return item_list
 something like:
 $$=lex->current_select->item_list
 }
 ;

Insert parser:
insert_field_spec opt_insert_update opt_select_expressions
  {
 something like
  if ($3)
  Lex->returning_list= $3;

  Lex->pop_select(); //main select
  if (Lex->check_main_unit_semantics())
   MYSQL_YYABORT;
  }
   ;

Regards,
Rucha Deodhar


I’m
protected online with Avast Free Antivirus. Get it here — it’s free forever.

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-07-07 Thread Rucha Deodhar
Report for week 6:

Hello!

This week I was able to make replace...returning work. But before pushing
changes for insert...select...returning, I had done a git merge because I
didn't know  I was supposed to do a git rebase. While undoing the merge I
ran into a problem. With help from mentors I was able to fix the problem.
I had to make some commits again. It took me two days to fix the issue and
make commits and then I was on track again.
I also made a GDoc about using insert...returning in subqueries.
I have received feedback about my code and I have started working on fixing
it.

Regards,
Rucha Deodhar


I’m
protected online with Avast Free Antivirus. Get it here — it’s free forever.

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-06-30 Thread Rucha Deodhar
Report for week 5:

Hello!

This week I was able to make INSERT...SELECT...RETURNING return the listed
fields from the INSERT table. From the parsing stage in sql_parse.cc, the
context and the first table gets masked , so I stored the previous values
in another variable just before they are masked and swapped it before and
after calling setup_fields() and setup_wild in select_insert :: prepare().
This makes the items and expressions in returning_list point to insert
table before the above functions are called, and then swapping it back for
the rest of the prepare() function. Here is the link to test cases and code:
Test and result:
https://github.com/MariaDB/server/commit/0792ba33a1b50e7beab3b7e05d36df29e7869fd1
Code:
https://github.com/MariaDB/server/commit/4d1d37f2bdca398ff3ace804cfb3b5a940168422

I also tested my code for some complex queries like subquery in RETURNING
and checked if it outputs error message when invalid expressions are used.
It was working correctly. Here is the link for the same:
Error message:
https://github.com/MariaDB/server/commit/9ffe813eb82dc0125def187e07dbd5168b46cf95
Subqueries:
https://github.com/MariaDB/server/commit/2363cb3993d86685ff1402cfa7ee050dd74cb7ba

I was also thinking about other ways to get the items and expressions in
returning_list, this is one of the ways in which it could be implemented.
Here is
the link to GDoc:
https://docs.google.com/document/d/1TZdlL_V9MEbPTuXNwpzR0t9ciNeV25AeUIvSRXHXXo8/edit?usp=sharing

I understand this is too big a change for the grammar and I am trying to
find alternate solution.
I also changed the variable names and made them more descriptive.

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-06-23 Thread Rucha Deodhar
Report for week 4:

Hello!

This week I was able to make INSERT...RETURNING work. It is working fine
for simple insert statement, inserting multiple rows in single statement,
INSERT...SET and INSERT...ON DUPLICATE KEY UPDATE. It is returning the
listed fields, working for alias and operators as well. I was getting
segmentation fault when I was working on this. Zulip messages helped to
solve that problem by cleaning returning_list by calling
returning_list.empty() in mysql_init_select(). I also realised I hadn't
called setup_fields(), setup_wild() and checking if there is '*' for
returning_list in mysql_prepare_insert() which was also causing this error.
Here is a link to the test cases and results for above variants of
INSERT...RETURNING:
https://github.com/rucha174/server/commit/66f8046d615f97a1078c8eedc3cf11d6e3d73344

As for INSERT...SELECT...RETURNING, I passed lex->field_list instead of
returning_list as an argument in prepare(), send_result_set_metadata() and
send_data(). It was returning all the fields from the insert table. Then I
passed
returning_list as the argument and it is returning the listed fields but
from the
select table. So now I am working on it by looking how select_insert class
uses lex->field_list and do the same for returning_list.
Here is the link to code which returns the listed fields for select table:
https://github.com/rucha174/server/commit/6b18dd3cfc76d41871357c5b2006e04d1d508c1d

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-06-16 Thread Rucha Deodhar
Report for week 3:

Hello!

This week was more productive than the last one. Zulip messages helped to
extend parser for INSERT...SELECT...RETURNING. I created SELECT_LEX ::
returning_list and swapped it with SELECT_LEX :: item_list. I have also
added test cases and result for the same. Feedback of GDoc and zulip
messages helped in understanding the code better. I have started
implementing INSERT...RETURNING. I am able to check whether there is result
set in the query. But during result->send_result_set_metadata() server
crashes and I get segmentation fault. I am trying to fix it.
Here is the link to my last commit of code and test cases
code:
https://github.com/MariaDB/server/commit/d06f21b84cc65424a795c21cc3fee5546eec0a54

Test case:
https://github.com/MariaDB/server/commit/280a885f1563594678141a360305a253b48f72d8
Result:
https://github.com/MariaDB/server/commit/218d81b86d941a874cfac9123d7aeb141e01f110

Regards,
Rucha Deodhar
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-06-09 Thread Rucha Deodhar
Report for week 2:

Hello!

This week I ran the test case for parser written in last week and made
changes in the parser according to the suggestions given, tried making
insert...select..returning work.
I analysed how RETURNING in delete is implemented, how insert is
implemented, and how the data can be sent, which functions are responsible
and what those functions do, to carry out various steps and what these
steps are in order to send the data to the client.
I came up with a plan where code for RETURNING should go and files where
the code has to be written.
There were few things which weren't very clear initially. So I referred to
some documents on the internet and some source code document.
My github repo is up to date with the changes in the code, result and test
files.

Regards,
Rucha
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Maria-developers] Weekly Report

2019-06-03 Thread Sergei Golubchik
Hi, Rucha!

On Jun 03, Rucha Deodhar wrote:
> Report for week 1:
> 
> Hello!
> 
> I made test cases and extended the parser for:
> INSERT...RETURNING * and
> INSERT...RETURNING 
> It is working fine for INSERT...ON DUPLICATE KEY UPDATE, INSERT...IGNORE,
> INSERT...SET, and simple insert statements.
> As I have never coded parser before, it was throwing errors during build
> and was also crashing the server sometimes. I managed to fix the errors
> eventually.
> Initially, I tried to extend  in RETURNING by referring how
> column names are parsed in INSERT statement, like using opt_fields
> production for insert_field_list, modified it a little and tried to see it
> if that would work. But it didn't. So I referred to DELETE...RETURNING as
> it was suggested earlier.
> I am still trying to extend it for INSERT...SELECT. It is not showing
> syntax error but shows error "column count doesn't match value count at row
> 1." I will add the test cases for this once it is working.

Sounds good!

If you'll get stuck, I suggest to push what you have. Then we could take
a look and offer some help you if needed.

Regards,
Sergei
Chief Architect MariaDB
and secur...@mariadb.org

___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp


[Maria-developers] Weekly Report

2019-06-02 Thread Rucha Deodhar
Report for week 1:

Hello!

I made test cases and extended the parser for:
INSERT...RETURNING * and
INSERT...RETURNING 
It is working fine for INSERT...ON DUPLICATE KEY UPDATE, INSERT...IGNORE,
INSERT...SET, and simple insert statements.
As I have never coded parser before, it was throwing errors during build
and was also crashing the server sometimes. I managed to fix the errors
eventually.
Initially, I tried to extend  in RETURNING by referring how
column names are parsed in INSERT statement, like using opt_fields
production for insert_field_list, modified it a little and tried to see it
if that would work. But it didn't. So I referred to DELETE...RETURNING as
it was suggested earlier.
I am still trying to extend it for INSERT...SELECT. It is not showing
syntax error but shows error "column count doesn't match value count at row
1." I will add the test cases for this once it is working.

Regards,
Rucha
___
Mailing list: https://launchpad.net/~maria-developers
Post to : maria-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~maria-developers
More help   : https://help.launchpad.net/ListHelp