List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:May 22 2007 4:58pm
Subject:bk commit into 6.0-falcon tree (jas:1.2531)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-falcon repository of . When  does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-05-22 12:57:49-04:00, jas@rowvwade. +6 -0
  Added minimal support for SQL derived tables in the native
  Falcon engine.  At the moment, support is limited to
  
      select count(*) from (select ...)
  
  to support computation of index selectivity.

  storage/falcon/CMakeLists.txt@stripped, 2007-05-22 12:57:40-04:00, jas@rowvwade. +2 -0
    Added new class FsbDerivedTable.

  storage/falcon/Engine.vcproj@stripped, 2007-05-22 12:57:40-04:00, jas@rowvwade. +8 -2
    Added new class FsbDerivedTable.

  storage/falcon/Makefile.am@stripped, 2007-05-22 12:57:41-04:00, jas@rowvwade. +22 -5
    Added new class FsbDerivedTable.

  storage/falcon/NSelect.cpp@stripped, 2007-05-22 12:57:41-04:00, jas@rowvwade. +32 -15
    Added minimal support for SQL derived tables in the native
    Falcon engine.  At the moment, support is limited to
    
        select count(*) from (select ...)
    
    to support computation of index selectivity.

  storage/falcon/NSelect.h@stripped, 2007-05-22 12:57:41-04:00, jas@rowvwade. +1 -0
    Added minimal support for SQL derived tables in the native
    Falcon engine.  At the moment, support is limited to
    
        select count(*) from (select ...)
    
    to support computation of index selectivity.

  storage/falcon/SQLParse.cpp@stripped, 2007-05-22 12:57:42-04:00, jas@rowvwade. +80 -59
    Added minimal support for SQL derived tables in the native
    Falcon engine.  At the moment, support is limited to
    
        select count(*) from (select ...)
    
    to support computation of index selectivity.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jas
# Host:	rowvwade.
# Root:	D:/MySQL/mysql-5.1-falcon

--- 1.11/storage/falcon/Engine.vcproj	2007-05-22 12:58:10 -04:00
+++ 1.12/storage/falcon/Engine.vcproj	2007-05-22 12:58:10 -04:00
@@ -6628,10 +6628,10 @@
 				RelativePath="..\..\..\netfrastructure\Word\MetaProperties.h">
 			</File>
 			<File
-				RelativePath="Word\MSWord.h">
+				RelativePath="..\..\..\netfrastructure\Word\MSWord.h">
 			</File>
 			<File
-				RelativePath="..\..\..\netfrastructure\Word\MSWord.h">
+				RelativePath="Word\MSWord.h">
 			</File>
 			<File
 				RelativePath="..\..\..\netfrastructure\Word\WordBinTable.cpp">
@@ -9130,6 +9130,12 @@
 		</File>
 		<File
 			RelativePath=".\DatabaseCopy.h">
+		</File>
+		<File
+			RelativePath=".\FsbDerivedTable.cpp">
+		</File>
+		<File
+			RelativePath=".\FsbDerivedTable.h">
 		</File>
 		<File
 			RelativePath=".\LogLock.cpp">

--- 1.46/storage/falcon/CMakeLists.txt	2007-05-22 12:58:10 -04:00
+++ 1.47/storage/falcon/CMakeLists.txt	2007-05-22 12:58:10 -04:00
@@ -82,6 +82,7 @@
 		ForeignKey.cpp 
 		Format.cpp
 		Fsb.cpp 
+		FsbDerivedTable.cpp 
 		FsbExhaustive.cpp 
 		FsbGroup.cpp 
 		FsbInversion.cpp
@@ -334,6 +335,7 @@
 		ForeignKey.h 
 		Format.h
 		Fsb.h 
+		FsbDerivedTable.h 
 		FsbExhaustive.h 
 		FsbGroup.h 
 		FsbInversion.h

--- 1.52/storage/falcon/Makefile.am	2007-05-22 12:58:10 -04:00
+++ 1.53/storage/falcon/Makefile.am	2007-05-22 12:58:10 -04:00
@@ -50,8 +50,17 @@
 		EncodedRecord.h Engine.h Error.h Event.h \
 		Field.h FilterDifferences.h Filter.h FilterSet.h \
 		FilterSetManager.h FilterTree.h ForeignKey.h Format.h \
-		FsbExhaustive.h FsbGroup.h Fsb.h FsbInversion.h FsbJoin.h \
-		FsbOuterJoin.h FsbSieve.h FsbSort.h FsbUnion.h GenOption.h \
+		FsbExhaustive.h \
+		FsbGroup.h \
+		Fsb.h \
+		FsbDerivedTable.h \
+		FsbInversion.h \
+		FsbJoin.h \
+		FsbOuterJoin.h \
+		FsbSieve.h \
+		FsbSort.h \
+		FsbUnion.h \
+		GenOption.h \
 		ha_falcon.h Hdr.h HdrState.h Image.h ImageManager.h \
 		Images.h Index.h IndexKey.h \
 		IndexNode.h \
@@ -176,9 +185,17 @@
 		EncodedRecord.cpp Error.cpp Event.cpp \
 		Field.cpp Filter.cpp FilterDifferences.cpp FilterSet.cpp \
 		FilterSetManager.cpp FilterTree.cpp ForeignKey.cpp Format.cpp \
-		Fsb.cpp FsbExhaustive.cpp FsbGroup.cpp FsbInversion.cpp \
-		FsbJoin.cpp FsbOuterJoin.cpp FsbSieve.cpp FsbSort.cpp \
-		FsbUnion.cpp ha_falcon.cpp Hdr.cpp Image.cpp \
+		Fsb.cpp \
+		FsbDerivedTable.cpp \
+		FsbExhaustive.cpp \
+		FsbGroup.cpp \
+		FsbInversion.cpp \
+		FsbJoin.cpp \
+		FsbOuterJoin.cpp \
+		FsbSieve.cpp \
+		FsbSort.cpp \
+		FsbUnion.cpp \
+		ha_falcon.cpp Hdr.cpp Image.cpp \
 		ImageManager.cpp Images.cpp Index.cpp IndexKey.cpp \
 		IndexNode.cpp \
 		Index2Node.cpp \

--- 1.8/storage/falcon/NSelect.cpp	2007-05-22 12:58:10 -04:00
+++ 1.9/storage/falcon/NSelect.cpp	2007-05-22 12:58:10 -04:00
@@ -33,6 +33,7 @@
 #include "FsbSort.h"
 #include "FsbUnion.h"
 #include "FsbGroup.h"
+#include "FsbDerivedTable.h"
 #include "ResultSet.h"
 #include "Statement.h"
 #include "Privilege.h"
@@ -69,6 +70,7 @@
 	Syntax *sort = NULL;
 	Syntax *branch = NULL;
 	columnNames = NULL;
+	select = NULL;
 
 	if (syntax->type == nod_select)
 		{
@@ -117,32 +119,43 @@
 	env.sourceContexts = &sourceContexts;
 	env.tables = &tables;
 	env.conjuncts = &conjuncts;
-	numberColumns += compileJoin (tableList, true, &env);
+	
+	if (tableList->type == nod_select)
+		{
+		select = new NSelect(statement, tableList, NULL);
+		numberColumns += select->numberColumns;
+		}
+	else
+		numberColumns += compileJoin(tableList, true, &env);
 
 	// If there isn't an item list, generate a value list
 
 	if (items)
 		{
 		numberColumns = items->count;
-		values = statement->compile (items);
+		values = statement->compile(items);
 		}
 	else
 		{
-		values = new NNode (statement, List, numberColumns);
+		values = new NNode(statement, List, numberColumns);
 		int n = 0;
 		
-		FOR_OBJECTS (Context*, context, &sourceContexts)
-			View *view = context->table->view;
-			
-			if (view)
-				for (int id = 0; id < view->numberColumns; ++id)
-					values->setChild (n++, view->columns->children[id]->copy (statement, context));
-			else
-				FOR_FIELDS (field, context->table)
-					values->setChild (n++, new NField (statement, field, context));
-				END_FOR;
+		if (select)
+			{
+			}
+		else
+			FOR_OBJECTS (Context*, context, &sourceContexts)
+				View *view = context->table->view;
 				
-		END_FOR;
+				if (view)
+					for (int id = 0; id < view->numberColumns; ++id)
+						values->setChild(n++, view->columns->children[id]->copy(statement, context));
+				else
+					FOR_FIELDS (field, context->table)
+						values->setChild(n++, new NField(statement, field, context));
+					END_FOR;
+					
+			END_FOR;
 		}
 
 	columnNames = new const char* [numberColumns];
@@ -238,7 +251,11 @@
 
 	contexts = new Context* [numberContexts];
 
-	if (numberContexts == 1)
+	if (select)
+		{
+		stream = new FsbDerivedTable(select);
+		}
+	else if (numberContexts == 1)
 		{
 		contexts [0] = (Context*) tables.getElement (0);
 		stream = statement->compileStream (contexts [0], conjuncts, this);

--- 1.3/storage/falcon/NSelect.h	2007-05-22 12:58:10 -04:00
+++ 1.4/storage/falcon/NSelect.h	2007-05-22 12:58:10 -04:00
@@ -72,6 +72,7 @@
 	NNode		*values;
 	NNode		*orgBoolean;
 	NNode		*groups;
+	NSelect		*select;
 	Fsb			*stream;
 	NSelect		**unionBranches;
 	int			*groupSlots;

--- 1.12/storage/falcon/SQLParse.cpp	2007-05-22 12:58:10 -04:00
+++ 1.13/storage/falcon/SQLParse.cpp	2007-05-22 12:58:10 -04:00
@@ -1668,35 +1668,41 @@
  *
  **************************************/
 
-Syntax *syntax = makeNode(nod_select, 2);
-LinkedList list;
-
-for (;;)
-	{
-	list.append (parseSelectClause());
-	if (!match ("UNION"))
-		break;
-	match ("ALL");
-	if (!match ("SELECT"))
-		error ("SELECT");
-	}
-
-syntax->setChild (0, makeNode(list));
+	Syntax *syntax = makeNode(nod_select, 2);
+	LinkedList list;
 
-if (match ("ORDER"))
-	{
-	match ("BY");
-	LinkedList sortOrder;
 	for (;;)
 		{
-		sortOrder.append (parseOrder());
-		if (!match (","))
+		list.append (parseSelectClause());
+		
+		if (!match ("UNION"))
 			break;
+			
+		match ("ALL");
+		
+		if (!match ("SELECT"))
+			error ("SELECT");
 		}
-	syntax->setChild (1, makeNode(sortOrder));
-	}
 
-return syntax;
+	syntax->setChild (0, makeNode(list));
+
+	if (match ("ORDER"))
+		{
+		match ("BY");
+		LinkedList sortOrder;
+		
+		for (;;)
+			{
+			sortOrder.append (parseOrder());
+			
+			if (!match (","))
+				break;
+			}
+			
+		syntax->setChild (1, makeNode(sortOrder));
+		}
+
+	return syntax;
 }
 
 Syntax *SQLParse::parseSelectClause ()
@@ -1711,52 +1717,61 @@
  *
  **************************************/
 
-Syntax *syntax = makeNode(nod_select_clause, 6);
+	Syntax *syntax = makeNode(nod_select_clause, 6);
 
-if (match ("ALL"))
-	;
-else if (match ("DISTINCT"))
-	syntax->setChild (0, makeNode(nod_distinct));
+	if (match ("ALL"))
+		;
+	else if (match ("DISTINCT"))
+		syntax->setChild (0, makeNode(nod_distinct));
 
-if (!match ("*"))
-	{
-	LinkedList list;
-	for (;;)
+	if (!match ("*"))
 		{
-		Syntax *expr = parseSelectExpr();
-		if (match ("AS"))
-			expr = new Syntax (nod_alias, expr, parseName());
-		list.append (expr);
-		if (!match (","))
-			break;
+		LinkedList list;
+		
+		for (;;)
+			{
+			Syntax *expr = parseSelectExpr();
+			
+			if (match ("AS"))
+				expr = new Syntax (nod_alias, expr, parseName());
+				
+			list.append (expr);
+			
+			if (!match (","))
+				break;
+			}
+			
+		syntax->setChild (1, makeNode(list));
 		}
-	syntax->setChild (1, makeNode(list));
-	}
 
-if (!match ("FROM"))
-	error ("FROM clause");
+	if (!match ("FROM"))
+		error ("FROM clause");
 
-syntax->setChild (2, parseJoin());
+	syntax->setChild (2, parseJoin());
 
-if (match ("WHERE"))
-	syntax->setChild (3, parseBoolean());
+	if (match ("WHERE"))
+		syntax->setChild (3, parseBoolean());
 
-if (match ("GROUP"))
-	{
-	match ("BY");
-	LinkedList list;
-	for (;;)
+	if (match ("GROUP"))
 		{
-		list.append (parseExpr());
-		if (!match (","))
-			break;
+		match ("BY");
+		LinkedList list;
+		
+		for (;;)
+			{
+			list.append (parseExpr());
+			
+			if (!match (","))
+				break;
+			}
+			
+		syntax->setChild (4, makeNode(list));
+		
+		if (match ("HAVING"))
+			syntax->setChild (5, parseBoolean());
 		}
-	syntax->setChild (4, makeNode(list));
-	if (match ("HAVING"))
-		syntax->setChild (5, parseBoolean());
-	}
 
-return syntax;
+	return syntax;
 }
 
 
@@ -2790,6 +2805,7 @@
 		{
 		Syntax *syntax = makeNode(nod_in_select, expr, parseSelect());
 		parseEndParen();
+		
 		return syntax;
 		}
 
@@ -2798,6 +2814,7 @@
 	for (;;)
 		{
 		values.append (parseExpr());
+		
 		if (!match (","))
 			break;
 		}
@@ -2811,8 +2828,9 @@
 {
 	if (match ("("))
 		{
-		Syntax *node = parseJoin();
+		Syntax *node = (match("SELECT")) ? parseSelect() : parseJoin();
 		parseEndParen();
+		
 		return node;
 		};
 
@@ -2824,12 +2842,15 @@
 		{
 		LinkedList list;
 		list.append (node);
+		
 		for (;;)
 			{
 			list.append (parseTable (true));
+			
 			if (!match (","))
 				break;
 			}
+			
 		return makeNode(nod_join, list);
 		}
 
Thread
bk commit into 6.0-falcon tree (jas:1.2531)U-ROWVWADEjas22 May