github.com/fraugster/parquet-go@v0.12.0/compatibility/compare.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"flag"
     7  	"reflect"
     8  )
     9  
    10  func main() {
    11  	var (
    12  		file string
    13  		pq   string
    14  	)
    15  	flag.StringVar(&file, "json", "/data.json", "json file to load")
    16  	flag.StringVar(&pq, "pq", "/data.pq", "pq to save")
    17  
    18  	flag.Parse()
    19  
    20  	jData, err := loadDataFromJson(file)
    21  	if err != nil {
    22  		panic(err)
    23  	}
    24  
    25  	pqData, err := loadDataFromParquet(pq)
    26  	if err != nil {
    27  		panic(err)
    28  	}
    29  
    30  	if len(pqData) != len(jData) {
    31  		panic("the len is not equal")
    32  	}
    33  
    34  	for i := range pqData {
    35  		if !reflect.DeepEqual(*pqData[i], *jData[i]) {
    36  			panic("not equal")
    37  		}
    38  	}
    39  }