xitongsys / parquet-go

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

write down and then just 1 successful #568

Closed SuperEdison closed 11 months ago

SuperEdison commented 11 months ago

type AllTypes struct {
    F1 string `parquet:"name=f1, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
    F2 string `parquet:"name=f2, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"`
}

func TestClient_HandleParquet(t *testing.T) {
    fw, err := local.NewLocalFileWriter("all-nil.parquet")
    if err != nil {
        fmt.Println("Can't create local file", err)
        return
    }

    pw, err := writer.NewParquetWriter(fw, new(AllTypes), 4)
    if err != nil {
        fmt.Println("Can't create parquet writer", err)
        return
    }

    for i := 0; i < 10; i++ {
        value := &AllTypes{
            F1: fmt.Sprintf("f%d", i),
            F2: fmt.Sprintf("f%d", i),
        }
        if err = pw.Write(value); err != nil {
            fmt.Println("Write error", err)
        }
    }
    if err = pw.WriteStop(); err != nil {
        fmt.Println("WriteStop error", err)
        return
    }
    fw.Close()
}

image

i want to insert some data, but there is only one successful @hangxie

SuperEdison commented 11 months ago

that's to read pq file tool problem