diff --git a/DataStructures/BTreeCollection.cs b/DataStructures/BTreeCollection.cs index 5eb4a66..66f2b8e 100644 --- a/DataStructures/BTreeCollection.cs +++ b/DataStructures/BTreeCollection.cs @@ -76,6 +76,54 @@ public BTreeCollection(IAllocateMixedPage pageAllocator, ColumnInfo[] columnType this.projectionRemoveIndexCol = new ProjectExtendInfo(mps, prjs, new ColumnInfo[0]); } + public BTreeCollection(IAllocateMixedPage pageAllocator, ColumnInfo[] columnTypes, Func indexComparer, int indexPosition, ulong initialPageId, ITransaction tran) + { + if (pageAllocator == null || columnTypes == null || columnTypes.Length == 0 || tran == null) + { + throw new ArgumentNullException(); + } + + this.pageAllocator = pageAllocator; + this.columnTypes = columnTypes; + this.indexPosition = indexPosition; + + // Add PagePointer to the end of each row. + // Page pointer will be used as pointer in btree. + // Prev page pointer will point to the left side of the first key. + // Next page pointer is used to encode additional info. + // For now next page is used to encode whether the page is leaf. + this.btreeColumnTypes = new ColumnInfo[columnTypes.Length + 1]; + Array.Copy(columnTypes, this.btreeColumnTypes, columnTypes.Length); + this.btreeColumnTypes[columnTypes.Length] = new ColumnInfo(ColumnType.PagePointer); + this.collectionRootPageId = initialPageId; + + using Releaser lck = tran.AcquireLock(initialPageId, LockManager.LockTypeEnum.Shared).ConfigureAwait(false).GetAwaiter().GetResult(); + MixedPage rootPage = pageAllocator.GetMixedPage(this.collectionRootPageId, tran, columnTypes).Result; + uint maxRowCount = rootPage.MaxRowCount(); + + // In btree we can fit max 2*t + 1 elements. + // If we can fit even number we will keep the space unused. + this.maxElemsPerPage = (int)maxRowCount; + if (maxRowCount % 2 == 0) + { + this.maxElemsPerPage--; + } + + this.indexComparer = indexComparer; + + this.pagePointerRowPosition = this.columnTypes.Length; + + MappingType[] mps = new MappingType[columnTypes.Length]; + int[] prjs = new int[columnTypes.Length]; + for (int i = 0; i < prjs.Length; i++) + { + mps[i] = MappingType.Projection; + prjs[i] = i; + } + + this.projectionRemoveIndexCol = new ProjectExtendInfo(mps, prjs, new ColumnInfo[0]); + } + public async Task Add(RowHolder item, ITransaction tran) { // Extend RowHolder with page pointer. diff --git a/DataStructures/PageListCollection.cs b/DataStructures/PageListCollection.cs index 4952907..bcfbc37 100644 --- a/DataStructures/PageListCollection.cs +++ b/DataStructures/PageListCollection.cs @@ -6,6 +6,39 @@ namespace DataStructures { + public enum CollectionType + { + PageList, + BTree, + } + + public static class CollectionHandler + { + public static async Task CreateInitialPage(CollectionType collectionType, ColumnInfo[] columnInfos, IAllocateMixedPage pageAllocator, ITransaction tran) + { + ArgumentNullException.ThrowIfNull(collectionType); + ArgumentNullException.ThrowIfNull(pageAllocator); + ArgumentNullException.ThrowIfNull(tran); + + if (collectionType == CollectionType.PageList) + { + return await pageAllocator.AllocateMixedPage(columnInfos, PageManagerConstants.NullPageId, PageManagerConstants.NullPageId, tran); + } + else if (collectionType == CollectionType.BTree) + { + // Need to extend it to add page pointers. + ColumnInfo[] btreeColumnTypes = new ColumnInfo[columnInfos.Length + 1]; + Array.Copy(columnInfos, btreeColumnTypes, columnInfos.Length); + btreeColumnTypes[columnInfos.Length] = new ColumnInfo(ColumnType.PagePointer); + return await pageAllocator.AllocateMixedPage(btreeColumnTypes, PageManagerConstants.NullPageId, PageManagerConstants.NullPageId, tran); + } + else + { + throw new ArgumentException(); + } + } + } + public interface IPageCollection { Task Count(ITransaction tran); diff --git a/MetadataManager/Exceptions/OnlyOneClusteredIndexSupportedException.cs b/MetadataManager/Exceptions/OnlyOneClusteredIndexSupportedException.cs new file mode 100644 index 0000000..e6ae065 --- /dev/null +++ b/MetadataManager/Exceptions/OnlyOneClusteredIndexSupportedException.cs @@ -0,0 +1,8 @@ +using System; + +namespace MetadataManager.Exceptions +{ + public class OnlyOneClusteredIndexSupportedException : Exception + { + } +} diff --git a/MetadataManager/MetadataColumns.cs b/MetadataManager/MetadataColumns.cs index d3b4ffc..82275d3 100644 --- a/MetadataManager/MetadataColumns.cs +++ b/MetadataManager/MetadataColumns.cs @@ -8,6 +8,8 @@ namespace MetadataManager { public struct MetadataColumn { + public const int NotPartOfClusteredIndex = -1; + public const int ColumnIdColumnPos = 0; public readonly int ColumnId; public const int TableIdColumnPos = 1; @@ -15,20 +17,23 @@ public struct MetadataColumn public const int ColumnNameColumnPos = 2; public readonly string ColumnName; public const int ColumnTypeColumnPos = 3; - public const int ColumnTypeLength = 4; public readonly ColumnInfo ColumnType; + public const int ColumnTypeLength = 4; + public const int ClusteredIndexPartPos = 5; + public readonly int ClusteredIndexPart; - public MetadataColumn(int columnId, int tableId, string columnName, ColumnInfo columnInfo) + public MetadataColumn(int columnId, int tableId, string columnName, ColumnInfo columnInfo, int clusteredIndexPart = NotPartOfClusteredIndex) { this.ColumnId = columnId; this.TableId = tableId; this.ColumnName = columnName; this.ColumnType = columnInfo; + this.ClusteredIndexPart = clusteredIndexPart; } public MetadataColumn SetNewColumnPosition(int columnId) { - return new MetadataColumn(columnId, this.TableId, this.ColumnName, this.ColumnType); + return new MetadataColumn(columnId, this.TableId, this.ColumnName, this.ColumnType, this.ClusteredIndexPart); } } @@ -38,12 +43,13 @@ public MetadataColumn SetNewColumnPosition(int columnId) /// public struct ColumnCreateDefinition { - public ColumnCreateDefinition(int tableId, string columnName, ColumnInfo columnInfo, int columnId) + public ColumnCreateDefinition(int tableId, string columnName, ColumnInfo columnInfo, int columnId, int clusteredIndexPosition) { this.TableId = tableId; this.ColumnName = columnName; this.ColumnType = columnInfo; this.ColumnId = columnId; + this.ClusteredIndexPosition = clusteredIndexPosition; } /// @@ -65,6 +71,12 @@ public ColumnCreateDefinition(int tableId, string columnName, ColumnInfo columnI /// Column position in table. /// public int ColumnId { get; } + + /// + /// Position in clustered index, if this column is part of it. + /// -1 otherwise. + /// + public int ClusteredIndexPosition { get; } } public class MetadataColumnsManager : IMetadataObjectManager /* column id - table id */> @@ -83,6 +95,7 @@ public class MetadataColumnsManager : IMetadataObjectManager columnDefinitions; @@ -109,7 +122,8 @@ public async IAsyncEnumerable Iterate(ITransaction tran) rh.GetField(MetadataColumn.ColumnIdColumnPos), rh.GetField(MetadataColumn.TableIdColumnPos), new string(columnName), - new ColumnInfo((ColumnType)rh.GetField(MetadataColumn.ColumnTypeColumnPos), rh.GetField(MetadataColumn.ColumnTypeLength))); + new ColumnInfo((ColumnType)rh.GetField(MetadataColumn.ColumnTypeColumnPos), rh.GetField(MetadataColumn.ColumnTypeLength)), + rh.GetField(MetadataColumn.ClusteredIndexPartPos)); } } @@ -123,11 +137,12 @@ public async Task CreateObject(ColumnCreateDefinition def, ITransaction tra RowHolder rh = new RowHolder(columnDefinitions); PagePointerOffsetPair namePointer = await this.stringHeap.Add(def.ColumnName.ToCharArray(), tran); - rh.SetField(0, def.ColumnId); - rh.SetField(1, def.TableId); - rh.SetField(2, namePointer); - rh.SetField(3, (int)def.ColumnType.ColumnType); - rh.SetField(4, def.ColumnType.RepCount); + rh.SetField(MetadataColumn.ColumnIdColumnPos, def.ColumnId); + rh.SetField(MetadataColumn.TableIdColumnPos, def.TableId); + rh.SetField(MetadataColumn.ColumnNameColumnPos, namePointer); + rh.SetField(MetadataColumn.ColumnTypeColumnPos, (int)def.ColumnType.ColumnType); + rh.SetField(MetadataColumn.ColumnTypeLength, def.ColumnType.RepCount); + rh.SetField(MetadataColumn.ClusteredIndexPartPos, def.ClusteredIndexPosition); await pageListCollection.Add(rh, tran); @@ -144,7 +159,8 @@ public async Task Exists(ColumnCreateDefinition def, ITransaction tran) { PagePointerOffsetPair stringPointer = rh.GetField(MetadataColumn.ColumnNameColumnPos); - if (def.ColumnName == new string(await stringHeap.Fetch(stringPointer, tran))) + char[] strContent = await stringHeap.Fetch(stringPointer, tran); + if (CharrArray.Compare(strContent, def.ColumnName) == 0) { return true; } diff --git a/MetadataManager/MetadataTables.cs b/MetadataManager/MetadataTables.cs index c7357d0..7721e7c 100644 --- a/MetadataManager/MetadataTables.cs +++ b/MetadataManager/MetadataTables.cs @@ -1,7 +1,9 @@ using DataStructures; +using MetadataManager.Exceptions; using PageManager; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -17,7 +19,6 @@ public struct MetadataTable public ulong RootPage; public MetadataColumn[] Columns; - // Virtual fields. public IPageCollection Collection; } @@ -26,6 +27,7 @@ public struct TableCreateDefinition public string TableName; public string[] ColumnNames; public ColumnInfo[] ColumnTypes; + public int[] ClusteredIndexPositions; } public class MetadataTablesManager : IMetadataObjectManager @@ -68,7 +70,7 @@ public async Task Exists(TableCreateDefinition def, ITransaction tran) { PagePointerOffsetPair stringPointer = rh.GetField(1); - if (def.TableName == new string(await stringHeap.Fetch(stringPointer, tran))) + if (CharrArray.Compare(def.TableName, await stringHeap.Fetch(stringPointer, tran)) == 0) { return true; } @@ -90,13 +92,16 @@ public async Task CreateObject(TableCreateDefinition def, ITransaction tran } int id = 1; - if (!(await pageListCollection.IsEmpty(tran))) + if (!(await this.pageListCollection.IsEmpty(tran))) { - int maxId = await pageListCollection.Max(rh => rh.GetField(0), startMin: 0, tran); + int maxId = await this.pageListCollection.Max(rh => rh.GetField(0), startMin: 0, tran); id = maxId + 1; } - MixedPage rootPage = await this.pageAllocator.AllocateMixedPage(def.ColumnTypes, PageManagerConstants.NullPageId, PageManagerConstants.NullPageId, tran); + bool isClusteredIndexCollection = def.ClusteredIndexPositions.Any(pos => pos != -1); + CollectionType collectionType = isClusteredIndexCollection ? CollectionType.BTree : CollectionType.PageList; + + MixedPage rootPage = await CollectionHandler.CreateInitialPage(collectionType, def.ColumnTypes, this.pageAllocator, tran); RowHolder rh = new RowHolder(columnDefinitions); PagePointerOffsetPair namePointer = await this.stringHeap.Add(def.TableName.ToCharArray(), tran); @@ -108,7 +113,24 @@ public async Task CreateObject(TableCreateDefinition def, ITransaction tran for (int i = 0; i < def.ColumnNames.Length; i++) { - ColumnCreateDefinition ccd = new ColumnCreateDefinition(id, def.ColumnNames[i], def.ColumnTypes[i], i); + int posInClusteredIndex = -1; + + { + int currClusteredIndexIter = 0; + foreach (int clusteredIndex in def.ClusteredIndexPositions) + { + if (clusteredIndex == i) + { + // this column is part of clustered index. + posInClusteredIndex = currClusteredIndexIter; + break; + } + + currClusteredIndexIter++; + } + } + + ColumnCreateDefinition ccd = new ColumnCreateDefinition(id, def.ColumnNames[i], def.ColumnTypes[i], i, posInClusteredIndex); await columnManager.CreateObject(ccd, tran); } @@ -142,7 +164,49 @@ public async IAsyncEnumerable Iterate(ITransaction tran) mdObj.Columns = columns.ToArray(); - mdObj.Collection = new PageListCollection(this.pageAllocator, mdObj.Columns.Select(ci => ci.ColumnType).ToArray(), mdObj.RootPage); + // TODO: Add some better way to make distinction between btrees and heaps. + if (mdObj.Columns.Any(col => col.ClusteredIndexPart != MetadataColumn.NotPartOfClusteredIndex)) + { + // Find the column that has the index. + MetadataColumn[] clusteredIndexPositionsOrdered = + mdObj.Columns.Where(cl => cl.ClusteredIndexPart != MetadataColumn.NotPartOfClusteredIndex).OrderBy(cl => cl.ClusteredIndexPart).ToArray(); + + if (clusteredIndexPositionsOrdered.Length > 1) + { + throw new OnlyOneClusteredIndexSupportedException(); + } + + MetadataColumn clusteredIndexColumn = clusteredIndexPositionsOrdered[0]; + + // find this column in parent table. + int columnPos = 0; + for (; columnPos < mdObj.Columns.Length; columnPos++) + { + if (clusteredIndexColumn.ColumnId == mdObj.Columns[columnPos].ColumnId) + { + break; + } + } + + Debug.Assert(clusteredIndexColumn.ClusteredIndexPart == 0); + + Func indexComparer = ColumnTypeHandlerRouter>.Route( + new BtreeCompareFunctionCreator() { IndexColumnPosition = columnPos }, + clusteredIndexColumn.ColumnType.ColumnType); + + mdObj.Collection = new BTreeCollection( + this.pageAllocator, + mdObj.Columns.Select(ci => ci.ColumnType).ToArray(), + indexComparer, + columnPos, + mdObj.RootPage, + tran); + } + else + { + // Just heap/page list. + mdObj.Collection = new PageListCollection(this.pageAllocator, mdObj.Columns.Select(ci => ci.ColumnType).ToArray(), mdObj.RootPage); + } yield return mdObj; } @@ -163,10 +227,11 @@ public async Task GetById(int id, ITransaction tran) public async Task GetByName(string name, ITransaction tran) { + string lookupName = name.ToUpper(); lock (this.cacheLock) { MetadataTable md; - if (this.nameTableCache.TryGetValue(name, out md)) + if (this.nameTableCache.TryGetValue(lookupName, out md)) { return md; } @@ -179,7 +244,7 @@ public async Task GetByName(string name, ITransaction tran) this.nameTableCache[table.TableName] = table; } - if (table.TableName == name) + if (table.TableName == lookupName) { return table; } @@ -188,4 +253,33 @@ public async Task GetByName(string name, ITransaction tran) throw new KeyNotFoundException(); } } + + public class BtreeCompareFunctionCreator : ColumnTypeHandlerBasicDouble> + { + public int IndexColumnPosition { get; init; } + + public Func HandleDouble() + { + return (RowHolder rh1, RowHolder rh2) => + { + return rh1.GetField(this.IndexColumnPosition).CompareTo(rh2.GetField(this.IndexColumnPosition)); + }; + } + + public Func HandleInt() + { + return (RowHolder rh1, RowHolder rh2) => + { + return rh1.GetField(this.IndexColumnPosition).CompareTo(rh2.GetField(this.IndexColumnPosition)); + }; + } + + public Func HandleString() + { + return (RowHolder rh1, RowHolder rh2) => + { + return CharrArray.Compare(rh1.GetStringField(this.IndexColumnPosition), rh2.GetStringField(this.IndexColumnPosition)); + }; + } + } } diff --git a/PageManager/PageTypes/ColumnType.cs b/PageManager/PageTypes/ColumnType.cs index 2c0f5d3..ba5fea7 100644 --- a/PageManager/PageTypes/ColumnType.cs +++ b/PageManager/PageTypes/ColumnType.cs @@ -1,6 +1,6 @@ using System; +using System.Collections.Generic; using System.IO; -using System.Reflection.Metadata.Ecma335; namespace PageManager { @@ -118,4 +118,188 @@ public static ushort GetSize(ColumnType ct) }; } } + + public interface ColumnTypeHandlerAllSingle + { + T HandleInt(); + T HandleDouble(); + T HandleString(); + T HandleStringPointer(); + T HandlePagePointer(); + } + + public interface ColumnTypeHandlerBasicSingle + { + T HandleInt(); + T HandleDouble(); + T HandleString(); + } + + public interface ColumnTypeHandlerAllDouble + { + T HandleInt(); + T HandleDouble(); + T HandleString(); + T HandleStringPointer(); + T HandlePagePointer(); + } + + public interface ColumnTypeHandlerBasicDouble + { + T HandleInt(); + T HandleDouble(); + T HandleString(); + } + + public interface ColumnTypeHandlerBasicScalar + { + T HandleInt(int value); + T HandleDouble(double value); + T HandleString(string value); + } + + public interface ColumnTypeHandlerBasicArray + { + T HandleInt(IEnumerable value); + T HandleDouble(IEnumerable value); + T HandleString(IEnumerable value); + } + + public static class ColumnTypeHandlerRouter + { + public static T Route(ColumnTypeHandlerBasicDouble handler, ColumnType columnType) + { + switch (columnType) + { + case ColumnType.Int: + return handler.HandleInt(); + case ColumnType.Double: + return handler.HandleDouble(); + case ColumnType.String: + return handler.HandleString(); + default: + throw new NotImplementedException(); + } + } + + public static T Route(ColumnTypeHandlerBasicSingle handler, ColumnType columnType) + { + switch (columnType) + { + case ColumnType.Int: + return handler.HandleInt(); + case ColumnType.Double: + return handler.HandleDouble(); + case ColumnType.String: + return handler.HandleString(); + default: + throw new NotImplementedException(); + } + } + + // TODO: Add other handlers when needed. + } + + public struct CharrArray : IComparable + { + public char[] Array; + + public CharrArray(char[] arr) + { + this.Array = arr; + } + + public int CompareTo(CharrArray other) + { + for (int i = 0; i < this.Array.Length; i++) + { + if (i >= other.Array.Length) + { + // I am bigger. + return 1; + } + + if (this.Array[i] < other.Array[i]) + { + return -1; + } + + if (this.Array[i] > other.Array[i]) + { + return 1; + } + } + + if (this.Array.Length < other.Array.Length) + { + // I am smaller. + return -1; + } + + return 0; + } + + public int CompareToString(string other) + { + for (int i = 0; i < this.Array.Length; i++) + { + if (i >= other.Length) + { + // I am bigger. + return 1; + } + + if (this.Array[i] < other[i]) + { + return -1; + } + + if (this.Array[i] > other[i]) + { + return 1; + } + } + + if (this.Array.Length < other.Length) + { + // I am smaller. + return -1; + } + + return 0; + } + + public static int Compare(IEnumerable str1, IEnumerable str2) + { + using (IEnumerator str1Iter = str1.GetEnumerator()) + using (IEnumerator str2Iter = str2.GetEnumerator()) + { + while (str1Iter.MoveNext() && str2Iter.MoveNext()) + { + if (str1Iter.Current < str2Iter.Current) + { + return -1; + } + + if (str1Iter.Current > str2Iter.Current) + { + return 1; + } + } + + if (str1Iter.MoveNext()) + { + // first one is longer, hance it is bigger. + return 1; + } + + if (str2Iter.MoveNext()) + { + return -1; + } + + return 0; + } + } + } } diff --git a/ParserLexerFSharp/Sql.fs b/ParserLexerFSharp/Sql.fs index b84cff2..6f16892 100644 --- a/ParserLexerFSharp/Sql.fs +++ b/ParserLexerFSharp/Sql.fs @@ -67,6 +67,7 @@ type createTableStatement = { Table: string; ColumnList: columndef list; + ClusteredIndexList: string list; } type dropTableStatement = diff --git a/ParserLexerFSharp/SqlLexer.fs b/ParserLexerFSharp/SqlLexer.fs index 0d55c5b..26e9daa 100644 --- a/ParserLexerFSharp/SqlLexer.fs +++ b/ParserLexerFSharp/SqlLexer.fs @@ -39,6 +39,7 @@ let keywords = "COUNT", COUNT; "SUM", SUM; "TOP", TOP; + "CLUSTERED_INDEX", CLUSTERED_INDEX; ] |> Map.ofList let ops = @@ -50,7 +51,7 @@ let ops = ">=", GE; ] |> Map.ofList -# 53 "SqlLexer.fs" +# 54 "SqlLexer.fs" let trans : uint16[] array = [| (* State 0 *) @@ -103,66 +104,66 @@ let rec _fslex_dummy () = _fslex_dummy() and tokenize lexbuf = match _fslex_tables.Interpret(0,lexbuf) with | 0 -> ( -# 67 "SqlLexer.fsl" +# 68 "SqlLexer.fsl" tokenize lexbuf -# 108 "SqlLexer.fs" +# 109 "SqlLexer.fs" ) | 1 -> ( -# 68 "SqlLexer.fsl" +# 69 "SqlLexer.fsl" lexbuf.EndPos <- lexbuf.EndPos.NextLine; tokenize lexbuf; -# 113 "SqlLexer.fs" +# 114 "SqlLexer.fs" ) | 2 -> ( -# 69 "SqlLexer.fsl" +# 70 "SqlLexer.fsl" INT(Int32.Parse(LexBuffer<_>.LexemeString lexbuf)) -# 118 "SqlLexer.fs" +# 119 "SqlLexer.fs" ) | 3 -> ( -# 70 "SqlLexer.fsl" +# 71 "SqlLexer.fsl" FLOAT(Double.Parse(LexBuffer<_>.LexemeString lexbuf)) -# 123 "SqlLexer.fs" +# 124 "SqlLexer.fs" ) | 4 -> ( -# 71 "SqlLexer.fsl" +# 72 "SqlLexer.fsl" ops.[LexBuffer<_>.LexemeString lexbuf] -# 128 "SqlLexer.fs" +# 129 "SqlLexer.fs" ) | 5 -> ( -# 72 "SqlLexer.fsl" +# 73 "SqlLexer.fsl" match keywords.TryFind(LexBuffer<_>.LexemeString lexbuf) with | Some(token) -> token | None -> ID(LexBuffer<_>.LexemeString lexbuf) -# 135 "SqlLexer.fs" +# 136 "SqlLexer.fs" ) | 6 -> ( -# 75 "SqlLexer.fsl" +# 76 "SqlLexer.fsl" COMMA -# 140 "SqlLexer.fs" +# 141 "SqlLexer.fs" ) | 7 -> ( -# 76 "SqlLexer.fsl" +# 77 "SqlLexer.fsl" EOF -# 145 "SqlLexer.fs" +# 146 "SqlLexer.fs" ) | 8 -> ( -# 77 "SqlLexer.fsl" +# 78 "SqlLexer.fsl" OBRCK -# 150 "SqlLexer.fs" +# 151 "SqlLexer.fs" ) | 9 -> ( -# 78 "SqlLexer.fsl" +# 79 "SqlLexer.fsl" CBRCK -# 155 "SqlLexer.fs" +# 156 "SqlLexer.fs" ) | 10 -> ( -# 79 "SqlLexer.fsl" +# 80 "SqlLexer.fsl" QUOT -# 160 "SqlLexer.fs" +# 161 "SqlLexer.fs" ) | 11 -> ( -# 80 "SqlLexer.fsl" +# 81 "SqlLexer.fsl" STAR -# 165 "SqlLexer.fs" +# 166 "SqlLexer.fs" ) | _ -> failwith "tokenize" diff --git a/ParserLexerFSharp/SqlLexer.fsl b/ParserLexerFSharp/SqlLexer.fsl index 91e6e8e..6ae3c2b 100644 --- a/ParserLexerFSharp/SqlLexer.fsl +++ b/ParserLexerFSharp/SqlLexer.fsl @@ -38,6 +38,7 @@ let keywords = "COUNT", COUNT; "SUM", SUM; "TOP", TOP; + "CLUSTERED_INDEX", CLUSTERED_INDEX; ] |> Map.ofList let ops = diff --git a/ParserLexerFSharp/SqlParser.fs b/ParserLexerFSharp/SqlParser.fs index ef79ccb..93a9031 100644 --- a/ParserLexerFSharp/SqlParser.fs +++ b/ParserLexerFSharp/SqlParser.fs @@ -10,6 +10,7 @@ open Sql # 10 "SqlParser.fs" // This type is the type of tokens accepted by the parser type token = + | CLUSTERED_INDEX | TOP | FILESYSTEM | VIDEO_CHUNKER @@ -60,6 +61,7 @@ type token = | ID of (string) // This type is used to give symbolic names to token indexes, useful for error messages type tokenId = + | TOKEN_CLUSTERED_INDEX | TOKEN_TOP | TOKEN_FILESYSTEM | TOKEN_VIDEO_CHUNKER @@ -118,6 +120,8 @@ type nonTerminalId = | NONTERM_InsertStatement | NONTERM_valueList | NONTERM_CreateStatement + | NONTERM_indexClause + | NONTERM_indexColumnList | NONTERM_DropStatement | NONTERM_columnTypeList | NONTERM_columnType @@ -144,108 +148,110 @@ type nonTerminalId = // This function maps tokens to integer indexes let tagOfToken (t:token) = match t with - | TOP -> 0 - | FILESYSTEM -> 1 - | VIDEO_CHUNKER -> 2 - | VIDEO_TO_IMAGE -> 3 - | STAR -> 4 - | QUOT -> 5 - | EOF -> 6 - | TYPE_INT -> 7 - | TYPE_DOUBLE -> 8 - | TYPE_STRING -> 9 - | VALUES -> 10 - | INTO -> 11 - | INSERT -> 12 - | CBRCK -> 13 - | OBRCK -> 14 - | TABLE -> 15 - | DROP -> 16 - | CREATE -> 17 - | ASC -> 18 - | DESC -> 19 - | CREATE_TABLE -> 20 - | MAX -> 21 - | MIN -> 22 - | COUNT -> 23 - | SUM -> 24 - | SELECT -> 25 - | FROM -> 26 - | WHERE -> 27 - | ORDER -> 28 - | BY -> 29 - | GROUP -> 30 - | JOIN -> 31 - | INNER -> 32 - | LEFT -> 33 - | RIGHT -> 34 - | ON -> 35 - | EQ -> 36 - | LT -> 37 - | LE -> 38 - | GT -> 39 - | GE -> 40 - | COMMA -> 41 - | AND -> 42 - | OR -> 43 - | STRING _ -> 44 - | FLOAT _ -> 45 - | INT _ -> 46 - | ID _ -> 47 + | CLUSTERED_INDEX -> 0 + | TOP -> 1 + | FILESYSTEM -> 2 + | VIDEO_CHUNKER -> 3 + | VIDEO_TO_IMAGE -> 4 + | STAR -> 5 + | QUOT -> 6 + | EOF -> 7 + | TYPE_INT -> 8 + | TYPE_DOUBLE -> 9 + | TYPE_STRING -> 10 + | VALUES -> 11 + | INTO -> 12 + | INSERT -> 13 + | CBRCK -> 14 + | OBRCK -> 15 + | TABLE -> 16 + | DROP -> 17 + | CREATE -> 18 + | ASC -> 19 + | DESC -> 20 + | CREATE_TABLE -> 21 + | MAX -> 22 + | MIN -> 23 + | COUNT -> 24 + | SUM -> 25 + | SELECT -> 26 + | FROM -> 27 + | WHERE -> 28 + | ORDER -> 29 + | BY -> 30 + | GROUP -> 31 + | JOIN -> 32 + | INNER -> 33 + | LEFT -> 34 + | RIGHT -> 35 + | ON -> 36 + | EQ -> 37 + | LT -> 38 + | LE -> 39 + | GT -> 40 + | GE -> 41 + | COMMA -> 42 + | AND -> 43 + | OR -> 44 + | STRING _ -> 45 + | FLOAT _ -> 46 + | INT _ -> 47 + | ID _ -> 48 // This function maps integer indexes to symbolic token ids let tokenTagToTokenId (tokenIdx:int) = match tokenIdx with - | 0 -> TOKEN_TOP - | 1 -> TOKEN_FILESYSTEM - | 2 -> TOKEN_VIDEO_CHUNKER - | 3 -> TOKEN_VIDEO_TO_IMAGE - | 4 -> TOKEN_STAR - | 5 -> TOKEN_QUOT - | 6 -> TOKEN_EOF - | 7 -> TOKEN_TYPE_INT - | 8 -> TOKEN_TYPE_DOUBLE - | 9 -> TOKEN_TYPE_STRING - | 10 -> TOKEN_VALUES - | 11 -> TOKEN_INTO - | 12 -> TOKEN_INSERT - | 13 -> TOKEN_CBRCK - | 14 -> TOKEN_OBRCK - | 15 -> TOKEN_TABLE - | 16 -> TOKEN_DROP - | 17 -> TOKEN_CREATE - | 18 -> TOKEN_ASC - | 19 -> TOKEN_DESC - | 20 -> TOKEN_CREATE_TABLE - | 21 -> TOKEN_MAX - | 22 -> TOKEN_MIN - | 23 -> TOKEN_COUNT - | 24 -> TOKEN_SUM - | 25 -> TOKEN_SELECT - | 26 -> TOKEN_FROM - | 27 -> TOKEN_WHERE - | 28 -> TOKEN_ORDER - | 29 -> TOKEN_BY - | 30 -> TOKEN_GROUP - | 31 -> TOKEN_JOIN - | 32 -> TOKEN_INNER - | 33 -> TOKEN_LEFT - | 34 -> TOKEN_RIGHT - | 35 -> TOKEN_ON - | 36 -> TOKEN_EQ - | 37 -> TOKEN_LT - | 38 -> TOKEN_LE - | 39 -> TOKEN_GT - | 40 -> TOKEN_GE - | 41 -> TOKEN_COMMA - | 42 -> TOKEN_AND - | 43 -> TOKEN_OR - | 44 -> TOKEN_STRING - | 45 -> TOKEN_FLOAT - | 46 -> TOKEN_INT - | 47 -> TOKEN_ID - | 50 -> TOKEN_end_of_input - | 48 -> TOKEN_error + | 0 -> TOKEN_CLUSTERED_INDEX + | 1 -> TOKEN_TOP + | 2 -> TOKEN_FILESYSTEM + | 3 -> TOKEN_VIDEO_CHUNKER + | 4 -> TOKEN_VIDEO_TO_IMAGE + | 5 -> TOKEN_STAR + | 6 -> TOKEN_QUOT + | 7 -> TOKEN_EOF + | 8 -> TOKEN_TYPE_INT + | 9 -> TOKEN_TYPE_DOUBLE + | 10 -> TOKEN_TYPE_STRING + | 11 -> TOKEN_VALUES + | 12 -> TOKEN_INTO + | 13 -> TOKEN_INSERT + | 14 -> TOKEN_CBRCK + | 15 -> TOKEN_OBRCK + | 16 -> TOKEN_TABLE + | 17 -> TOKEN_DROP + | 18 -> TOKEN_CREATE + | 19 -> TOKEN_ASC + | 20 -> TOKEN_DESC + | 21 -> TOKEN_CREATE_TABLE + | 22 -> TOKEN_MAX + | 23 -> TOKEN_MIN + | 24 -> TOKEN_COUNT + | 25 -> TOKEN_SUM + | 26 -> TOKEN_SELECT + | 27 -> TOKEN_FROM + | 28 -> TOKEN_WHERE + | 29 -> TOKEN_ORDER + | 30 -> TOKEN_BY + | 31 -> TOKEN_GROUP + | 32 -> TOKEN_JOIN + | 33 -> TOKEN_INNER + | 34 -> TOKEN_LEFT + | 35 -> TOKEN_RIGHT + | 36 -> TOKEN_ON + | 37 -> TOKEN_EQ + | 38 -> TOKEN_LT + | 39 -> TOKEN_LE + | 40 -> TOKEN_GT + | 41 -> TOKEN_GE + | 42 -> TOKEN_COMMA + | 43 -> TOKEN_AND + | 44 -> TOKEN_OR + | 45 -> TOKEN_STRING + | 46 -> TOKEN_FLOAT + | 47 -> TOKEN_INT + | 48 -> TOKEN_ID + | 51 -> TOKEN_end_of_input + | 49 -> TOKEN_error | _ -> failwith "tokenTagToTokenId: bad token" /// This function maps production indexes returned in syntax errors to strings representing the non terminal that would be produced by that production @@ -261,83 +267,88 @@ let prodIdxToNonTerminal (prodIdx:int) = | 7 -> NONTERM_valueList | 8 -> NONTERM_valueList | 9 -> NONTERM_CreateStatement - | 10 -> NONTERM_DropStatement - | 11 -> NONTERM_columnTypeList - | 12 -> NONTERM_columnTypeList - | 13 -> NONTERM_columnType - | 14 -> NONTERM_columnType - | 15 -> NONTERM_columnType - | 16 -> NONTERM_SelectStatement - | 17 -> NONTERM_fromStatement - | 18 -> NONTERM_fromStatement - | 19 -> NONTERM_fromStatement - | 20 -> NONTERM_fromStatement + | 10 -> NONTERM_indexClause + | 11 -> NONTERM_indexClause + | 12 -> NONTERM_indexColumnList + | 13 -> NONTERM_indexColumnList + | 14 -> NONTERM_DropStatement + | 15 -> NONTERM_columnTypeList + | 16 -> NONTERM_columnTypeList + | 17 -> NONTERM_columnType + | 18 -> NONTERM_columnType + | 19 -> NONTERM_columnType + | 20 -> NONTERM_SelectStatement | 21 -> NONTERM_fromStatement - | 22 -> NONTERM_topClause - | 23 -> NONTERM_topClause - | 24 -> NONTERM_columnSelect - | 25 -> NONTERM_columnSelect - | 26 -> NONTERM_columnList - | 27 -> NONTERM_columnList - | 28 -> NONTERM_columnList - | 29 -> NONTERM_columnList + | 22 -> NONTERM_fromStatement + | 23 -> NONTERM_fromStatement + | 24 -> NONTERM_fromStatement + | 25 -> NONTERM_fromStatement + | 26 -> NONTERM_topClause + | 27 -> NONTERM_topClause + | 28 -> NONTERM_columnSelect + | 29 -> NONTERM_columnSelect | 30 -> NONTERM_columnList | 31 -> NONTERM_columnList - | 32 -> NONTERM_aggregate - | 33 -> NONTERM_aggregate - | 34 -> NONTERM_aggregate - | 35 -> NONTERM_aggregate - | 36 -> NONTERM_joinList - | 37 -> NONTERM_joinList - | 38 -> NONTERM_joinList - | 39 -> NONTERM_joinClause - | 40 -> NONTERM_joinClause - | 41 -> NONTERM_joinClause - | 42 -> NONTERM_joinClause - | 43 -> NONTERM_joinOnClause - | 44 -> NONTERM_joinOnClause - | 45 -> NONTERM_conditionList - | 46 -> NONTERM_conditionList - | 47 -> NONTERM_conditionList - | 48 -> NONTERM_conditionList + | 32 -> NONTERM_columnList + | 33 -> NONTERM_columnList + | 34 -> NONTERM_columnList + | 35 -> NONTERM_columnList + | 36 -> NONTERM_aggregate + | 37 -> NONTERM_aggregate + | 38 -> NONTERM_aggregate + | 39 -> NONTERM_aggregate + | 40 -> NONTERM_joinList + | 41 -> NONTERM_joinList + | 42 -> NONTERM_joinList + | 43 -> NONTERM_joinClause + | 44 -> NONTERM_joinClause + | 45 -> NONTERM_joinClause + | 46 -> NONTERM_joinClause + | 47 -> NONTERM_joinOnClause + | 48 -> NONTERM_joinOnClause | 49 -> NONTERM_conditionList | 50 -> NONTERM_conditionList | 51 -> NONTERM_conditionList - | 52 -> NONTERM_whereClause - | 53 -> NONTERM_whereClause - | 54 -> NONTERM_op - | 55 -> NONTERM_op - | 56 -> NONTERM_op - | 57 -> NONTERM_op + | 52 -> NONTERM_conditionList + | 53 -> NONTERM_conditionList + | 54 -> NONTERM_conditionList + | 55 -> NONTERM_conditionList + | 56 -> NONTERM_whereClause + | 57 -> NONTERM_whereClause | 58 -> NONTERM_op - | 59 -> NONTERM_value - | 60 -> NONTERM_value - | 61 -> NONTERM_value - | 62 -> NONTERM_value + | 59 -> NONTERM_op + | 60 -> NONTERM_op + | 61 -> NONTERM_op + | 62 -> NONTERM_op | 63 -> NONTERM_value | 64 -> NONTERM_value - | 65 -> NONTERM_groupByClause - | 66 -> NONTERM_groupByClause - | 67 -> NONTERM_groupByList - | 68 -> NONTERM_groupByList - | 69 -> NONTERM_orderByClause - | 70 -> NONTERM_orderByClause - | 71 -> NONTERM_orderByList - | 72 -> NONTERM_orderByList - | 73 -> NONTERM_orderBy - | 74 -> NONTERM_orderBy - | 75 -> NONTERM_orderBy - | 76 -> NONTERM_funcCall - | 77 -> NONTERM_funcCall - | 78 -> NONTERM_funcCall + | 65 -> NONTERM_value + | 66 -> NONTERM_value + | 67 -> NONTERM_value + | 68 -> NONTERM_value + | 69 -> NONTERM_groupByClause + | 70 -> NONTERM_groupByClause + | 71 -> NONTERM_groupByList + | 72 -> NONTERM_groupByList + | 73 -> NONTERM_orderByClause + | 74 -> NONTERM_orderByClause + | 75 -> NONTERM_orderByList + | 76 -> NONTERM_orderByList + | 77 -> NONTERM_orderBy + | 78 -> NONTERM_orderBy + | 79 -> NONTERM_orderBy + | 80 -> NONTERM_funcCall + | 81 -> NONTERM_funcCall + | 82 -> NONTERM_funcCall | _ -> failwith "prodIdxToNonTerminal: bad production index" -let _fsyacc_endOfInputTag = 50 -let _fsyacc_tagOfErrorTerminal = 48 +let _fsyacc_endOfInputTag = 51 +let _fsyacc_tagOfErrorTerminal = 49 // This function gets the name of a token as a string let token_to_string (t:token) = match t with + | CLUSTERED_INDEX -> "CLUSTERED_INDEX" | TOP -> "TOP" | FILESYSTEM -> "FILESYSTEM" | VIDEO_CHUNKER -> "VIDEO_CHUNKER" @@ -390,6 +401,7 @@ let token_to_string (t:token) = // This function gets the data carried by a token as an object let _fsyacc_dataOfToken (t:token) = match t with + | CLUSTERED_INDEX -> (null : System.Object) | TOP -> (null : System.Object) | FILESYSTEM -> (null : System.Object) | VIDEO_CHUNKER -> (null : System.Object) @@ -438,18 +450,18 @@ let _fsyacc_dataOfToken (t:token) = | FLOAT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x | INT _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x | ID _fsyacc_x -> Microsoft.FSharp.Core.Operators.box _fsyacc_x -let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 1us; 65535us; 10us; 11us; 1us; 65535us; 15us; 16us; 1us; 65535us; 4us; 5us; 1us; 65535us; 6us; 7us; 1us; 65535us; 24us; 25us; 2us; 65535us; 24us; 30us; 31us; 32us; 4us; 65535us; 8us; 9us; 52us; 53us; 63us; 64us; 72us; 73us; 1us; 65535us; 43us; 44us; 4us; 65535us; 8us; 42us; 52us; 42us; 63us; 42us; 72us; 42us; 1us; 65535us; 42us; 43us; 1us; 65535us; 42us; 78us; 2us; 65535us; 42us; 82us; 80us; 83us; 2us; 65535us; 44us; 45us; 102us; 103us; 2us; 65535us; 44us; 102us; 102us; 102us; 4us; 65535us; 106us; 107us; 110us; 111us; 114us; 115us; 117us; 118us; 6us; 65535us; 119us; 120us; 124us; 125us; 126us; 127us; 132us; 133us; 134us; 135us; 136us; 137us; 1us; 65535us; 45us; 46us; 2us; 65535us; 121us; 122us; 129us; 130us; 16us; 65535us; 15us; 19us; 20us; 21us; 42us; 79us; 56us; 57us; 80us; 81us; 119us; 121us; 122us; 123us; 124us; 121us; 126us; 121us; 130us; 131us; 132us; 121us; 134us; 121us; 136us; 121us; 169us; 170us; 172us; 173us; 175us; 176us; 1us; 65535us; 46us; 47us; 2us; 65535us; 155us; 156us; 158us; 159us; 1us; 65535us; 47us; 48us; 2us; 65535us; 161us; 162us; 164us; 165us; 2us; 65535us; 161us; 163us; 164us; 163us; 9us; 65535us; 42us; 84us; 80us; 85us; 119us; 129us; 122us; 128us; 124us; 129us; 126us; 129us; 132us; 129us; 134us; 129us; 136us; 129us; |] -let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 7us; 9us; 11us; 13us; 15us; 18us; 23us; 25us; 30us; 32us; 34us; 37us; 40us; 43us; 48us; 55us; 57us; 60us; 77us; 79us; 82us; 84us; 87us; 90us; |] -let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 2us; 1us; 3us; 1us; 3us; 1us; 4us; 1us; 4us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 1us; 6us; 2us; 6us; 8us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 9us; 2us; 9us; 12us; 1us; 9us; 1us; 9us; 1us; 10us; 1us; 10us; 1us; 11us; 1us; 12us; 1us; 12us; 1us; 13us; 1us; 13us; 1us; 14us; 1us; 14us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 15us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 1us; 16us; 5us; 17us; 18us; 19us; 20us; 21us; 1us; 17us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 18us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 21us; 1us; 22us; 1us; 22us; 1us; 24us; 4us; 25us; 27us; 29us; 31us; 1us; 26us; 3us; 27us; 29us; 31us; 1us; 27us; 1us; 28us; 1us; 29us; 1us; 30us; 1us; 31us; 1us; 32us; 1us; 32us; 1us; 32us; 1us; 32us; 1us; 33us; 1us; 33us; 1us; 33us; 1us; 33us; 1us; 34us; 1us; 34us; 1us; 34us; 1us; 34us; 1us; 35us; 1us; 35us; 1us; 35us; 1us; 35us; 2us; 37us; 38us; 1us; 38us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 40us; 1us; 40us; 1us; 40us; 1us; 40us; 1us; 41us; 1us; 41us; 1us; 41us; 1us; 41us; 1us; 42us; 1us; 42us; 1us; 42us; 1us; 44us; 1us; 44us; 5us; 45us; 46us; 47us; 48us; 50us; 5us; 45us; 46us; 47us; 48us; 50us; 3us; 45us; 46us; 47us; 1us; 46us; 1us; 46us; 1us; 47us; 1us; 47us; 2us; 48us; 50us; 2us; 49us; 51us; 2us; 49us; 51us; 2us; 49us; 51us; 1us; 50us; 1us; 50us; 1us; 51us; 1us; 51us; 1us; 53us; 1us; 53us; 1us; 54us; 1us; 55us; 1us; 56us; 1us; 57us; 1us; 58us; 1us; 59us; 1us; 60us; 3us; 61us; 62us; 63us; 1us; 61us; 1us; 61us; 1us; 62us; 1us; 62us; 1us; 63us; 1us; 63us; 1us; 64us; 4us; 64us; 76us; 77us; 78us; 1us; 66us; 1us; 66us; 1us; 66us; 2us; 67us; 68us; 1us; 68us; 1us; 68us; 1us; 70us; 1us; 70us; 1us; 70us; 2us; 71us; 72us; 1us; 72us; 1us; 72us; 3us; 73us; 74us; 75us; 1us; 74us; 1us; 75us; 3us; 76us; 77us; 78us; 3us; 76us; 77us; 78us; 1us; 76us; 2us; 77us; 78us; 2us; 77us; 78us; 1us; 77us; 1us; 78us; 1us; 78us; 1us; 78us; |] -let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 8us; 10us; 12us; 14us; 16us; 18us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 35us; 37us; 39us; 41us; 43us; 45us; 47us; 49us; 51us; 54us; 56us; 58us; 60us; 62us; 64us; 66us; 68us; 70us; 72us; 74us; 76us; 78us; 80us; 82us; 84us; 86us; 88us; 90us; 92us; 94us; 96us; 98us; 100us; 106us; 108us; 110us; 112us; 114us; 116us; 118us; 120us; 122us; 124us; 126us; 128us; 130us; 132us; 134us; 136us; 138us; 140us; 142us; 144us; 146us; 148us; 150us; 152us; 154us; 156us; 158us; 160us; 162us; 167us; 169us; 173us; 175us; 177us; 179us; 181us; 183us; 185us; 187us; 189us; 191us; 193us; 195us; 197us; 199us; 201us; 203us; 205us; 207us; 209us; 211us; 213us; 215us; 218us; 220us; 222us; 224us; 226us; 228us; 230us; 232us; 234us; 236us; 238us; 240us; 242us; 244us; 246us; 248us; 250us; 252us; 254us; 260us; 266us; 270us; 272us; 274us; 276us; 278us; 281us; 284us; 287us; 290us; 292us; 294us; 296us; 298us; 300us; 302us; 304us; 306us; 308us; 310us; 312us; 314us; 316us; 320us; 322us; 324us; 326us; 328us; 330us; 332us; 334us; 339us; 341us; 343us; 345us; 348us; 350us; 352us; 354us; 356us; 358us; 361us; 363us; 365us; 369us; 371us; 373us; 377us; 381us; 383us; 386us; 389us; 391us; 393us; 395us; |] -let _fsyacc_action_rows = 178 -let _fsyacc_actionTableElements = [|4us; 32768us; 12us; 10us; 16us; 6us; 17us; 4us; 25us; 8us; 0us; 49152us; 1us; 32768us; 6us; 3us; 0us; 16385us; 1us; 32768us; 15us; 22us; 0us; 16386us; 1us; 32768us; 15us; 28us; 0us; 16387us; 1us; 16407us; 0us; 75us; 0us; 16388us; 1us; 32768us; 11us; 12us; 0us; 16389us; 1us; 32768us; 47us; 13us; 1us; 32768us; 10us; 14us; 1us; 32768us; 14us; 15us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 2us; 32768us; 13us; 17us; 41us; 20us; 1us; 32768us; 6us; 18us; 0us; 16390us; 0us; 16391us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 0us; 16392us; 1us; 32768us; 47us; 23us; 1us; 32768us; 14us; 24us; 3us; 32768us; 7us; 33us; 8us; 35us; 9us; 37us; 2us; 32768us; 13us; 26us; 41us; 31us; 1us; 32768us; 6us; 27us; 0us; 16393us; 1us; 32768us; 47us; 29us; 0us; 16394us; 0us; 16395us; 3us; 32768us; 7us; 33us; 8us; 35us; 9us; 37us; 0us; 16396us; 1us; 32768us; 47us; 34us; 0us; 16397us; 1us; 32768us; 47us; 36us; 0us; 16398us; 1us; 32768us; 14us; 38us; 1us; 32768us; 46us; 39us; 1us; 32768us; 13us; 40us; 1us; 32768us; 47us; 41us; 0us; 16399us; 9us; 32768us; 4us; 77us; 5us; 145us; 21us; 86us; 22us; 90us; 23us; 94us; 24us; 98us; 45us; 144us; 46us; 143us; 47us; 153us; 1us; 32768us; 26us; 49us; 4us; 16420us; 31us; 116us; 32us; 104us; 33us; 108us; 34us; 112us; 1us; 16436us; 27us; 136us; 1us; 16449us; 30us; 154us; 1us; 16453us; 28us; 160us; 0us; 16400us; 5us; 32768us; 1us; 55us; 2us; 59us; 3us; 66us; 14us; 51us; 47us; 50us; 0us; 16401us; 1us; 32768us; 25us; 52us; 1us; 16407us; 0us; 75us; 1us; 32768us; 13us; 54us; 0us; 16402us; 1us; 32768us; 14us; 56us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 1us; 32768us; 13us; 58us; 0us; 16403us; 1us; 32768us; 14us; 60us; 1us; 32768us; 46us; 61us; 1us; 32768us; 41us; 62us; 1us; 32768us; 25us; 63us; 1us; 16407us; 0us; 75us; 1us; 32768us; 13us; 65us; 0us; 16404us; 1us; 32768us; 14us; 67us; 1us; 32768us; 46us; 68us; 1us; 32768us; 41us; 69us; 1us; 32768us; 46us; 70us; 1us; 32768us; 41us; 71us; 1us; 32768us; 25us; 72us; 1us; 16407us; 0us; 75us; 1us; 32768us; 13us; 74us; 0us; 16405us; 1us; 32768us; 46us; 76us; 0us; 16406us; 0us; 16408us; 1us; 16409us; 41us; 80us; 0us; 16410us; 8us; 32768us; 5us; 145us; 21us; 86us; 22us; 90us; 23us; 94us; 24us; 98us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16411us; 0us; 16412us; 0us; 16413us; 0us; 16414us; 0us; 16415us; 1us; 32768us; 14us; 87us; 1us; 32768us; 47us; 88us; 1us; 32768us; 13us; 89us; 0us; 16416us; 1us; 32768us; 14us; 91us; 1us; 32768us; 47us; 92us; 1us; 32768us; 13us; 93us; 0us; 16417us; 1us; 32768us; 14us; 95us; 1us; 32768us; 47us; 96us; 1us; 32768us; 13us; 97us; 0us; 16418us; 1us; 32768us; 14us; 99us; 1us; 32768us; 47us; 100us; 1us; 32768us; 13us; 101us; 0us; 16419us; 4us; 16420us; 31us; 116us; 32us; 104us; 33us; 108us; 34us; 112us; 0us; 16422us; 1us; 32768us; 31us; 105us; 1us; 32768us; 47us; 106us; 1us; 16427us; 35us; 119us; 0us; 16423us; 1us; 32768us; 31us; 109us; 1us; 32768us; 47us; 110us; 1us; 16427us; 35us; 119us; 0us; 16424us; 1us; 32768us; 31us; 113us; 1us; 32768us; 47us; 114us; 1us; 16427us; 35us; 119us; 0us; 16425us; 1us; 32768us; 47us; 117us; 1us; 16427us; 35us; 119us; 0us; 16426us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16428us; 5us; 32768us; 36us; 138us; 37us; 139us; 38us; 140us; 39us; 141us; 40us; 142us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 2us; 16429us; 42us; 124us; 43us; 126us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16430us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16431us; 1us; 16432us; 42us; 132us; 5us; 32768us; 36us; 138us; 37us; 139us; 38us; 140us; 39us; 141us; 40us; 142us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 1us; 16433us; 43us; 134us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16434us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16435us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 153us; 0us; 16437us; 0us; 16438us; 0us; 16439us; 0us; 16440us; 0us; 16441us; 0us; 16442us; 0us; 16443us; 0us; 16444us; 3us; 32768us; 45us; 148us; 46us; 150us; 47us; 146us; 1us; 32768us; 5us; 147us; 0us; 16445us; 1us; 32768us; 5us; 149us; 0us; 16446us; 1us; 32768us; 5us; 151us; 0us; 16447us; 0us; 16448us; 1us; 16448us; 14us; 169us; 1us; 32768us; 29us; 155us; 1us; 32768us; 47us; 157us; 0us; 16450us; 1us; 16451us; 41us; 158us; 1us; 32768us; 47us; 157us; 0us; 16452us; 1us; 32768us; 29us; 161us; 1us; 32768us; 47us; 166us; 0us; 16454us; 1us; 16455us; 41us; 164us; 1us; 32768us; 47us; 166us; 0us; 16456us; 2us; 16457us; 18us; 167us; 19us; 168us; 0us; 16458us; 0us; 16459us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 2us; 32768us; 13us; 171us; 41us; 172us; 0us; 16460us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 2us; 32768us; 13us; 174us; 41us; 175us; 0us; 16461us; 4us; 32768us; 5us; 145us; 45us; 144us; 46us; 143us; 47us; 152us; 1us; 32768us; 13us; 177us; 0us; 16462us; |] -let _fsyacc_actionTableRowOffsets = [|0us; 5us; 6us; 8us; 9us; 11us; 12us; 14us; 15us; 17us; 18us; 20us; 21us; 23us; 25us; 27us; 32us; 35us; 37us; 38us; 39us; 44us; 45us; 47us; 49us; 53us; 56us; 58us; 59us; 61us; 62us; 63us; 67us; 68us; 70us; 71us; 73us; 74us; 76us; 78us; 80us; 82us; 83us; 93us; 95us; 100us; 102us; 104us; 106us; 107us; 113us; 114us; 116us; 118us; 120us; 121us; 123us; 128us; 130us; 131us; 133us; 135us; 137us; 139us; 141us; 143us; 144us; 146us; 148us; 150us; 152us; 154us; 156us; 158us; 160us; 161us; 163us; 164us; 165us; 167us; 168us; 177us; 178us; 179us; 180us; 181us; 182us; 184us; 186us; 188us; 189us; 191us; 193us; 195us; 196us; 198us; 200us; 202us; 203us; 205us; 207us; 209us; 210us; 215us; 216us; 218us; 220us; 222us; 223us; 225us; 227us; 229us; 230us; 232us; 234us; 236us; 237us; 239us; 241us; 242us; 247us; 248us; 254us; 259us; 262us; 267us; 268us; 273us; 274us; 276us; 282us; 287us; 289us; 294us; 295us; 300us; 301us; 306us; 307us; 308us; 309us; 310us; 311us; 312us; 313us; 314us; 318us; 320us; 321us; 323us; 324us; 326us; 327us; 328us; 330us; 332us; 334us; 335us; 337us; 339us; 340us; 342us; 344us; 345us; 347us; 349us; 350us; 353us; 354us; 355us; 360us; 363us; 364us; 369us; 372us; 373us; 378us; 380us; |] -let _fsyacc_reductionSymbolCounts = [|1us; 2us; 2us; 2us; 2us; 2us; 7us; 1us; 3us; 6us; 2us; 1us; 3us; 2us; 2us; 5us; 7us; 2us; 5us; 5us; 8us; 10us; 2us; 0us; 1us; 1us; 1us; 3us; 1us; 3us; 1us; 3us; 4us; 4us; 4us; 4us; 0us; 1us; 2us; 4us; 4us; 4us; 3us; 0us; 2us; 3us; 5us; 5us; 3us; 3us; 5us; 5us; 0us; 2us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 3us; 3us; 3us; 1us; 0us; 3us; 1us; 3us; 0us; 3us; 1us; 3us; 1us; 2us; 2us; 4us; 6us; 8us; |] -let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 2us; 2us; 3us; 4us; 4us; 5us; 6us; 7us; 7us; 8us; 8us; 8us; 9us; 10us; 10us; 10us; 10us; 10us; 11us; 11us; 12us; 12us; 13us; 13us; 13us; 13us; 13us; 13us; 14us; 14us; 14us; 14us; 15us; 15us; 15us; 16us; 16us; 16us; 16us; 17us; 17us; 18us; 18us; 18us; 18us; 18us; 18us; 18us; 19us; 19us; 20us; 20us; 20us; 20us; 20us; 21us; 21us; 21us; 21us; 21us; 21us; 22us; 22us; 23us; 23us; 24us; 24us; 25us; 25us; 26us; 26us; 26us; 27us; 27us; 27us; |] -let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 16385us; 65535us; 16386us; 65535us; 16387us; 65535us; 16388us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16390us; 16391us; 65535us; 16392us; 65535us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 16394us; 16395us; 65535us; 16396us; 65535us; 16397us; 65535us; 16398us; 65535us; 65535us; 65535us; 65535us; 16399us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16400us; 65535us; 16401us; 65535us; 65535us; 65535us; 16402us; 65535us; 65535us; 65535us; 16403us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16404us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16405us; 65535us; 16406us; 16408us; 65535us; 16410us; 65535us; 16411us; 16412us; 16413us; 16414us; 16415us; 65535us; 65535us; 65535us; 16416us; 65535us; 65535us; 65535us; 16417us; 65535us; 65535us; 65535us; 16418us; 65535us; 65535us; 65535us; 16419us; 65535us; 16422us; 65535us; 65535us; 65535us; 16423us; 65535us; 65535us; 65535us; 16424us; 65535us; 65535us; 65535us; 16425us; 65535us; 65535us; 16426us; 65535us; 16428us; 65535us; 65535us; 65535us; 65535us; 16430us; 65535us; 16431us; 65535us; 65535us; 65535us; 65535us; 65535us; 16434us; 65535us; 16435us; 65535us; 16437us; 16438us; 16439us; 16440us; 16441us; 16442us; 16443us; 16444us; 65535us; 65535us; 16445us; 65535us; 16446us; 65535us; 16447us; 16448us; 65535us; 65535us; 65535us; 16450us; 65535us; 65535us; 16452us; 65535us; 65535us; 16454us; 65535us; 65535us; 16456us; 65535us; 16458us; 16459us; 65535us; 65535us; 16460us; 65535us; 65535us; 16461us; 65535us; 65535us; 16462us; |] +let _fsyacc_gotos = [| 0us; 65535us; 1us; 65535us; 0us; 1us; 1us; 65535us; 0us; 2us; 1us; 65535us; 10us; 11us; 1us; 65535us; 15us; 16us; 1us; 65535us; 4us; 5us; 1us; 65535us; 26us; 27us; 1us; 65535us; 30us; 31us; 1us; 65535us; 6us; 7us; 1us; 65535us; 24us; 25us; 2us; 65535us; 24us; 38us; 39us; 40us; 4us; 65535us; 8us; 9us; 60us; 61us; 71us; 72us; 80us; 81us; 1us; 65535us; 51us; 52us; 4us; 65535us; 8us; 50us; 60us; 50us; 71us; 50us; 80us; 50us; 1us; 65535us; 50us; 51us; 1us; 65535us; 50us; 86us; 2us; 65535us; 50us; 90us; 88us; 91us; 2us; 65535us; 52us; 53us; 110us; 111us; 2us; 65535us; 52us; 110us; 110us; 110us; 4us; 65535us; 114us; 115us; 118us; 119us; 122us; 123us; 125us; 126us; 6us; 65535us; 127us; 128us; 132us; 133us; 134us; 135us; 140us; 141us; 142us; 143us; 144us; 145us; 1us; 65535us; 53us; 54us; 2us; 65535us; 129us; 130us; 137us; 138us; 16us; 65535us; 15us; 19us; 20us; 21us; 50us; 87us; 64us; 65us; 88us; 89us; 127us; 129us; 130us; 131us; 132us; 129us; 134us; 129us; 138us; 139us; 140us; 129us; 142us; 129us; 144us; 129us; 177us; 178us; 180us; 181us; 183us; 184us; 1us; 65535us; 54us; 55us; 2us; 65535us; 163us; 164us; 166us; 167us; 1us; 65535us; 55us; 56us; 2us; 65535us; 169us; 170us; 172us; 173us; 2us; 65535us; 169us; 171us; 172us; 171us; 9us; 65535us; 50us; 92us; 88us; 93us; 127us; 137us; 130us; 136us; 132us; 137us; 134us; 137us; 140us; 137us; 142us; 137us; 144us; 137us; |] +let _fsyacc_sparseGotoTableRowOffsets = [|0us; 1us; 3us; 5us; 7us; 9us; 11us; 13us; 15us; 17us; 19us; 22us; 27us; 29us; 34us; 36us; 38us; 41us; 44us; 47us; 52us; 59us; 61us; 64us; 81us; 83us; 86us; 88us; 91us; 94us; |] +let _fsyacc_stateToProdIdxsTableElements = [| 1us; 0us; 1us; 0us; 1us; 1us; 1us; 1us; 1us; 2us; 1us; 2us; 1us; 3us; 1us; 3us; 1us; 4us; 1us; 4us; 1us; 5us; 1us; 5us; 1us; 6us; 1us; 6us; 1us; 6us; 1us; 6us; 2us; 6us; 8us; 1us; 6us; 1us; 6us; 1us; 7us; 1us; 8us; 1us; 8us; 1us; 9us; 1us; 9us; 1us; 9us; 2us; 9us; 16us; 1us; 9us; 1us; 9us; 1us; 9us; 1us; 11us; 1us; 11us; 2us; 11us; 13us; 1us; 11us; 1us; 12us; 1us; 13us; 1us; 13us; 1us; 14us; 1us; 14us; 1us; 15us; 1us; 16us; 1us; 16us; 1us; 17us; 1us; 17us; 1us; 18us; 1us; 18us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 19us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 1us; 20us; 5us; 21us; 22us; 23us; 24us; 25us; 1us; 21us; 1us; 22us; 1us; 22us; 1us; 22us; 1us; 22us; 1us; 23us; 1us; 23us; 1us; 23us; 1us; 23us; 1us; 24us; 1us; 24us; 1us; 24us; 1us; 24us; 1us; 24us; 1us; 24us; 1us; 24us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 25us; 1us; 26us; 1us; 26us; 1us; 28us; 4us; 29us; 31us; 33us; 35us; 1us; 30us; 3us; 31us; 33us; 35us; 1us; 31us; 1us; 32us; 1us; 33us; 1us; 34us; 1us; 35us; 1us; 36us; 1us; 36us; 1us; 36us; 1us; 36us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 37us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 38us; 1us; 39us; 1us; 39us; 1us; 39us; 1us; 39us; 2us; 41us; 42us; 1us; 42us; 1us; 43us; 1us; 43us; 1us; 43us; 1us; 43us; 1us; 44us; 1us; 44us; 1us; 44us; 1us; 44us; 1us; 45us; 1us; 45us; 1us; 45us; 1us; 45us; 1us; 46us; 1us; 46us; 1us; 46us; 1us; 48us; 1us; 48us; 5us; 49us; 50us; 51us; 52us; 54us; 5us; 49us; 50us; 51us; 52us; 54us; 3us; 49us; 50us; 51us; 1us; 50us; 1us; 50us; 1us; 51us; 1us; 51us; 2us; 52us; 54us; 2us; 53us; 55us; 2us; 53us; 55us; 2us; 53us; 55us; 1us; 54us; 1us; 54us; 1us; 55us; 1us; 55us; 1us; 57us; 1us; 57us; 1us; 58us; 1us; 59us; 1us; 60us; 1us; 61us; 1us; 62us; 1us; 63us; 1us; 64us; 3us; 65us; 66us; 67us; 1us; 65us; 1us; 65us; 1us; 66us; 1us; 66us; 1us; 67us; 1us; 67us; 1us; 68us; 4us; 68us; 80us; 81us; 82us; 1us; 70us; 1us; 70us; 1us; 70us; 2us; 71us; 72us; 1us; 72us; 1us; 72us; 1us; 74us; 1us; 74us; 1us; 74us; 2us; 75us; 76us; 1us; 76us; 1us; 76us; 3us; 77us; 78us; 79us; 1us; 78us; 1us; 79us; 3us; 80us; 81us; 82us; 3us; 80us; 81us; 82us; 1us; 80us; 2us; 81us; 82us; 2us; 81us; 82us; 1us; 81us; 1us; 82us; 1us; 82us; 1us; 82us; |] +let _fsyacc_stateToProdIdxsTableRowOffsets = [|0us; 2us; 4us; 6us; 8us; 10us; 12us; 14us; 16us; 18us; 20us; 22us; 24us; 26us; 28us; 30us; 32us; 35us; 37us; 39us; 41us; 43us; 45us; 47us; 49us; 51us; 54us; 56us; 58us; 60us; 62us; 64us; 67us; 69us; 71us; 73us; 75us; 77us; 79us; 81us; 83us; 85us; 87us; 89us; 91us; 93us; 95us; 97us; 99us; 101us; 103us; 105us; 107us; 109us; 111us; 113us; 115us; 117us; 123us; 125us; 127us; 129us; 131us; 133us; 135us; 137us; 139us; 141us; 143us; 145us; 147us; 149us; 151us; 153us; 155us; 157us; 159us; 161us; 163us; 165us; 167us; 169us; 171us; 173us; 175us; 177us; 179us; 184us; 186us; 190us; 192us; 194us; 196us; 198us; 200us; 202us; 204us; 206us; 208us; 210us; 212us; 214us; 216us; 218us; 220us; 222us; 224us; 226us; 228us; 230us; 232us; 235us; 237us; 239us; 241us; 243us; 245us; 247us; 249us; 251us; 253us; 255us; 257us; 259us; 261us; 263us; 265us; 267us; 269us; 271us; 277us; 283us; 287us; 289us; 291us; 293us; 295us; 298us; 301us; 304us; 307us; 309us; 311us; 313us; 315us; 317us; 319us; 321us; 323us; 325us; 327us; 329us; 331us; 333us; 337us; 339us; 341us; 343us; 345us; 347us; 349us; 351us; 356us; 358us; 360us; 362us; 365us; 367us; 369us; 371us; 373us; 375us; 378us; 380us; 382us; 386us; 388us; 390us; 394us; 398us; 400us; 403us; 406us; 408us; 410us; 412us; |] +let _fsyacc_action_rows = 186 +let _fsyacc_actionTableElements = [|4us; 32768us; 13us; 10us; 17us; 6us; 18us; 4us; 26us; 8us; 0us; 49152us; 1us; 32768us; 7us; 3us; 0us; 16385us; 1us; 32768us; 16us; 22us; 0us; 16386us; 1us; 32768us; 16us; 36us; 0us; 16387us; 1us; 16411us; 1us; 83us; 0us; 16388us; 1us; 32768us; 12us; 12us; 0us; 16389us; 1us; 32768us; 48us; 13us; 1us; 32768us; 11us; 14us; 1us; 32768us; 15us; 15us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 2us; 32768us; 14us; 17us; 42us; 20us; 1us; 32768us; 7us; 18us; 0us; 16390us; 0us; 16391us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 0us; 16392us; 1us; 32768us; 48us; 23us; 1us; 32768us; 15us; 24us; 3us; 32768us; 8us; 41us; 9us; 43us; 10us; 45us; 2us; 32768us; 14us; 26us; 42us; 39us; 1us; 16394us; 0us; 29us; 1us; 32768us; 7us; 28us; 0us; 16393us; 1us; 32768us; 15us; 30us; 1us; 32768us; 48us; 33us; 2us; 32768us; 14us; 32us; 42us; 34us; 0us; 16395us; 0us; 16396us; 1us; 32768us; 48us; 35us; 0us; 16397us; 1us; 32768us; 48us; 37us; 0us; 16398us; 0us; 16399us; 3us; 32768us; 8us; 41us; 9us; 43us; 10us; 45us; 0us; 16400us; 1us; 32768us; 48us; 42us; 0us; 16401us; 1us; 32768us; 48us; 44us; 0us; 16402us; 1us; 32768us; 15us; 46us; 1us; 32768us; 47us; 47us; 1us; 32768us; 14us; 48us; 1us; 32768us; 48us; 49us; 0us; 16403us; 9us; 32768us; 5us; 85us; 6us; 153us; 22us; 94us; 23us; 98us; 24us; 102us; 25us; 106us; 46us; 152us; 47us; 151us; 48us; 161us; 1us; 32768us; 27us; 57us; 4us; 16424us; 32us; 124us; 33us; 112us; 34us; 116us; 35us; 120us; 1us; 16440us; 28us; 144us; 1us; 16453us; 31us; 162us; 1us; 16457us; 29us; 168us; 0us; 16404us; 5us; 32768us; 2us; 63us; 3us; 67us; 4us; 74us; 15us; 59us; 48us; 58us; 0us; 16405us; 1us; 32768us; 26us; 60us; 1us; 16411us; 1us; 83us; 1us; 32768us; 14us; 62us; 0us; 16406us; 1us; 32768us; 15us; 64us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 1us; 32768us; 14us; 66us; 0us; 16407us; 1us; 32768us; 15us; 68us; 1us; 32768us; 47us; 69us; 1us; 32768us; 42us; 70us; 1us; 32768us; 26us; 71us; 1us; 16411us; 1us; 83us; 1us; 32768us; 14us; 73us; 0us; 16408us; 1us; 32768us; 15us; 75us; 1us; 32768us; 47us; 76us; 1us; 32768us; 42us; 77us; 1us; 32768us; 47us; 78us; 1us; 32768us; 42us; 79us; 1us; 32768us; 26us; 80us; 1us; 16411us; 1us; 83us; 1us; 32768us; 14us; 82us; 0us; 16409us; 1us; 32768us; 47us; 84us; 0us; 16410us; 0us; 16412us; 1us; 16413us; 42us; 88us; 0us; 16414us; 8us; 32768us; 6us; 153us; 22us; 94us; 23us; 98us; 24us; 102us; 25us; 106us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16415us; 0us; 16416us; 0us; 16417us; 0us; 16418us; 0us; 16419us; 1us; 32768us; 15us; 95us; 1us; 32768us; 48us; 96us; 1us; 32768us; 14us; 97us; 0us; 16420us; 1us; 32768us; 15us; 99us; 1us; 32768us; 48us; 100us; 1us; 32768us; 14us; 101us; 0us; 16421us; 1us; 32768us; 15us; 103us; 1us; 32768us; 48us; 104us; 1us; 32768us; 14us; 105us; 0us; 16422us; 1us; 32768us; 15us; 107us; 1us; 32768us; 48us; 108us; 1us; 32768us; 14us; 109us; 0us; 16423us; 4us; 16424us; 32us; 124us; 33us; 112us; 34us; 116us; 35us; 120us; 0us; 16426us; 1us; 32768us; 32us; 113us; 1us; 32768us; 48us; 114us; 1us; 16431us; 36us; 127us; 0us; 16427us; 1us; 32768us; 32us; 117us; 1us; 32768us; 48us; 118us; 1us; 16431us; 36us; 127us; 0us; 16428us; 1us; 32768us; 32us; 121us; 1us; 32768us; 48us; 122us; 1us; 16431us; 36us; 127us; 0us; 16429us; 1us; 32768us; 48us; 125us; 1us; 16431us; 36us; 127us; 0us; 16430us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16432us; 5us; 32768us; 37us; 146us; 38us; 147us; 39us; 148us; 40us; 149us; 41us; 150us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 2us; 16433us; 43us; 132us; 44us; 134us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16434us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16435us; 1us; 16436us; 43us; 140us; 5us; 32768us; 37us; 146us; 38us; 147us; 39us; 148us; 40us; 149us; 41us; 150us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 1us; 16437us; 44us; 142us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16438us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16439us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 161us; 0us; 16441us; 0us; 16442us; 0us; 16443us; 0us; 16444us; 0us; 16445us; 0us; 16446us; 0us; 16447us; 0us; 16448us; 3us; 32768us; 46us; 156us; 47us; 158us; 48us; 154us; 1us; 32768us; 6us; 155us; 0us; 16449us; 1us; 32768us; 6us; 157us; 0us; 16450us; 1us; 32768us; 6us; 159us; 0us; 16451us; 0us; 16452us; 1us; 16452us; 15us; 177us; 1us; 32768us; 30us; 163us; 1us; 32768us; 48us; 165us; 0us; 16454us; 1us; 16455us; 42us; 166us; 1us; 32768us; 48us; 165us; 0us; 16456us; 1us; 32768us; 30us; 169us; 1us; 32768us; 48us; 174us; 0us; 16458us; 1us; 16459us; 42us; 172us; 1us; 32768us; 48us; 174us; 0us; 16460us; 2us; 16461us; 19us; 175us; 20us; 176us; 0us; 16462us; 0us; 16463us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 2us; 32768us; 14us; 179us; 42us; 180us; 0us; 16464us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 2us; 32768us; 14us; 182us; 42us; 183us; 0us; 16465us; 4us; 32768us; 6us; 153us; 46us; 152us; 47us; 151us; 48us; 160us; 1us; 32768us; 14us; 185us; 0us; 16466us; |] +let _fsyacc_actionTableRowOffsets = [|0us; 5us; 6us; 8us; 9us; 11us; 12us; 14us; 15us; 17us; 18us; 20us; 21us; 23us; 25us; 27us; 32us; 35us; 37us; 38us; 39us; 44us; 45us; 47us; 49us; 53us; 56us; 58us; 60us; 61us; 63us; 65us; 68us; 69us; 70us; 72us; 73us; 75us; 76us; 77us; 81us; 82us; 84us; 85us; 87us; 88us; 90us; 92us; 94us; 96us; 97us; 107us; 109us; 114us; 116us; 118us; 120us; 121us; 127us; 128us; 130us; 132us; 134us; 135us; 137us; 142us; 144us; 145us; 147us; 149us; 151us; 153us; 155us; 157us; 158us; 160us; 162us; 164us; 166us; 168us; 170us; 172us; 174us; 175us; 177us; 178us; 179us; 181us; 182us; 191us; 192us; 193us; 194us; 195us; 196us; 198us; 200us; 202us; 203us; 205us; 207us; 209us; 210us; 212us; 214us; 216us; 217us; 219us; 221us; 223us; 224us; 229us; 230us; 232us; 234us; 236us; 237us; 239us; 241us; 243us; 244us; 246us; 248us; 250us; 251us; 253us; 255us; 256us; 261us; 262us; 268us; 273us; 276us; 281us; 282us; 287us; 288us; 290us; 296us; 301us; 303us; 308us; 309us; 314us; 315us; 320us; 321us; 322us; 323us; 324us; 325us; 326us; 327us; 328us; 332us; 334us; 335us; 337us; 338us; 340us; 341us; 342us; 344us; 346us; 348us; 349us; 351us; 353us; 354us; 356us; 358us; 359us; 361us; 363us; 364us; 367us; 368us; 369us; 374us; 377us; 378us; 383us; 386us; 387us; 392us; 394us; |] +let _fsyacc_reductionSymbolCounts = [|1us; 2us; 2us; 2us; 2us; 2us; 7us; 1us; 3us; 7us; 0us; 4us; 1us; 3us; 2us; 1us; 3us; 2us; 2us; 5us; 7us; 2us; 5us; 5us; 8us; 10us; 2us; 0us; 1us; 1us; 1us; 3us; 1us; 3us; 1us; 3us; 4us; 4us; 4us; 4us; 0us; 1us; 2us; 4us; 4us; 4us; 3us; 0us; 2us; 3us; 5us; 5us; 3us; 3us; 5us; 5us; 0us; 2us; 1us; 1us; 1us; 1us; 1us; 1us; 1us; 3us; 3us; 3us; 1us; 0us; 3us; 1us; 3us; 0us; 3us; 1us; 3us; 1us; 2us; 2us; 4us; 6us; 8us; |] +let _fsyacc_productionToNonTerminalTable = [|0us; 1us; 2us; 2us; 2us; 2us; 3us; 4us; 4us; 5us; 6us; 6us; 7us; 7us; 8us; 9us; 9us; 10us; 10us; 10us; 11us; 12us; 12us; 12us; 12us; 12us; 13us; 13us; 14us; 14us; 15us; 15us; 15us; 15us; 15us; 15us; 16us; 16us; 16us; 16us; 17us; 17us; 17us; 18us; 18us; 18us; 18us; 19us; 19us; 20us; 20us; 20us; 20us; 20us; 20us; 20us; 21us; 21us; 22us; 22us; 22us; 22us; 22us; 23us; 23us; 23us; 23us; 23us; 23us; 24us; 24us; 25us; 25us; 26us; 26us; 27us; 27us; 28us; 28us; 28us; 29us; 29us; 29us; |] +let _fsyacc_immediateActions = [|65535us; 49152us; 65535us; 16385us; 65535us; 16386us; 65535us; 16387us; 65535us; 16388us; 65535us; 16389us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16390us; 16391us; 65535us; 16392us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16393us; 65535us; 65535us; 65535us; 16395us; 16396us; 65535us; 16397us; 65535us; 16398us; 16399us; 65535us; 16400us; 65535us; 16401us; 65535us; 16402us; 65535us; 65535us; 65535us; 65535us; 16403us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16404us; 65535us; 16405us; 65535us; 65535us; 65535us; 16406us; 65535us; 65535us; 65535us; 16407us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16408us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 65535us; 16409us; 65535us; 16410us; 16412us; 65535us; 16414us; 65535us; 16415us; 16416us; 16417us; 16418us; 16419us; 65535us; 65535us; 65535us; 16420us; 65535us; 65535us; 65535us; 16421us; 65535us; 65535us; 65535us; 16422us; 65535us; 65535us; 65535us; 16423us; 65535us; 16426us; 65535us; 65535us; 65535us; 16427us; 65535us; 65535us; 65535us; 16428us; 65535us; 65535us; 65535us; 16429us; 65535us; 65535us; 16430us; 65535us; 16432us; 65535us; 65535us; 65535us; 65535us; 16434us; 65535us; 16435us; 65535us; 65535us; 65535us; 65535us; 65535us; 16438us; 65535us; 16439us; 65535us; 16441us; 16442us; 16443us; 16444us; 16445us; 16446us; 16447us; 16448us; 65535us; 65535us; 16449us; 65535us; 16450us; 65535us; 16451us; 16452us; 65535us; 65535us; 65535us; 16454us; 65535us; 65535us; 16456us; 65535us; 65535us; 16458us; 65535us; 65535us; 16460us; 65535us; 16462us; 16463us; 65535us; 65535us; 16464us; 65535us; 65535us; 16465us; 65535us; 65535us; 16466us; |] let _fsyacc_reductions () = [| -# 452 "SqlParser.fs" +# 464 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> Sql.DmlDdlSqlStatement in Microsoft.FSharp.Core.Operators.box @@ -458,69 +470,69 @@ let _fsyacc_reductions () = [| raise (FSharp.Text.Parsing.Accept(Microsoft.FSharp.Core.Operators.box _1)) ) : 'gentype__startstartCT)); -# 461 "SqlParser.fs" +# 473 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_StatementType in Microsoft.FSharp.Core.Operators.box ( ( -# 39 "SqlParser.fsp" +# 40 "SqlParser.fsp" _1 ) -# 39 "SqlParser.fsp" +# 40 "SqlParser.fsp" : Sql.DmlDdlSqlStatement)); -# 472 "SqlParser.fs" +# 484 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_CreateStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 42 "SqlParser.fsp" +# 43 "SqlParser.fsp" Create(_2) ) -# 42 "SqlParser.fsp" +# 43 "SqlParser.fsp" : 'gentype_StatementType)); -# 483 "SqlParser.fs" +# 495 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_DropStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 43 "SqlParser.fsp" +# 44 "SqlParser.fsp" Drop(_2) ) -# 43 "SqlParser.fsp" +# 44 "SqlParser.fsp" : 'gentype_StatementType)); -# 494 "SqlParser.fs" +# 506 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_SelectStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 44 "SqlParser.fsp" +# 45 "SqlParser.fsp" Select(_2) ) -# 44 "SqlParser.fsp" +# 45 "SqlParser.fsp" : 'gentype_StatementType)); -# 505 "SqlParser.fs" +# 517 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_InsertStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 45 "SqlParser.fsp" +# 46 "SqlParser.fsp" Insert(_2) ) -# 45 "SqlParser.fsp" +# 46 "SqlParser.fsp" : 'gentype_StatementType)); -# 516 "SqlParser.fs" +# 528 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _5 = parseState.GetInput(5) :?> 'gentype_valueList in Microsoft.FSharp.Core.Operators.box ( ( -# 49 "SqlParser.fsp" +# 50 "SqlParser.fsp" { Table = _2; @@ -528,117 +540,164 @@ let _fsyacc_reductions () = [| } ) -# 49 "SqlParser.fsp" +# 50 "SqlParser.fsp" : 'gentype_InsertStatement)); -# 533 "SqlParser.fs" +# 545 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 57 "SqlParser.fsp" +# 58 "SqlParser.fsp" [_1] ) -# 57 "SqlParser.fsp" +# 58 "SqlParser.fsp" : 'gentype_valueList)); -# 544 "SqlParser.fs" +# 556 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_valueList in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 58 "SqlParser.fsp" +# 59 "SqlParser.fsp" _3 :: _1 ) -# 58 "SqlParser.fsp" +# 59 "SqlParser.fsp" : 'gentype_valueList)); -# 556 "SqlParser.fs" +# 568 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_columnTypeList in + let _6 = parseState.GetInput(6) :?> 'gentype_indexClause in Microsoft.FSharp.Core.Operators.box ( ( -# 62 "SqlParser.fsp" +# 63 "SqlParser.fsp" { Table = _2; ColumnList = List.rev _4 + ClusteredIndexList = _6 + // ClusteredIndexList = _6 } ) -# 62 "SqlParser.fsp" +# 63 "SqlParser.fsp" : 'gentype_CreateStatement)); -# 573 "SqlParser.fs" +# 588 "SqlParser.fs" + (fun (parseState : FSharp.Text.Parsing.IParseState) -> + Microsoft.FSharp.Core.Operators.box + ( + ( +# 73 "SqlParser.fsp" + [] + ) +# 73 "SqlParser.fsp" + : 'gentype_indexClause)); +# 598 "SqlParser.fs" + (fun (parseState : FSharp.Text.Parsing.IParseState) -> + let _3 = parseState.GetInput(3) :?> 'gentype_indexColumnList in + Microsoft.FSharp.Core.Operators.box + ( + ( +# 74 "SqlParser.fsp" + List.rev _3 + ) +# 74 "SqlParser.fsp" + : 'gentype_indexClause)); +# 609 "SqlParser.fs" + (fun (parseState : FSharp.Text.Parsing.IParseState) -> + let _1 = parseState.GetInput(1) :?> string in + Microsoft.FSharp.Core.Operators.box + ( + ( +# 77 "SqlParser.fsp" + [_1] + ) +# 77 "SqlParser.fsp" + : 'gentype_indexColumnList)); +# 620 "SqlParser.fs" + (fun (parseState : FSharp.Text.Parsing.IParseState) -> + let _1 = parseState.GetInput(1) :?> 'gentype_indexColumnList in + let _3 = parseState.GetInput(3) :?> string in + Microsoft.FSharp.Core.Operators.box + ( + ( +# 78 "SqlParser.fsp" + _3 :: _1 + ) +# 78 "SqlParser.fsp" + : 'gentype_indexColumnList)); +# 632 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 70 "SqlParser.fsp" +# 81 "SqlParser.fsp" _2 ) -# 70 "SqlParser.fsp" +# 81 "SqlParser.fsp" : 'gentype_DropStatement)); -# 584 "SqlParser.fs" +# 643 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnType in Microsoft.FSharp.Core.Operators.box ( ( -# 73 "SqlParser.fsp" +# 84 "SqlParser.fsp" [_1] ) -# 73 "SqlParser.fsp" +# 84 "SqlParser.fsp" : 'gentype_columnTypeList)); -# 595 "SqlParser.fs" +# 654 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnTypeList in let _3 = parseState.GetInput(3) :?> 'gentype_columnType in Microsoft.FSharp.Core.Operators.box ( ( -# 74 "SqlParser.fsp" +# 85 "SqlParser.fsp" _3 :: _1 ) -# 74 "SqlParser.fsp" +# 85 "SqlParser.fsp" : 'gentype_columnTypeList)); -# 607 "SqlParser.fs" +# 666 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 77 "SqlParser.fsp" +# 88 "SqlParser.fsp" IntCType, 0, _2 ) -# 77 "SqlParser.fsp" +# 88 "SqlParser.fsp" : 'gentype_columnType)); -# 618 "SqlParser.fs" +# 677 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 78 "SqlParser.fsp" +# 89 "SqlParser.fsp" DoubleCType, 0, _2 ) -# 78 "SqlParser.fsp" +# 89 "SqlParser.fsp" : 'gentype_columnType)); -# 629 "SqlParser.fs" +# 688 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> int in let _5 = parseState.GetInput(5) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 79 "SqlParser.fsp" +# 90 "SqlParser.fsp" StringCType, _3, _5 ) -# 79 "SqlParser.fsp" +# 90 "SqlParser.fsp" : 'gentype_columnType)); -# 641 "SqlParser.fs" +# 700 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_topClause in let _2 = parseState.GetInput(2) :?> 'gentype_columnSelect in @@ -650,7 +709,7 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 87 "SqlParser.fsp" +# 98 "SqlParser.fsp" { Top = _1 @@ -663,54 +722,54 @@ let _fsyacc_reductions () = [| } ) -# 87 "SqlParser.fsp" +# 98 "SqlParser.fsp" : 'gentype_SelectStatement)); -# 668 "SqlParser.fs" +# 727 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 100 "SqlParser.fsp" +# 111 "SqlParser.fsp" FromTable(_2) ) -# 100 "SqlParser.fsp" +# 111 "SqlParser.fsp" : 'gentype_fromStatement)); -# 679 "SqlParser.fs" +# 738 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _4 = parseState.GetInput(4) :?> 'gentype_SelectStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 101 "SqlParser.fsp" +# 112 "SqlParser.fsp" FromSubquery(_4) ) -# 101 "SqlParser.fsp" +# 112 "SqlParser.fsp" : 'gentype_fromStatement)); -# 690 "SqlParser.fs" +# 749 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _4 = parseState.GetInput(4) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 102 "SqlParser.fsp" +# 113 "SqlParser.fsp" FileSystemProvider(_4) ) -# 102 "SqlParser.fsp" +# 113 "SqlParser.fsp" : 'gentype_fromStatement)); -# 701 "SqlParser.fs" +# 760 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _4 = parseState.GetInput(4) :?> int in let _7 = parseState.GetInput(7) :?> 'gentype_SelectStatement in Microsoft.FSharp.Core.Operators.box ( ( -# 103 "SqlParser.fsp" +# 114 "SqlParser.fsp" VideoChunkProviderSubquery(_7, _4) ) -# 103 "SqlParser.fsp" +# 114 "SqlParser.fsp" : 'gentype_fromStatement)); -# 713 "SqlParser.fs" +# 772 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _4 = parseState.GetInput(4) :?> int in let _6 = parseState.GetInput(6) :?> int in @@ -718,269 +777,269 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 104 "SqlParser.fsp" +# 115 "SqlParser.fsp" VideoImageProviderSubquery(_9, _4, _6) ) -# 104 "SqlParser.fsp" +# 115 "SqlParser.fsp" : 'gentype_fromStatement)); -# 726 "SqlParser.fs" +# 785 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 107 "SqlParser.fsp" +# 118 "SqlParser.fsp" Some(_2) ) -# 107 "SqlParser.fsp" +# 118 "SqlParser.fsp" : 'gentype_topClause)); -# 737 "SqlParser.fs" +# 796 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 108 "SqlParser.fsp" +# 119 "SqlParser.fsp" None ) -# 108 "SqlParser.fsp" +# 119 "SqlParser.fsp" : 'gentype_topClause)); -# 747 "SqlParser.fs" +# 806 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 111 "SqlParser.fsp" +# 122 "SqlParser.fsp" Star ) -# 111 "SqlParser.fsp" +# 122 "SqlParser.fsp" : 'gentype_columnSelect)); -# 757 "SqlParser.fs" +# 816 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in Microsoft.FSharp.Core.Operators.box ( ( -# 112 "SqlParser.fsp" +# 123 "SqlParser.fsp" ColumnList(List.rev _1) ) -# 112 "SqlParser.fsp" +# 123 "SqlParser.fsp" : 'gentype_columnSelect)); -# 768 "SqlParser.fs" +# 827 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 115 "SqlParser.fsp" +# 126 "SqlParser.fsp" [ValueOrFunc(Value(_1))] ) -# 115 "SqlParser.fsp" +# 126 "SqlParser.fsp" : 'gentype_columnList)); -# 779 "SqlParser.fs" +# 838 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 116 "SqlParser.fsp" +# 127 "SqlParser.fsp" ValueOrFunc(Value(_3)) :: _1 ) -# 116 "SqlParser.fsp" +# 127 "SqlParser.fsp" : 'gentype_columnList)); -# 791 "SqlParser.fs" +# 850 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_aggregate in Microsoft.FSharp.Core.Operators.box ( ( -# 117 "SqlParser.fsp" +# 128 "SqlParser.fsp" [_1] ) -# 117 "SqlParser.fsp" +# 128 "SqlParser.fsp" : 'gentype_columnList)); -# 802 "SqlParser.fs" +# 861 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_aggregate in Microsoft.FSharp.Core.Operators.box ( ( -# 118 "SqlParser.fsp" +# 129 "SqlParser.fsp" _3 :: _1 ) -# 118 "SqlParser.fsp" +# 129 "SqlParser.fsp" : 'gentype_columnList)); -# 814 "SqlParser.fs" +# 873 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in Microsoft.FSharp.Core.Operators.box ( ( -# 119 "SqlParser.fsp" +# 130 "SqlParser.fsp" [ValueOrFunc(FuncCall(_1))] ) -# 119 "SqlParser.fsp" +# 130 "SqlParser.fsp" : 'gentype_columnList)); -# 825 "SqlParser.fs" +# 884 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_columnList in let _3 = parseState.GetInput(3) :?> 'gentype_funcCall in Microsoft.FSharp.Core.Operators.box ( ( -# 120 "SqlParser.fsp" +# 131 "SqlParser.fsp" ValueOrFunc(FuncCall(_3)) :: _1 ) -# 120 "SqlParser.fsp" +# 131 "SqlParser.fsp" : 'gentype_columnList)); -# 837 "SqlParser.fs" +# 896 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 123 "SqlParser.fsp" +# 134 "SqlParser.fsp" Aggregate(Max, _3) ) -# 123 "SqlParser.fsp" +# 134 "SqlParser.fsp" : 'gentype_aggregate)); -# 848 "SqlParser.fs" +# 907 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 124 "SqlParser.fsp" +# 135 "SqlParser.fsp" Aggregate(Min, _3) ) -# 124 "SqlParser.fsp" +# 135 "SqlParser.fsp" : 'gentype_aggregate)); -# 859 "SqlParser.fs" +# 918 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 125 "SqlParser.fsp" +# 136 "SqlParser.fsp" Aggregate(Count, _3) ) -# 125 "SqlParser.fsp" +# 136 "SqlParser.fsp" : 'gentype_aggregate)); -# 870 "SqlParser.fs" +# 929 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 126 "SqlParser.fsp" +# 137 "SqlParser.fsp" Aggregate(Sum, _3) ) -# 126 "SqlParser.fsp" +# 137 "SqlParser.fsp" : 'gentype_aggregate)); -# 881 "SqlParser.fs" +# 940 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 130 "SqlParser.fsp" +# 141 "SqlParser.fsp" [] ) -# 130 "SqlParser.fsp" +# 141 "SqlParser.fsp" : 'gentype_joinList)); -# 891 "SqlParser.fs" +# 950 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_joinClause in Microsoft.FSharp.Core.Operators.box ( ( -# 131 "SqlParser.fsp" +# 142 "SqlParser.fsp" [_1] ) -# 131 "SqlParser.fsp" +# 142 "SqlParser.fsp" : 'gentype_joinList)); -# 902 "SqlParser.fs" +# 961 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_joinClause in let _2 = parseState.GetInput(2) :?> 'gentype_joinList in Microsoft.FSharp.Core.Operators.box ( ( -# 132 "SqlParser.fsp" +# 143 "SqlParser.fsp" _1 :: _2 ) -# 132 "SqlParser.fsp" +# 143 "SqlParser.fsp" : 'gentype_joinList)); -# 914 "SqlParser.fs" +# 973 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 135 "SqlParser.fsp" +# 146 "SqlParser.fsp" _3, Inner, _4 ) -# 135 "SqlParser.fsp" +# 146 "SqlParser.fsp" : 'gentype_joinClause)); -# 926 "SqlParser.fs" +# 985 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 136 "SqlParser.fsp" +# 147 "SqlParser.fsp" _3, Left, _4 ) -# 136 "SqlParser.fsp" +# 147 "SqlParser.fsp" : 'gentype_joinClause)); -# 938 "SqlParser.fs" +# 997 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> string in let _4 = parseState.GetInput(4) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 137 "SqlParser.fsp" +# 148 "SqlParser.fsp" _3, Right, _4 ) -# 137 "SqlParser.fsp" +# 148 "SqlParser.fsp" : 'gentype_joinClause)); -# 950 "SqlParser.fs" +# 1009 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_joinOnClause in Microsoft.FSharp.Core.Operators.box ( ( -# 138 "SqlParser.fsp" +# 149 "SqlParser.fsp" _2, Inner, _3 ) -# 138 "SqlParser.fsp" +# 149 "SqlParser.fsp" : 'gentype_joinClause)); -# 962 "SqlParser.fs" +# 1021 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 141 "SqlParser.fsp" +# 152 "SqlParser.fsp" None ) -# 141 "SqlParser.fsp" +# 152 "SqlParser.fsp" : 'gentype_joinOnClause)); -# 972 "SqlParser.fs" +# 1031 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_conditionList in Microsoft.FSharp.Core.Operators.box ( ( -# 142 "SqlParser.fsp" +# 153 "SqlParser.fsp" Some(_2) ) -# 142 "SqlParser.fsp" +# 153 "SqlParser.fsp" : 'gentype_joinOnClause)); -# 983 "SqlParser.fs" +# 1042 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -988,12 +1047,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 145 "SqlParser.fsp" +# 156 "SqlParser.fsp" Cond(Value(_1), _2, Value(_3)) ) -# 145 "SqlParser.fsp" +# 156 "SqlParser.fsp" : 'gentype_conditionList)); -# 996 "SqlParser.fs" +# 1055 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1002,12 +1061,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 146 "SqlParser.fsp" +# 157 "SqlParser.fsp" And(Cond(Value(_1), _2, Value(_3)), _5) ) -# 146 "SqlParser.fsp" +# 157 "SqlParser.fsp" : 'gentype_conditionList)); -# 1010 "SqlParser.fs" +# 1069 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1016,12 +1075,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 147 "SqlParser.fsp" +# 158 "SqlParser.fsp" Or(Cond(Value(_1), _2, Value(_3)), _5) ) -# 147 "SqlParser.fsp" +# 158 "SqlParser.fsp" : 'gentype_conditionList)); -# 1024 "SqlParser.fs" +# 1083 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1029,12 +1088,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 148 "SqlParser.fsp" +# 159 "SqlParser.fsp" Cond(Value(_1), _2, FuncCall(_3)) ) -# 148 "SqlParser.fsp" +# 159 "SqlParser.fsp" : 'gentype_conditionList)); -# 1037 "SqlParser.fs" +# 1096 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1042,12 +1101,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 149 "SqlParser.fsp" +# 160 "SqlParser.fsp" Cond(FuncCall(_1), _2, Value(_3)) ) -# 149 "SqlParser.fsp" +# 160 "SqlParser.fsp" : 'gentype_conditionList)); -# 1050 "SqlParser.fs" +# 1109 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_value in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1056,12 +1115,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 150 "SqlParser.fsp" +# 161 "SqlParser.fsp" And(Cond(Value(_1), _2, FuncCall(_3)), _5) ) -# 150 "SqlParser.fsp" +# 161 "SqlParser.fsp" : 'gentype_conditionList)); -# 1064 "SqlParser.fs" +# 1123 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_funcCall in let _2 = parseState.GetInput(2) :?> 'gentype_op in @@ -1070,282 +1129,282 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 151 "SqlParser.fsp" +# 162 "SqlParser.fsp" Or(Cond(FuncCall(_1), _2, Value(_3)), _5) ) -# 151 "SqlParser.fsp" +# 162 "SqlParser.fsp" : 'gentype_conditionList)); -# 1078 "SqlParser.fs" +# 1137 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 155 "SqlParser.fsp" +# 166 "SqlParser.fsp" None ) -# 155 "SqlParser.fsp" +# 166 "SqlParser.fsp" : 'gentype_whereClause)); -# 1088 "SqlParser.fs" +# 1147 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> 'gentype_conditionList in Microsoft.FSharp.Core.Operators.box ( ( -# 156 "SqlParser.fsp" +# 167 "SqlParser.fsp" Some(_2) ) -# 156 "SqlParser.fsp" +# 167 "SqlParser.fsp" : 'gentype_whereClause)); -# 1099 "SqlParser.fs" +# 1158 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" Eq ) -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_op)); -# 1109 "SqlParser.fs" +# 1168 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" Lt ) -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_op)); -# 1119 "SqlParser.fs" +# 1178 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" Le ) -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_op)); -# 1129 "SqlParser.fs" +# 1188 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" Gt ) -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_op)); -# 1139 "SqlParser.fs" +# 1198 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" Ge ) -# 158 "SqlParser.fsp" +# 169 "SqlParser.fsp" : 'gentype_op)); -# 1149 "SqlParser.fs" +# 1208 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 161 "SqlParser.fsp" +# 172 "SqlParser.fsp" Int(_1) ) -# 161 "SqlParser.fsp" +# 172 "SqlParser.fsp" : 'gentype_value)); -# 1160 "SqlParser.fs" +# 1219 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> float in Microsoft.FSharp.Core.Operators.box ( ( -# 162 "SqlParser.fsp" +# 173 "SqlParser.fsp" Float(_1) ) -# 162 "SqlParser.fsp" +# 173 "SqlParser.fsp" : 'gentype_value)); -# 1171 "SqlParser.fs" +# 1230 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 163 "SqlParser.fsp" +# 174 "SqlParser.fsp" String(_2) ) -# 163 "SqlParser.fsp" +# 174 "SqlParser.fsp" : 'gentype_value)); -# 1182 "SqlParser.fs" +# 1241 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> float in Microsoft.FSharp.Core.Operators.box ( ( -# 164 "SqlParser.fsp" +# 175 "SqlParser.fsp" String(string _2) ) -# 164 "SqlParser.fsp" +# 175 "SqlParser.fsp" : 'gentype_value)); -# 1193 "SqlParser.fs" +# 1252 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _2 = parseState.GetInput(2) :?> int in Microsoft.FSharp.Core.Operators.box ( ( -# 165 "SqlParser.fsp" +# 176 "SqlParser.fsp" String(string _2) ) -# 165 "SqlParser.fsp" +# 176 "SqlParser.fsp" : 'gentype_value)); -# 1204 "SqlParser.fs" +# 1263 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 166 "SqlParser.fsp" +# 177 "SqlParser.fsp" Id(_1) ) -# 166 "SqlParser.fsp" +# 177 "SqlParser.fsp" : 'gentype_value)); -# 1215 "SqlParser.fs" +# 1274 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 170 "SqlParser.fsp" +# 181 "SqlParser.fsp" [] ) -# 170 "SqlParser.fsp" +# 181 "SqlParser.fsp" : 'gentype_groupByClause)); -# 1225 "SqlParser.fs" +# 1284 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> 'gentype_groupByList in Microsoft.FSharp.Core.Operators.box ( ( -# 171 "SqlParser.fsp" +# 182 "SqlParser.fsp" _3 ) -# 171 "SqlParser.fsp" +# 182 "SqlParser.fsp" : 'gentype_groupByClause)); -# 1236 "SqlParser.fs" +# 1295 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 174 "SqlParser.fsp" +# 185 "SqlParser.fsp" [_1] ) -# 174 "SqlParser.fsp" +# 185 "SqlParser.fsp" : 'gentype_groupByList)); -# 1247 "SqlParser.fs" +# 1306 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_groupByList in Microsoft.FSharp.Core.Operators.box ( ( -# 175 "SqlParser.fsp" +# 186 "SqlParser.fsp" _1 :: _3 ) -# 175 "SqlParser.fsp" +# 186 "SqlParser.fsp" : 'gentype_groupByList)); -# 1259 "SqlParser.fs" +# 1318 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> Microsoft.FSharp.Core.Operators.box ( ( -# 179 "SqlParser.fsp" +# 190 "SqlParser.fsp" [] ) -# 179 "SqlParser.fsp" +# 190 "SqlParser.fsp" : 'gentype_orderByClause)); -# 1269 "SqlParser.fs" +# 1328 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _3 = parseState.GetInput(3) :?> 'gentype_orderByList in Microsoft.FSharp.Core.Operators.box ( ( -# 180 "SqlParser.fsp" +# 191 "SqlParser.fsp" _3 ) -# 180 "SqlParser.fsp" +# 191 "SqlParser.fsp" : 'gentype_orderByClause)); -# 1280 "SqlParser.fs" +# 1339 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_orderBy in Microsoft.FSharp.Core.Operators.box ( ( -# 183 "SqlParser.fsp" +# 194 "SqlParser.fsp" [_1] ) -# 183 "SqlParser.fsp" +# 194 "SqlParser.fsp" : 'gentype_orderByList)); -# 1291 "SqlParser.fs" +# 1350 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> 'gentype_orderBy in let _3 = parseState.GetInput(3) :?> 'gentype_orderByList in Microsoft.FSharp.Core.Operators.box ( ( -# 184 "SqlParser.fsp" +# 195 "SqlParser.fsp" _1 :: _3 ) -# 184 "SqlParser.fsp" +# 195 "SqlParser.fsp" : 'gentype_orderByList)); -# 1303 "SqlParser.fs" +# 1362 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 187 "SqlParser.fsp" +# 198 "SqlParser.fsp" _1, Asc ) -# 187 "SqlParser.fsp" +# 198 "SqlParser.fsp" : 'gentype_orderBy)); -# 1314 "SqlParser.fs" +# 1373 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 188 "SqlParser.fsp" +# 199 "SqlParser.fsp" _1, Asc ) -# 188 "SqlParser.fsp" +# 199 "SqlParser.fsp" : 'gentype_orderBy)); -# 1325 "SqlParser.fs" +# 1384 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in Microsoft.FSharp.Core.Operators.box ( ( -# 189 "SqlParser.fsp" +# 200 "SqlParser.fsp" _1, Desc ) -# 189 "SqlParser.fsp" +# 200 "SqlParser.fsp" : 'gentype_orderBy)); -# 1336 "SqlParser.fs" +# 1395 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in Microsoft.FSharp.Core.Operators.box ( ( -# 192 "SqlParser.fsp" +# 203 "SqlParser.fsp" (_1, Args1(_3)) ) -# 192 "SqlParser.fsp" +# 203 "SqlParser.fsp" : 'gentype_funcCall)); -# 1348 "SqlParser.fs" +# 1407 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in @@ -1353,12 +1412,12 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 193 "SqlParser.fsp" +# 204 "SqlParser.fsp" (_1, Args2(_3, _5)) ) -# 193 "SqlParser.fsp" +# 204 "SqlParser.fsp" : 'gentype_funcCall)); -# 1361 "SqlParser.fs" +# 1420 "SqlParser.fs" (fun (parseState : FSharp.Text.Parsing.IParseState) -> let _1 = parseState.GetInput(1) :?> string in let _3 = parseState.GetInput(3) :?> 'gentype_value in @@ -1367,13 +1426,13 @@ let _fsyacc_reductions () = [| Microsoft.FSharp.Core.Operators.box ( ( -# 194 "SqlParser.fsp" +# 205 "SqlParser.fsp" (_1, Args3(_3, _5, _7)) ) -# 194 "SqlParser.fsp" +# 205 "SqlParser.fsp" : 'gentype_funcCall)); |] -# 1376 "SqlParser.fs" +# 1435 "SqlParser.fs" let tables : FSharp.Text.Parsing.Tables<_> = { reductions= _fsyacc_reductions (); endOfInputTag = _fsyacc_endOfInputTag; @@ -1392,7 +1451,7 @@ let tables : FSharp.Text.Parsing.Tables<_> = match parse_error_rich with | Some f -> f ctxt | None -> parse_error ctxt.Message); - numTerminals = 51; + numTerminals = 52; productionToNonTerminalTable = _fsyacc_productionToNonTerminalTable } let engine lexer lexbuf startState = tables.Interpret(lexer, lexbuf, startState) let startCT lexer lexbuf : Sql.DmlDdlSqlStatement = diff --git a/ParserLexerFSharp/SqlParser.fsi b/ParserLexerFSharp/SqlParser.fsi index e88fa84..9708c15 100644 --- a/ParserLexerFSharp/SqlParser.fsi +++ b/ParserLexerFSharp/SqlParser.fsi @@ -1,6 +1,7 @@ // Signature file for parser generated by fsyacc module SqlParser type token = + | CLUSTERED_INDEX | TOP | FILESYSTEM | VIDEO_CHUNKER @@ -50,6 +51,7 @@ type token = | INT of (int) | ID of (string) type tokenId = + | TOKEN_CLUSTERED_INDEX | TOKEN_TOP | TOKEN_FILESYSTEM | TOKEN_VIDEO_CHUNKER @@ -107,6 +109,8 @@ type nonTerminalId = | NONTERM_InsertStatement | NONTERM_valueList | NONTERM_CreateStatement + | NONTERM_indexClause + | NONTERM_indexColumnList | NONTERM_DropStatement | NONTERM_columnTypeList | NONTERM_columnType diff --git a/ParserLexerFSharp/SqlParser.fsp b/ParserLexerFSharp/SqlParser.fsp index 4acb1f8..e141248 100644 --- a/ParserLexerFSharp/SqlParser.fsp +++ b/ParserLexerFSharp/SqlParser.fsp @@ -29,6 +29,7 @@ open Sql %token STAR %token FILESYSTEM VIDEO_CHUNKER VIDEO_TO_IMAGE %token TOP +%token CLUSTERED_INDEX %start startCT %type startCT @@ -58,14 +59,24 @@ valueList: | valueList COMMA value { $3 :: $1 } CreateStatement: - TABLE ID OBRCK columnTypeList CBRCK + TABLE ID OBRCK columnTypeList CBRCK indexClause EOF { { Table = $2; ColumnList = List.rev $4 + ClusteredIndexList = $6 + // ClusteredIndexList = $6 } } +indexClause: + | { [] } + | CLUSTERED_INDEX OBRCK indexColumnList CBRCK { List.rev $3 } + +indexColumnList: + | ID { [$1] } + | indexColumnList COMMA ID { $3 :: $1 } + DropStatement: | TABLE ID { $2 } diff --git a/QueryProcessing/Builders/FilterStatementBuilder.cs b/QueryProcessing/Builders/FilterStatementBuilder.cs index 692ecbd..d662dbe 100644 --- a/QueryProcessing/Builders/FilterStatementBuilder.cs +++ b/QueryProcessing/Builders/FilterStatementBuilder.cs @@ -2,7 +2,6 @@ using Microsoft.FSharp.Core; using PageManager; using System; -using System.Diagnostics; using System.Threading.Tasks; namespace QueryProcessing diff --git a/QueryProcessing/PhyOperators/IPhyOpSeek.cs b/QueryProcessing/PhyOperators/IPhyOpSeek.cs new file mode 100644 index 0000000..8910407 --- /dev/null +++ b/QueryProcessing/PhyOperators/IPhyOpSeek.cs @@ -0,0 +1,95 @@ +using DataStructures; +using MetadataManager; +using PageManager; +using System; +using System.Collections.Generic; + +namespace QueryProcessing.PhyOperators +{ + public class PhyOpSeek: IPhysicalOperator + { + private readonly IPageCollection source; + private readonly ITransaction tran; + private readonly MetadataColumn[] scanColumnInfo; + private readonly string collectionName; + private readonly IEnumerable seekValues; + private readonly PhyOpSeekCreator seekCreator; + private readonly ColumnType seekColumnType; + + + public MetadataColumn[] GetOutputColumns() => this.scanColumnInfo; + + public PhyOpSeek(IPageCollection collection, ITransaction tran, MetadataColumn[] columnInfo, string collectionName, IEnumerable seekValues, ColumnType seekColumnType) + { + this.source = collection; + this.tran = tran; + this.collectionName = collectionName; + + this.scanColumnInfo = new MetadataColumn[columnInfo.Length]; + for (int i = 0; i < scanColumnInfo.Length; i++) + { + this.scanColumnInfo[i] = new MetadataColumn( + scanColumnInfo[i].ColumnId, + scanColumnInfo[i].TableId, + collectionName + "." + scanColumnInfo[i].ColumnName, + scanColumnInfo[i].ColumnType); + } + + this.seekValues = seekValues; + this.seekCreator = new PhyOpSeekCreator() + { + Source = this.source, + Tran = this.tran, + SeekValues = this.seekValues + }; + + this.seekColumnType = seekColumnType; + } + + public async IAsyncEnumerable Iterate(ITransaction tran) + { + IAsyncEnumerable seekResults = ColumnTypeHandlerRouter>.Route( + this.seekCreator, + this.seekColumnType); + await foreach (RowHolder rowHolder in seekResults) + { + yield return rowHolder; + } + } + } + + public class PhyOpSeekCreator : ColumnTypeHandlerBasicSingle> + { + public IPageCollection Source { get; init; } + public ITransaction Tran { get; init; } + public IEnumerable SeekValues { get; init; } + + public async IAsyncEnumerable HandleDouble() + { + foreach (RowHolder seekVal in SeekValues) + { + await foreach (RowHolder rh in Source.Seek(seekVal.GetField(0), Tran)) + { + yield return rh; + } + } + } + + public async IAsyncEnumerable HandleInt() + { + foreach (RowHolder seekVal in SeekValues) + { + await foreach (RowHolder rh in Source.Seek(seekVal.GetField(0), Tran)) + { + yield return rh; + } + } + } + + public IAsyncEnumerable HandleString() + { + // For strings need to change btee seek signature. + throw new NotImplementedException(); + } + } +} diff --git a/QueryProcessing/Statements/CreateTableStatement.cs b/QueryProcessing/Statements/CreateTableStatement.cs index 2fa8200..7a5843d 100644 --- a/QueryProcessing/Statements/CreateTableStatement.cs +++ b/QueryProcessing/Statements/CreateTableStatement.cs @@ -1,7 +1,6 @@ using MetadataManager; using PageManager; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -30,6 +29,7 @@ public async Task BuildTree(Sql.DmlDdlSqlStatement statement, ITran Sql.DmlDdlSqlStatement.Create createStatement = (Sql.DmlDdlSqlStatement.Create)statement; string tableName = createStatement.Item.Table; var columns = createStatement.Item.ColumnList.ToList(); + string[] clusteredIndexes = createStatement.Item.ClusteredIndexList.ToArray(); MetadataTablesManager tableManager = this.metadataManager.GetTableManager(); @@ -58,6 +58,25 @@ public async Task BuildTree(Sql.DmlDdlSqlStatement statement, ITran else throw new ArgumentException(); }).ToArray(); + int[] clusteredIndexPositions = new int[clusteredIndexes.Length]; + int posIndex = 0; + foreach (string clusteredIndexName in clusteredIndexes) + { + int posColumn = 0; + foreach (string columnName in tableCreateDefinition.ColumnNames) + { + if (columnName == clusteredIndexName) + { + clusteredIndexPositions[posIndex] = posColumn; + } + posColumn++; + } + + posIndex++; + } + + tableCreateDefinition.ClusteredIndexPositions = clusteredIndexPositions; + await tableManager.CreateObject(tableCreateDefinition, tran).ConfigureAwait(false); return new RowProvider(TaskExtension.EmptyEnumerable(), new MetadataColumn[0]); diff --git a/tests/E2EQueryExecutionTests/SimpleE2ETests.cs b/tests/E2EQueryExecutionTests/SimpleE2ETests.cs index 1a06b2b..b105a3e 100644 --- a/tests/E2EQueryExecutionTests/SimpleE2ETests.cs +++ b/tests/E2EQueryExecutionTests/SimpleE2ETests.cs @@ -1,3 +1,4 @@ +using MetadataManager; using NUnit.Framework; using PageManager; using PageManager.Exceptions; @@ -27,6 +28,29 @@ public async Task CreateTableE2E() await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); await tran.Commit(); } + + await using (ITransaction tran = this.logManager.CreateTransaction(this.pageManager, "GET_TABLE")) + { + MetadataTable mdT = await this.metadataManager.GetTableManager().GetByName("MyTable", tran); + Assert.IsFalse(mdT.Collection.SupportsSeek()); + } + } + + [Test] + public async Task CreateTableWithIndex() + { + string query = @"CREATE TABLE MyTable (TYPE_INT a, TYPE_DOUBLE b, TYPE_STRING(10) c) CLUSTERED_INDEX(a)"; + await using (ITransaction tran = this.logManager.CreateTransaction(this.pageManager, "CREATE_TABLE")) + { + await this.queryEntryGate.Execute(query, tran).ToArrayAsync(); + await tran.Commit(); + } + + await using (ITransaction tran = this.logManager.CreateTransaction(this.pageManager, "GET_TABLE")) + { + MetadataTable mdT = await this.metadataManager.GetTableManager().GetByName("MyTable", tran); + Assert.IsTrue(mdT.Collection.SupportsSeek()); + } } [Test] diff --git a/tests/MetadataManagerTests/TableManagerTests.cs b/tests/MetadataManagerTests/TableManagerTests.cs index 8bcadb7..3befe64 100644 --- a/tests/MetadataManagerTests/TableManagerTests.cs +++ b/tests/MetadataManagerTests/TableManagerTests.cs @@ -30,7 +30,8 @@ public async Task CreateTable() { TableName = "A", ColumnNames = new[] { "a", "b", "c" }, - ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) } + ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) }, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); @@ -55,6 +56,8 @@ public async Task CreateTable() { Assert.Contains(c.ColumnName.ToString(), new[] { "a", "b", "c" }); } + + Assert.IsFalse(table.Collection.SupportsSeek()); } [Test] @@ -77,7 +80,8 @@ public async Task CreateMultiTable() { TableName = "T" + i, ColumnNames = new[] { "a", "b", "c" }, - ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) } + ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) }, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); } @@ -108,7 +112,8 @@ public async Task CreateWithSameName() { TableName = "A", ColumnNames = new[] { "a", "b", "c" }, - ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) } + ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) }, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); @@ -119,9 +124,55 @@ await tm.CreateObject(new TableCreateDefinition() { TableName = "A", ColumnNames = new[] { "a" }, - ColumnTypes = new[] { new ColumnInfo(ColumnType.Int) } + ColumnTypes = new[] { new ColumnInfo(ColumnType.Int) }, + ClusteredIndexPositions = new int[] { } }, tran); }); } + + [Test] + public async Task CreateTableWithClusteredIndex() + { + var allocator = new PageManager.PageManager(4096, TestGlobals.DefaultEviction, TestGlobals.DefaultPersistedStream); + ILogManager logManager = new LogManager.LogManager(new BinaryWriter(new MemoryStream())); + ITransaction setupTran = logManager.CreateTransaction(allocator); + StringHeapCollection stringHeap = new StringHeapCollection(allocator, setupTran); + var mm = new MetadataManager.MetadataManager(allocator, stringHeap, allocator, logManager); + + var tm = mm.GetTableManager(); + ITransaction tran = logManager.CreateTransaction(allocator); + int objId = await tm.CreateObject(new TableCreateDefinition() + { + TableName = "A", + ColumnNames = new[] { "a", "b", "c" }, + ColumnTypes = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.StringPointer), new ColumnInfo(ColumnType.Double) }, + ClusteredIndexPositions = new int[] { 2 } + }, tran); + await tran.Commit(); + + tran = logManager.CreateTransaction(allocator); + + Assert.True(await tm.Exists(new TableCreateDefinition() + { + TableName = "A", + }, tran)); + + MetadataTable table = await tm.GetById(objId, tran); + Assert.AreEqual("A", table.TableName); + + Assert.AreEqual(new[] { "a", "b", "c" }, table.Columns.Select(t => t.ColumnName)); + Assert.AreEqual(new[] { ColumnType.Int, ColumnType.StringPointer, ColumnType.Double }, table.Columns.Select(c => c.ColumnType.ColumnType)); + Assert.AreEqual(new[] { -1, -1, 0 }, table.Columns.Select(t => t.ClusteredIndexPart)); + + var cm = mm.GetColumnManager(); + + tran = logManager.CreateTransaction(allocator); + await foreach (var c in cm.Iterate(tran)) + { + Assert.Contains(c.ColumnName.ToString(), new[] { "a", "b", "c" }); + } + + Assert.IsTrue(table.Collection.SupportsSeek()); + } } } diff --git a/tests/PageManagerTests/UtilClasses.cs b/tests/PageManagerTests/UtilClasses.cs index 6150990..af06739 100644 --- a/tests/PageManagerTests/UtilClasses.cs +++ b/tests/PageManagerTests/UtilClasses.cs @@ -1,4 +1,5 @@ using NUnit.Framework; +using PageManager; using PageManager.UtilStructures; using System; @@ -40,5 +41,35 @@ public void ArrayShiftRight() Assert.AreEqual(mem.ToArray(), new byte[] { 1, 1, 2, 4 }); } + + [Test] + public void CharrArrayEq() + { + string abc = "abcd"; + CharrArray cr = new CharrArray(abc.ToCharArray()); + + Assert.AreEqual(0, cr.CompareToString(abc)); + Assert.AreEqual(0, CharrArray.Compare(abc.ToCharArray(), abc)); + } + + [Test] + public void CharrArrayBigger() + { + string abc = "abcd"; + CharrArray cr = new CharrArray(abc.ToCharArray()); + + Assert.AreEqual(1, cr.CompareToString("aaaa")); + Assert.AreEqual(1, CharrArray.Compare(abc, "aaaa")); + } + + [Test] + public void CharrArraySmaller() + { + string abc = "abcd"; + CharrArray cr = new CharrArray(abc.ToCharArray()); + + Assert.AreEqual(-1, cr.CompareToString("abcf")); + Assert.AreEqual(-1, CharrArray.Compare(abc, "abcf")); + } } } diff --git a/tests/ParserLexerTests/ParserTests.cs b/tests/ParserLexerTests/ParserTests.cs index cff9c9b..5eca587 100644 --- a/tests/ParserLexerTests/ParserTests.cs +++ b/tests/ParserLexerTests/ParserTests.cs @@ -87,6 +87,23 @@ public void CreateTableTest() Assert.AreEqual(new string[] { "A", "B", "C" }, createStatement.ColumnList.Select(cl => cl.Item3).ToArray()); } + [Test] + public void CreateTableWithIndexTest() + { + string query = "CREATE TABLE mytable (TYPE_INT A, TYPE_INT B, TYPE_STRING(10) C) CLUSTERED_INDEX (A, C)"; + + var createStatement = GetCreateTableStatement(query); + + Assert.AreEqual("mytable", createStatement.Table); + Assert.IsTrue(createStatement.ColumnList[0].Item1.IsIntCType); + Assert.IsTrue(createStatement.ColumnList[1].Item1.IsIntCType); + Assert.IsTrue(createStatement.ColumnList[2].Item1.IsStringCType); + Assert.AreEqual(10, createStatement.ColumnList[2].Item2); + Assert.AreEqual(new string[] { "A", "B", "C" }, createStatement.ColumnList.Select(cl => cl.Item3).ToArray()); + + Assert.AreEqual(new string[] { "A", "C", }, createStatement.ClusteredIndexList.ToArray()); + } + [Test] public void InsertStatementTests() { diff --git a/tests/QueryProcessingTests/PhyOpFilterTests.cs b/tests/QueryProcessingTests/PhyOpFilterTests.cs index aad0514..85f9c78 100644 --- a/tests/QueryProcessingTests/PhyOpFilterTests.cs +++ b/tests/QueryProcessingTests/PhyOpFilterTests.cs @@ -40,6 +40,7 @@ public async Task Setup() TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, ColumnTypes = columnInfos, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); diff --git a/tests/QueryProcessingTests/PhyOpGroupByTests.cs b/tests/QueryProcessingTests/PhyOpGroupByTests.cs index 5aacd74..4cfbd3e 100644 --- a/tests/QueryProcessingTests/PhyOpGroupByTests.cs +++ b/tests/QueryProcessingTests/PhyOpGroupByTests.cs @@ -38,7 +38,8 @@ public async Task Setup() { TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, - ColumnTypes = columnInfos, + ColumnTypes = columnInfos, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); diff --git a/tests/QueryProcessingTests/PhyOpInsertTests.cs b/tests/QueryProcessingTests/PhyOpInsertTests.cs index b6c7643..ac808b5 100644 --- a/tests/QueryProcessingTests/PhyOpInsertTests.cs +++ b/tests/QueryProcessingTests/PhyOpInsertTests.cs @@ -30,6 +30,7 @@ public async Task ValidateInsert() TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, ColumnTypes = columnTypes, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); diff --git a/tests/QueryProcessingTests/PhyOpOrderByTests.cs b/tests/QueryProcessingTests/PhyOpOrderByTests.cs index ad9ec1b..2c66704 100644 --- a/tests/QueryProcessingTests/PhyOpOrderByTests.cs +++ b/tests/QueryProcessingTests/PhyOpOrderByTests.cs @@ -46,6 +46,7 @@ public async Task Setup() TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, ColumnTypes = columnInfos, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); diff --git a/tests/QueryProcessingTests/PhyOpProjectTests.cs b/tests/QueryProcessingTests/PhyOpProjectTests.cs index c2e83ad..023b2ff 100644 --- a/tests/QueryProcessingTests/PhyOpProjectTests.cs +++ b/tests/QueryProcessingTests/PhyOpProjectTests.cs @@ -39,6 +39,7 @@ public async Task Setup() TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, ColumnTypes = columnInfos, + ClusteredIndexPositions = new int[] { } }, tran); await tran.Commit(); diff --git a/tests/QueryProcessingTests/PhyOpScanTests.cs b/tests/QueryProcessingTests/PhyOpScanTests.cs index 1aa9d0c..4f200eb 100644 --- a/tests/QueryProcessingTests/PhyOpScanTests.cs +++ b/tests/QueryProcessingTests/PhyOpScanTests.cs @@ -13,8 +13,18 @@ namespace QueryProcessingTests { public class PhyOpScanTests { + public enum IndexState + { + NoIndex, + IndexCol0, + IndexCol2, + } + [Test] - public async Task ValidateScan() + [TestCase(IndexState.NoIndex)] + [TestCase(IndexState.IndexCol0)] + [TestCase(IndexState.IndexCol2)] + public async Task ValidateScan(IndexState indexState) { var allocator = new PageManager.PageManager(4096, TestGlobals.DefaultEviction, TestGlobals.DefaultPersistedStream); ILogManager logManager = new LogManager.LogManager(new BinaryWriter(new MemoryStream())); @@ -23,6 +33,23 @@ public async Task ValidateScan() MetadataManager.MetadataManager mm = new MetadataManager.MetadataManager(allocator, stringHeap, allocator, logManager); var tm = mm.GetTableManager(); + int[] clusteredIndexPosition = null; + + switch (indexState) + { + case IndexState.NoIndex: + clusteredIndexPosition = new int[0]; + break; + case IndexState.IndexCol0: + clusteredIndexPosition = new int[] { 0 }; + break; + case IndexState.IndexCol2: + clusteredIndexPosition = new int[] { 2 }; + break; + default: + Assert.Fail(); + break; + } ITransaction tran = logManager.CreateTransaction(allocator); var columnInfos = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.String, 1), new ColumnInfo(ColumnType.Double) }; @@ -31,6 +58,7 @@ public async Task ValidateScan() TableName = "Table", ColumnNames = new[] { "a", "b", "c" }, ColumnTypes = columnInfos, + ClusteredIndexPositions = clusteredIndexPosition, }, tran); await tran.Commit(); @@ -57,8 +85,7 @@ public async Task ValidateScan() await tran.Commit(); tran = logManager.CreateTransaction(allocator); - PageListCollection pcl = new PageListCollection(allocator, columnInfos, table.RootPage); - PhyOpScan scan = new PhyOpScan(pcl, tran, table.Columns, "Table"); + PhyOpScan scan = new PhyOpScan(table.Collection, tran, table.Columns, "Table"); List result = new List(); diff --git a/tests/QueryProcessingTests/PhyOpSeekTests.cs b/tests/QueryProcessingTests/PhyOpSeekTests.cs new file mode 100644 index 0000000..d4d28b9 --- /dev/null +++ b/tests/QueryProcessingTests/PhyOpSeekTests.cs @@ -0,0 +1,115 @@ +using DataStructures; +using LogManager; +using MetadataManager; +using NUnit.Framework; +using PageManager; +using QueryProcessing; +using QueryProcessing.PhyOperators; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using Test.Common; + +namespace QueryProcessingTests +{ + public class PhyOpSeekTests + { + [Test] + [TestCase(0)] + [TestCase(2)] + public async Task ValidateSeek(int clusteredIndexPosition) + { + var allocator = new PageManager.PageManager(4096, TestGlobals.DefaultEviction, TestGlobals.DefaultPersistedStream); + ILogManager logManager = new LogManager.LogManager(new BinaryWriter(new MemoryStream())); + ITransaction setupTran = logManager.CreateTransaction(allocator); + StringHeapCollection stringHeap = new StringHeapCollection(allocator, setupTran); + MetadataManager.MetadataManager mm = new MetadataManager.MetadataManager(allocator, stringHeap, allocator, logManager); + + var tm = mm.GetTableManager(); + + + ITransaction tran = logManager.CreateTransaction(allocator); + var columnInfos = new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.String, 1), new ColumnInfo(ColumnType.Double) }; + int id = await tm.CreateObject(new TableCreateDefinition() + { + TableName = "Table", + ColumnNames = new[] { "a", "b", "c" }, + ColumnTypes = columnInfos, + ClusteredIndexPositions = new int[] { clusteredIndexPosition }, + }, tran); + + await tran.Commit(); + + tran = logManager.CreateTransaction(allocator); + var table = await tm.GetById(id, tran); + await tran.Commit(); + + List source = new List(); + for (int i = 0; i < 5; i++) + { + var rhf = new RowHolder(new[] { new ColumnInfo(ColumnType.Int), new ColumnInfo(ColumnType.String, 1), new ColumnInfo(ColumnType.Double) }); + rhf.SetField(0, i); + rhf.SetField(1, i.ToString().ToCharArray()); + rhf.SetField(2, i + 1.1); + source.Add(rhf); + } + + PhyOpStaticRowProvider opStatic = new PhyOpStaticRowProvider(source); + + tran = logManager.CreateTransaction(allocator); + PhyOpTableInsert op = new PhyOpTableInsert(table.Collection, opStatic); + await op.Iterate(tran).AllResultsAsync(); + await tran.Commit(); + + tran = logManager.CreateTransaction(allocator); + List seekValues = new List(); + + var rowSeekSchema = new ColumnInfo[1]; + + if (clusteredIndexPosition == 0) + { + rowSeekSchema[0] = new ColumnInfo(ColumnType.Int); + } + else + { + rowSeekSchema[0] = new ColumnInfo(ColumnType.Double); + } + + for (int i = 0; i < 5; i++) + { + RowHolder rh = new RowHolder(rowSeekSchema); + if (clusteredIndexPosition == 0) + { + rh.SetField(0, i); + } + else + { + rh.SetField(0, i + 1.1); + } + + seekValues.Add(rh); + } + + PhyOpSeek seek = null; + if (clusteredIndexPosition == 0) + { + seek = new PhyOpSeek(table.Collection, tran, table.Columns, "Table", seekValues, ColumnType.Int); + } + else + { + seek = new PhyOpSeek(table.Collection, tran, table.Columns, "Table", seekValues, ColumnType.Double); + } + + + List result = new List(); + + await foreach (var row in seek.Iterate(tran)) + { + result.Add(row); + } + + Assert.AreEqual(source, result.ToArray()); + + } + } +}