github.com/matrixorigin/matrixone@v0.7.0/pkg/testutil/testengine/testdata.go (about)

     1  // Copyright 2022 Matrix Origin
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  // http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package testengine
    16  
    17  import (
    18  	"context"
    19  	"fmt"
    20  	"log"
    21  
    22  	"github.com/matrixorigin/matrixone/pkg/compress"
    23  	"github.com/matrixorigin/matrixone/pkg/container/batch"
    24  	"github.com/matrixorigin/matrixone/pkg/container/types"
    25  	"github.com/matrixorigin/matrixone/pkg/container/vector"
    26  	"github.com/matrixorigin/matrixone/pkg/testutil"
    27  	"github.com/matrixorigin/matrixone/pkg/vm/engine"
    28  )
    29  
    30  var testEngineMp = testutil.TestUtilMp
    31  
    32  func CreateR(db engine.Database) {
    33  	ctx := context.TODO()
    34  	{
    35  		var attrs []engine.TableDef
    36  
    37  		{
    38  			attrs = append(attrs, &engine.AttributeDef{
    39  				Attr: engine.Attribute{
    40  					Alg:  compress.Lz4,
    41  					Name: "orderid",
    42  					Type: types.Type{
    43  						Size:  24,
    44  						Width: 10,
    45  						Oid:   types.T(types.T_varchar),
    46  					},
    47  				}})
    48  			attrs = append(attrs, &engine.AttributeDef{
    49  				Attr: engine.Attribute{
    50  					Alg:  compress.Lz4,
    51  					Name: "uid",
    52  					Type: types.Type{
    53  						Size: 4,
    54  						Oid:  types.T(types.T_uint32),
    55  					},
    56  				}})
    57  			attrs = append(attrs, &engine.AttributeDef{
    58  				Attr: engine.Attribute{
    59  					Alg:  compress.Lz4,
    60  					Name: "price",
    61  					Type: types.Type{
    62  						Size: 8,
    63  						Oid:  types.T(types.T_float64),
    64  					},
    65  				}})
    66  		}
    67  		if err := db.Create(ctx, "r", attrs); err != nil {
    68  			log.Fatal(err)
    69  		}
    70  	}
    71  	r, err := db.Relation(ctx, "r")
    72  	if err != nil {
    73  		log.Fatal(err)
    74  	}
    75  	{
    76  		bat := batch.New(true, []string{"orderid", "uid", "price"})
    77  		{
    78  			{
    79  				vec := vector.New(types.Type{
    80  					Size: 24,
    81  					Oid:  types.T(types.T_varchar),
    82  				})
    83  				vs := make([][]byte, 10)
    84  				for i := 0; i < 10; i++ {
    85  					vs[i] = []byte(fmt.Sprintf("%v", i))
    86  				}
    87  				// XXX MPOOL
    88  				if err := vector.AppendBytes(vec, vs, testEngineMp); err != nil {
    89  					log.Fatal(err)
    90  				}
    91  				bat.Vecs[0] = vec
    92  			}
    93  			{
    94  				vec := vector.New(types.Type{
    95  					Size: 4,
    96  					Oid:  types.T(types.T_uint32),
    97  				})
    98  				vs := make([]uint32, 10)
    99  				for i := 0; i < 10; i++ {
   100  					vs[i] = uint32(i % 4)
   101  				}
   102  				if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   103  					log.Fatal(err)
   104  				}
   105  				bat.Vecs[1] = vec
   106  			}
   107  			{
   108  				vec := vector.New(types.Type{
   109  					Size: 8,
   110  					Oid:  types.T(types.T_float64),
   111  				})
   112  				vs := make([]float64, 10)
   113  				for i := 0; i < 10; i++ {
   114  					vs[i] = float64(i)
   115  				}
   116  				if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   117  					log.Fatal(err)
   118  				}
   119  				bat.Vecs[2] = vec
   120  			}
   121  		}
   122  		if err := r.Write(ctx, bat); err != nil {
   123  			log.Fatal(err)
   124  		}
   125  	}
   126  	{
   127  		bat := batch.New(true, []string{"orderid", "uid", "price"})
   128  		{
   129  			vec := vector.New(types.Type{
   130  				Size: 24,
   131  				Oid:  types.T(types.T_varchar),
   132  			})
   133  			vs := make([][]byte, 10)
   134  			for i := 10; i < 20; i++ {
   135  				vs[i-10] = []byte(fmt.Sprintf("%v", i))
   136  			}
   137  			if err := vector.AppendBytes(vec, vs, testEngineMp); err != nil {
   138  				log.Fatal(err)
   139  			}
   140  			bat.Vecs[0] = vec
   141  		}
   142  		{
   143  			vec := vector.New(types.Type{
   144  				Size: 4,
   145  				Oid:  types.T(types.T_uint32),
   146  			})
   147  			vs := make([]uint32, 10)
   148  			for i := 10; i < 20; i++ {
   149  				vs[i-10] = uint32(i % 4)
   150  			}
   151  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   152  				log.Fatal(err)
   153  			}
   154  			bat.Vecs[1] = vec
   155  		}
   156  		{
   157  			vec := vector.New(types.Type{
   158  				Size: 8,
   159  				Oid:  types.T(types.T_float64),
   160  			})
   161  			vs := make([]float64, 10)
   162  			for i := 10; i < 20; i++ {
   163  				vs[i-10] = float64(i)
   164  			}
   165  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   166  				log.Fatal(err)
   167  			}
   168  			bat.Vecs[2] = vec
   169  		}
   170  		if err := r.Write(ctx, bat); err != nil {
   171  			log.Fatal(err)
   172  		}
   173  	}
   174  }
   175  
   176  func CreateS(db engine.Database) {
   177  	ctx := context.TODO()
   178  	{
   179  		var attrs []engine.TableDef
   180  
   181  		{
   182  			attrs = append(attrs, &engine.AttributeDef{
   183  				Attr: engine.Attribute{
   184  					Alg:  compress.Lz4,
   185  					Name: "orderid",
   186  					Type: types.Type{
   187  						Size:  24,
   188  						Width: 10,
   189  						Oid:   types.T(types.T_varchar),
   190  					},
   191  				}})
   192  			attrs = append(attrs, &engine.AttributeDef{
   193  				Attr: engine.Attribute{
   194  					Alg:  compress.Lz4,
   195  					Name: "uid",
   196  					Type: types.Type{
   197  						Size: 4,
   198  						Oid:  types.T(types.T_uint32),
   199  					},
   200  				}})
   201  			attrs = append(attrs, &engine.AttributeDef{
   202  				Attr: engine.Attribute{
   203  					Alg:  compress.Lz4,
   204  					Name: "price",
   205  					Type: types.Type{
   206  						Size: 8,
   207  						Oid:  types.T(types.T_float64),
   208  					},
   209  				}})
   210  		}
   211  		if err := db.Create(ctx, "s", attrs); err != nil {
   212  			log.Fatal(err)
   213  		}
   214  	}
   215  	r, err := db.Relation(ctx, "s")
   216  	if err != nil {
   217  		log.Fatal(err)
   218  	}
   219  	{
   220  		bat := batch.New(true, []string{"orderid", "uid", "price"})
   221  		{
   222  			{
   223  				vec := vector.New(types.Type{
   224  					Size: 24,
   225  					Oid:  types.T(types.T_varchar),
   226  				})
   227  				vs := make([][]byte, 10)
   228  				for i := 0; i < 10; i++ {
   229  					vs[i] = []byte(fmt.Sprintf("%v", i*2))
   230  				}
   231  				if err := vector.AppendBytes(vec, vs, testEngineMp); err != nil {
   232  					log.Fatal(err)
   233  				}
   234  				bat.Vecs[0] = vec
   235  			}
   236  			{
   237  				vec := vector.New(types.Type{
   238  					Size: 4,
   239  					Oid:  types.T(types.T_uint32),
   240  				})
   241  				vs := make([]uint32, 10)
   242  				for i := 0; i < 10; i++ {
   243  					vs[i] = uint32(i % 2)
   244  				}
   245  				if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   246  					log.Fatal(err)
   247  				}
   248  				bat.Vecs[1] = vec
   249  			}
   250  			{
   251  				vec := vector.New(types.Type{
   252  					Size: 8,
   253  					Oid:  types.T(types.T_float64),
   254  				})
   255  				vs := make([]float64, 10)
   256  				for i := 0; i < 10; i++ {
   257  					vs[i] = float64(i)
   258  				}
   259  				if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   260  					log.Fatal(err)
   261  				}
   262  				bat.Vecs[2] = vec
   263  			}
   264  		}
   265  		if err := r.Write(ctx, bat); err != nil {
   266  			log.Fatal(err)
   267  		}
   268  	}
   269  	{
   270  		bat := batch.New(true, []string{"orderid", "uid", "price"})
   271  		{
   272  			vec := vector.New(types.Type{
   273  				Size: 24,
   274  				Oid:  types.T(types.T_varchar),
   275  			})
   276  			vs := make([][]byte, 10)
   277  			for i := 10; i < 20; i++ {
   278  				vs[i-10] = []byte(fmt.Sprintf("%v", i*2))
   279  			}
   280  			if err := vector.AppendBytes(vec, vs, testEngineMp); err != nil {
   281  				log.Fatal(err)
   282  			}
   283  			bat.Vecs[0] = vec
   284  		}
   285  		{
   286  			vec := vector.New(types.Type{
   287  				Size: 4,
   288  				Oid:  types.T(types.T_uint32),
   289  			})
   290  			vs := make([]uint32, 10)
   291  			for i := 10; i < 20; i++ {
   292  				vs[i-10] = uint32(i % 2)
   293  			}
   294  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   295  				log.Fatal(err)
   296  			}
   297  			bat.Vecs[1] = vec
   298  		}
   299  		{
   300  			vec := vector.New(types.Type{
   301  				Size: 8,
   302  				Oid:  types.T(types.T_float64),
   303  			})
   304  			vs := make([]float64, 10)
   305  			for i := 10; i < 20; i++ {
   306  				vs[i-10] = float64(i)
   307  			}
   308  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   309  				log.Fatal(err)
   310  			}
   311  			bat.Vecs[2] = vec
   312  		}
   313  		if err := r.Write(ctx, bat); err != nil {
   314  			log.Fatal(err)
   315  		}
   316  	}
   317  }
   318  
   319  func CreateT(db engine.Database) {
   320  	ctx := context.TODO()
   321  	{
   322  		var attrs []engine.TableDef
   323  
   324  		{
   325  			attrs = append(attrs, &engine.AttributeDef{
   326  				Attr: engine.Attribute{
   327  					Alg:  compress.Lz4,
   328  					Name: "id",
   329  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   330  				}})
   331  			attrs = append(attrs, &engine.AttributeDef{
   332  				Attr: engine.Attribute{
   333  					Alg:  compress.Lz4,
   334  					Name: "price",
   335  					Type: types.Type{Oid: types.T(types.T_float64), Size: 8, Width: 8, Precision: 0},
   336  				}})
   337  		}
   338  		if err := db.Create(ctx, "t", attrs); err != nil {
   339  			log.Fatal(err)
   340  		}
   341  	}
   342  
   343  }
   344  
   345  func CreateT1(db engine.Database) {
   346  	ctx := context.TODO()
   347  	{
   348  		var attrs []engine.TableDef
   349  
   350  		{
   351  			attrs = append(attrs, &engine.AttributeDef{
   352  				Attr: engine.Attribute{
   353  					Alg:  compress.Lz4,
   354  					Name: "spid",
   355  					Type: types.Type{Oid: types.T(types.T_int32), Size: 8, Width: 0, Precision: 0},
   356  				}})
   357  			attrs = append(attrs, &engine.AttributeDef{
   358  				Attr: engine.Attribute{
   359  					Alg:  compress.Lz4,
   360  					Name: "userid",
   361  					Type: types.Type{Oid: types.T(types.T_int32), Size: 4, Width: 0, Precision: 0},
   362  				}})
   363  			attrs = append(attrs, &engine.AttributeDef{
   364  				Attr: engine.Attribute{
   365  					Alg:  compress.Lz4,
   366  					Name: "score",
   367  					Type: types.Type{Oid: types.T(types.T_int8), Size: 1, Width: 8, Precision: 0},
   368  				}})
   369  		}
   370  		if err := db.Create(ctx, "t1", attrs); err != nil {
   371  			log.Fatal(err)
   372  		}
   373  	}
   374  	r, err := db.Relation(ctx, "t1")
   375  	if err != nil {
   376  		log.Fatal(err)
   377  	}
   378  	{
   379  		bat := batch.New(true, []string{"spid", "userid", "score"})
   380  		{
   381  			vec := vector.New(types.Type{Oid: types.T(types.T_int32), Size: 4, Width: 4, Precision: 0})
   382  			vs := make([]int32, 5)
   383  			vs[0] = 1
   384  			vs[1] = 2
   385  			vs[2] = 2
   386  			vs[3] = 3
   387  			vs[4] = 1
   388  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   389  				log.Fatal(err)
   390  			}
   391  			bat.Vecs[0] = vec
   392  		}
   393  		{
   394  			vec := vector.New(types.Type{Oid: types.T(types.T_int32), Size: 4, Width: 4, Precision: 0})
   395  			vs := make([]int32, 5)
   396  			vs[0] = 1
   397  			vs[1] = 2
   398  			vs[2] = 1
   399  			vs[3] = 3
   400  			vs[4] = 1
   401  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   402  				log.Fatal(err)
   403  			}
   404  			bat.Vecs[1] = vec
   405  		}
   406  		{
   407  			vec := vector.New(types.Type{Oid: types.T(types.T_int8), Size: 1, Width: 1, Precision: 0})
   408  			vs := make([]int8, 5)
   409  			vs[0] = 1
   410  			vs[1] = 2
   411  			vs[2] = 4
   412  			vs[3] = 3
   413  			vs[4] = 5
   414  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   415  				log.Fatal(err)
   416  			}
   417  			bat.Vecs[2] = vec
   418  		}
   419  		if err := r.Write(ctx, bat); err != nil {
   420  			log.Fatal(err)
   421  		}
   422  	}
   423  	{
   424  		bat := batch.New(true, []string{"spid", "userid", "score"})
   425  		{
   426  			vec := vector.New(types.Type{Oid: types.T(types.T_int32), Size: 4, Width: 4, Precision: 0})
   427  			vs := make([]int32, 2)
   428  			vs[0] = 4
   429  			vs[1] = 5
   430  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   431  				log.Fatal(err)
   432  			}
   433  			bat.Vecs[0] = vec
   434  		}
   435  		{
   436  			vec := vector.New(types.Type{Oid: types.T(types.T_int32), Size: 4, Width: 4, Precision: 0})
   437  			vs := make([]int32, 2)
   438  			vs[0] = 6
   439  			vs[1] = 11
   440  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   441  				log.Fatal(err)
   442  			}
   443  			bat.Vecs[1] = vec
   444  		}
   445  		{
   446  			vec := vector.New(types.Type{Oid: types.T(types.T_int8), Size: 1, Width: 1, Precision: 0})
   447  			vs := make([]int8, 2)
   448  			vs[0] = 10
   449  			vs[1] = 99
   450  			if err := vector.AppendFixed(vec, vs, testEngineMp); err != nil {
   451  				log.Fatal(err)
   452  			}
   453  			bat.Vecs[2] = vec
   454  		}
   455  		if err := r.Write(ctx, bat); err != nil {
   456  			log.Fatal(err)
   457  		}
   458  	}
   459  }
   460  
   461  func CreateCustomer(db engine.Database) {
   462  	ctx := context.TODO()
   463  	{
   464  		var attrs []engine.TableDef
   465  
   466  		{
   467  			attrs = append(attrs, &engine.AttributeDef{
   468  				Attr: engine.Attribute{
   469  					Alg:  compress.Lz4,
   470  					Name: "c_custkey",
   471  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   472  				}})
   473  			attrs = append(attrs, &engine.AttributeDef{
   474  				Attr: engine.Attribute{
   475  					Alg:  compress.Lz4,
   476  					Name: "c_name",
   477  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   478  				}})
   479  			attrs = append(attrs, &engine.AttributeDef{
   480  				Attr: engine.Attribute{
   481  					Alg:  compress.Lz4,
   482  					Name: "c_address",
   483  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   484  				}})
   485  			attrs = append(attrs, &engine.AttributeDef{
   486  				Attr: engine.Attribute{
   487  					Alg:  compress.Lz4,
   488  					Name: "c_city",
   489  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   490  				}})
   491  			attrs = append(attrs, &engine.AttributeDef{
   492  				Attr: engine.Attribute{
   493  					Alg:  compress.Lz4,
   494  					Name: "c_nation",
   495  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   496  				}})
   497  			attrs = append(attrs, &engine.AttributeDef{
   498  				Attr: engine.Attribute{
   499  					Alg:  compress.Lz4,
   500  					Name: "c_region",
   501  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   502  				}})
   503  			attrs = append(attrs, &engine.AttributeDef{
   504  				Attr: engine.Attribute{
   505  					Alg:  compress.Lz4,
   506  					Name: "c_phone",
   507  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   508  				}})
   509  			attrs = append(attrs, &engine.AttributeDef{
   510  				Attr: engine.Attribute{
   511  					Alg:  compress.Lz4,
   512  					Name: "c_mktsegment",
   513  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   514  				}})
   515  		}
   516  		if err := db.Create(ctx, "customer", attrs); err != nil {
   517  			log.Fatal(err)
   518  		}
   519  	}
   520  }
   521  
   522  func CreateLineorder(db engine.Database) {
   523  	ctx := context.TODO()
   524  	{
   525  		var attrs []engine.TableDef
   526  
   527  		{
   528  			attrs = append(attrs, &engine.AttributeDef{
   529  				Attr: engine.Attribute{
   530  					Alg:  compress.Lz4,
   531  					Name: "lo_orderkey",
   532  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   533  				}})
   534  			attrs = append(attrs, &engine.AttributeDef{
   535  				Attr: engine.Attribute{
   536  					Alg:  compress.Lz4,
   537  					Name: "lo_linenumber",
   538  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   539  				}})
   540  			attrs = append(attrs, &engine.AttributeDef{
   541  				Attr: engine.Attribute{
   542  					Alg:  compress.Lz4,
   543  					Name: "lo_custkey",
   544  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   545  				}})
   546  			attrs = append(attrs, &engine.AttributeDef{
   547  				Attr: engine.Attribute{
   548  					Alg:  compress.Lz4,
   549  					Name: "lo_partkey",
   550  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   551  				}})
   552  			attrs = append(attrs, &engine.AttributeDef{
   553  				Attr: engine.Attribute{
   554  					Alg:  compress.Lz4,
   555  					Name: "lo_suppkey",
   556  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   557  				}})
   558  			attrs = append(attrs, &engine.AttributeDef{
   559  				Attr: engine.Attribute{
   560  					Alg:  compress.Lz4,
   561  					Name: "lo_orderdate",
   562  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   563  				}})
   564  			attrs = append(attrs, &engine.AttributeDef{
   565  				Attr: engine.Attribute{
   566  					Alg:  compress.Lz4,
   567  					Name: "lo_orderpriority",
   568  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   569  				}})
   570  			attrs = append(attrs, &engine.AttributeDef{
   571  				Attr: engine.Attribute{
   572  					Alg:  compress.Lz4,
   573  					Name: "lo_shippriority",
   574  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   575  				}})
   576  			attrs = append(attrs, &engine.AttributeDef{
   577  				Attr: engine.Attribute{
   578  					Alg:  compress.Lz4,
   579  					Name: "lo_quantity",
   580  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   581  				}})
   582  			attrs = append(attrs, &engine.AttributeDef{
   583  				Attr: engine.Attribute{
   584  					Alg:  compress.Lz4,
   585  					Name: "lo_extendedprice",
   586  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   587  				}})
   588  			attrs = append(attrs, &engine.AttributeDef{
   589  				Attr: engine.Attribute{
   590  					Alg:  compress.Lz4,
   591  					Name: "lo_ordtotalprice",
   592  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   593  				}})
   594  			attrs = append(attrs, &engine.AttributeDef{
   595  				Attr: engine.Attribute{
   596  					Alg:  compress.Lz4,
   597  					Name: "lo_discount",
   598  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   599  				}})
   600  			attrs = append(attrs, &engine.AttributeDef{
   601  				Attr: engine.Attribute{
   602  					Alg:  compress.Lz4,
   603  					Name: "lo_revenue",
   604  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   605  				}})
   606  			attrs = append(attrs, &engine.AttributeDef{
   607  				Attr: engine.Attribute{
   608  					Alg:  compress.Lz4,
   609  					Name: "lo_supplycost",
   610  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   611  				}})
   612  			attrs = append(attrs, &engine.AttributeDef{
   613  				Attr: engine.Attribute{
   614  					Alg:  compress.Lz4,
   615  					Name: "lo_tax",
   616  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   617  				}})
   618  			attrs = append(attrs, &engine.AttributeDef{
   619  				Attr: engine.Attribute{
   620  					Alg:  compress.Lz4,
   621  					Name: "lo_commitdate",
   622  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   623  				}})
   624  			attrs = append(attrs, &engine.AttributeDef{
   625  				Attr: engine.Attribute{
   626  					Alg:  compress.Lz4,
   627  					Name: "lo_shipmode",
   628  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   629  				}})
   630  		}
   631  		if err := db.Create(ctx, "lineorder", attrs); err != nil {
   632  			log.Fatal(err)
   633  		}
   634  	}
   635  }
   636  
   637  func CreatePart(db engine.Database) {
   638  	ctx := context.TODO()
   639  	{
   640  		var attrs []engine.TableDef
   641  
   642  		{
   643  			attrs = append(attrs, &engine.AttributeDef{
   644  				Attr: engine.Attribute{
   645  					Alg:  compress.Lz4,
   646  					Name: "p_partkey",
   647  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   648  				}})
   649  			attrs = append(attrs, &engine.AttributeDef{
   650  				Attr: engine.Attribute{
   651  					Alg:  compress.Lz4,
   652  					Name: "p_name",
   653  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   654  				}})
   655  			attrs = append(attrs, &engine.AttributeDef{
   656  				Attr: engine.Attribute{
   657  					Alg:  compress.Lz4,
   658  					Name: "p_mfgr",
   659  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   660  				}})
   661  			attrs = append(attrs, &engine.AttributeDef{
   662  				Attr: engine.Attribute{
   663  					Alg:  compress.Lz4,
   664  					Name: "p_category",
   665  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   666  				}})
   667  			attrs = append(attrs, &engine.AttributeDef{
   668  				Attr: engine.Attribute{
   669  					Alg:  compress.Lz4,
   670  					Name: "p_brand",
   671  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   672  				}})
   673  			attrs = append(attrs, &engine.AttributeDef{
   674  				Attr: engine.Attribute{
   675  					Alg:  compress.Lz4,
   676  					Name: "p_color",
   677  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   678  				}})
   679  			attrs = append(attrs, &engine.AttributeDef{
   680  				Attr: engine.Attribute{
   681  					Alg:  compress.Lz4,
   682  					Name: "p_type",
   683  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   684  				}})
   685  			attrs = append(attrs, &engine.AttributeDef{
   686  				Attr: engine.Attribute{
   687  					Alg:  compress.Lz4,
   688  					Name: "p_size",
   689  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   690  				}})
   691  			attrs = append(attrs, &engine.AttributeDef{
   692  				Attr: engine.Attribute{
   693  					Alg:  compress.Lz4,
   694  					Name: "p_container",
   695  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   696  				}})
   697  		}
   698  		if err := db.Create(ctx, "part", attrs); err != nil {
   699  			log.Fatal(err)
   700  		}
   701  	}
   702  }
   703  
   704  func CreateSupplier(db engine.Database) {
   705  	ctx := context.TODO()
   706  	{
   707  		var attrs []engine.TableDef
   708  
   709  		{
   710  			attrs = append(attrs, &engine.AttributeDef{
   711  				Attr: engine.Attribute{
   712  					Alg:  compress.Lz4,
   713  					Name: "s_suppkey",
   714  					Type: types.Type{Oid: types.T(types.T_int64), Size: 8, Width: 0, Precision: 0},
   715  				}})
   716  			attrs = append(attrs, &engine.AttributeDef{
   717  				Attr: engine.Attribute{
   718  					Alg:  compress.Lz4,
   719  					Name: "s_name",
   720  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   721  				}})
   722  			attrs = append(attrs, &engine.AttributeDef{
   723  				Attr: engine.Attribute{
   724  					Alg:  compress.Lz4,
   725  					Name: "s_address",
   726  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   727  				}})
   728  			attrs = append(attrs, &engine.AttributeDef{
   729  				Attr: engine.Attribute{
   730  					Alg:  compress.Lz4,
   731  					Name: "s_city",
   732  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   733  				}})
   734  			attrs = append(attrs, &engine.AttributeDef{
   735  				Attr: engine.Attribute{
   736  					Alg:  compress.Lz4,
   737  					Name: "s_nation",
   738  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   739  				}})
   740  			attrs = append(attrs, &engine.AttributeDef{
   741  				Attr: engine.Attribute{
   742  					Alg:  compress.Lz4,
   743  					Name: "s_region",
   744  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   745  				}})
   746  			attrs = append(attrs, &engine.AttributeDef{
   747  				Attr: engine.Attribute{
   748  					Alg:  compress.Lz4,
   749  					Name: "s_phone",
   750  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   751  				}})
   752  		}
   753  		if err := db.Create(ctx, "supplier", attrs); err != nil {
   754  			log.Fatal(err)
   755  		}
   756  	}
   757  }
   758  
   759  func CreateDate(db engine.Database) {
   760  	ctx := context.TODO()
   761  	{
   762  		var attrs []engine.TableDef
   763  
   764  		{
   765  			attrs = append(attrs, &engine.AttributeDef{
   766  				Attr: engine.Attribute{
   767  					Alg:  compress.Lz4,
   768  					Name: "d_datekey",
   769  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   770  				}})
   771  			attrs = append(attrs, &engine.AttributeDef{
   772  				Attr: engine.Attribute{
   773  					Alg:  compress.Lz4,
   774  					Name: "d_date",
   775  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   776  				}})
   777  			attrs = append(attrs, &engine.AttributeDef{
   778  				Attr: engine.Attribute{
   779  					Alg:  compress.Lz4,
   780  					Name: "d_dayofweek",
   781  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   782  				}})
   783  			attrs = append(attrs, &engine.AttributeDef{
   784  				Attr: engine.Attribute{
   785  					Alg:  compress.Lz4,
   786  					Name: "d_month",
   787  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   788  				}})
   789  			attrs = append(attrs, &engine.AttributeDef{
   790  				Attr: engine.Attribute{
   791  					Alg:  compress.Lz4,
   792  					Name: "d_year",
   793  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   794  				}})
   795  			attrs = append(attrs, &engine.AttributeDef{
   796  				Attr: engine.Attribute{
   797  					Alg:  compress.Lz4,
   798  					Name: "d_yearmonthnum",
   799  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   800  				}})
   801  			attrs = append(attrs, &engine.AttributeDef{
   802  				Attr: engine.Attribute{
   803  					Alg:  compress.Lz4,
   804  					Name: "d_yearmonth",
   805  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   806  				}})
   807  			attrs = append(attrs, &engine.AttributeDef{
   808  				Attr: engine.Attribute{
   809  					Alg:  compress.Lz4,
   810  					Name: "d_daynumnweek",
   811  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   812  				}})
   813  			attrs = append(attrs, &engine.AttributeDef{
   814  				Attr: engine.Attribute{
   815  					Alg:  compress.Lz4,
   816  					Name: "d_weeknuminyear",
   817  					Type: types.Type{Oid: types.T(types.T_varchar), Size: 24, Width: 0, Precision: 0},
   818  				}})
   819  		}
   820  		if err := db.Create(ctx, "dates", attrs); err != nil {
   821  			log.Fatal(err)
   822  		}
   823  	}
   824  }