From 018788d2c350a7a04dc6bc3eb4798df7925da46a Mon Sep 17 00:00:00 2001 From: Adrien Aury <44274230+adrienaury@users.noreply.github.com> Date: Sat, 28 Sep 2024 15:17:07 +0000 Subject: [PATCH] fix: pimo wasm --- pkg/parquet/parquet.go | 3 ++ pkg/parquet/parquet_test.go | 3 ++ pkg/parquet/parquet_wasm.go | 92 +++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 pkg/parquet/parquet_wasm.go diff --git a/pkg/parquet/parquet.go b/pkg/parquet/parquet.go index a22f6bd2..753c0684 100755 --- a/pkg/parquet/parquet.go +++ b/pkg/parquet/parquet.go @@ -15,6 +15,9 @@ // You should have received a copy of the GNU General Public License // along with PIMO. If not, see . +//go:build !wasi && !wasm +// +build !wasi,!wasm + package parquet import ( diff --git a/pkg/parquet/parquet_test.go b/pkg/parquet/parquet_test.go index c40bfcb3..d4d08bee 100755 --- a/pkg/parquet/parquet_test.go +++ b/pkg/parquet/parquet_test.go @@ -15,6 +15,9 @@ // You should have received a copy of the GNU General Public License // along with PIMO. If not, see . +//go:build !wasi && !wasm +// +build !wasi,!wasm + package parquet import ( diff --git a/pkg/parquet/parquet_wasm.go b/pkg/parquet/parquet_wasm.go new file mode 100644 index 00000000..0e220277 --- /dev/null +++ b/pkg/parquet/parquet_wasm.go @@ -0,0 +1,92 @@ +// Copyright (C) 2021 CGI France +// +// This file is part of PIMO. +// +// PIMO is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// PIMO is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with PIMO. If not, see . + +//go:build wasi || wasm +// +build wasi wasm + +package parquet + +import ( + "io" + + "github.com/apache/arrow/go/v12/arrow" + "github.com/cgi-fr/pimo/pkg/model" +) + +type Source struct{} + +func NewSource(path string) (*Source, error) { + panic("parquet is not supported on your environment") +} + +func NewPackedSource(path string) (*Source, error) { + panic("parquet is not supported on your environment") +} + +func (s *Source) Schema() (*arrow.Schema, error) { + panic("parquet is not supported on your environment") +} + +func (s *Source) Open() error { + panic("parquet is not supported on your environment") +} + +func (s *Source) NextBatch() bool { + panic("parquet is not supported on your environment") +} + +func (s *Source) Next() bool { + panic("parquet is not supported on your environment") +} + +func (s *Source) Value() model.Entry { + panic("parquet is not supported on your environment") +} + +func (s *Source) Err() error { + panic("parquet is not supported on your environment") +} + +func NewSink(file io.Writer, schema *arrow.Schema) (Sink, error) { + panic("parquet is not supported on your environment") +} + +func NewSinkWithContext(file io.Writer, schema *arrow.Schema, counter string) (Sink, error) { + panic("parquet is not supported on your environment") +} + +type Sink struct{} + +func (s Sink) Open() error { + panic("parquet is not supported on your environment") +} + +func (s Sink) Close() error { + panic("parquet is not supported on your environment") +} + +func (s Sink) ProcessDictionary(dictionary model.Entry) error { + panic("parquet is not supported on your environment") +} + +func JSONToArray(buffer []byte) ([]model.Dictionary, error) { + panic("parquet is not supported on your environment") +} + +func JSONToPackedDictionary(jsonline []byte) (model.Dictionary, error) { + panic("parquet is not supported on your environment") +}