xitongsys / parquet-go

pure golang library for reading/writing parquet file
Apache License 2.0
1.27k stars 293 forks source link

ничего не работает #594

Open vadinabronin opened 3 months ago

vadinabronin commented 3 months ago

    a1  float64  `parquet:"name=a1, type=DOUBLE, convertedtype=DATE"`
    a2  float64  `parquet:"name=a2, type=DOUBLE, convertedtype=DATE"`
    a3  int64    `parquet:"name=a3, type=INT64, convertedtype=DATE"`
}

func save3files(filename string,a1 []float64,a2 []float64,a3 []int64) {
    //fmt.Println(len(a1),len(a2),len(a3))
    fw, err := local.NewLocalFileWriter(filename)
    if err != nil {
        panic(err)
    }
    pw, err := writer.NewParquetWriter(fw, new(LoadStruct), 2)
    if err != nil {
        panic(err)
    }

    for i := 0;i < len(a1);i++{
        st := LoadStruct{a1: a1[i],a2: a2[i],a3: a3[i]}
        if err := pw.Write(st); err != nil {
            panic(err)
        }
    }
    if err := pw.WriteStop(); err != nil {
        panic(err)
    }

    fileInfo, err := os.Stat(filename)
    if err != nil {
        panic(err)
    }
    fmt.Printf("Размер файла после записи: %d байт\n", fileInfo.Size())
    fw.Close()
}``` 

panic: interface conversion: interface {} is nil, not int64 - че это за херня какой nil при pw.WriteStop
hangxie commented 1 month ago

Primitive type for DATE should be INT32, check https://github.com/xitongsys/parquet-go?tab=readme-ov-file#logical-type