zeroshade commented on code in PR #2402:
URL: https://github.com/apache/iceberg-go/pull/2402#discussion_r4470492210
##########
table/internal/interfaces.go:
##########
@@ -100,6 +100,8 @@ func GetFileFormat(format iceberg.FileFormat) FileFormat {
switch format {
case iceberg.ParquetFile:
return parquetFormat{}
+ case iceberg.OrcFile:
Review Comment:
This makes `write.format.default=orc` produce committed ORC files, while
`orcFormat.Open` returns `ErrNotImplemented`, so iceberg-go can no longer scan
the table. Previously the write failed. Please keep ORC off the table write
path until a reader exists.
##########
table/internal/orc_writer.go:
##########
@@ -0,0 +1,992 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+package internal
+
+import (
+ "bytes"
+ "context"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "math/bits"
+ "strconv"
+
+ "github.com/apache/arrow-go/v18/arrow"
+ "github.com/apache/arrow-go/v18/arrow/array"
+ "github.com/apache/arrow-go/v18/arrow/extensions"
+ "github.com/apache/iceberg-go"
+ iceio "github.com/apache/iceberg-go/io"
+)
+
+// orcFormat implements an initial, uncompressed single-stripe ORC writer.
Review Comment:
Single-stripe and uncompressed means the whole file is held in memory until
`Close` (up to the 512 MiB default target size per writer), and
`write.orc.compression-codec` is ignored. Please document these limits or
address them before ORC is selectable through table properties.
##########
table/internal/orc_writer.go:
##########
@@ -0,0 +1,992 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+package internal
+
+import (
+ "bytes"
+ "context"
+ "encoding/binary"
+ "errors"
+ "fmt"
+ "io"
+ "math"
+ "math/big"
+ "math/bits"
+ "strconv"
+
+ "github.com/apache/arrow-go/v18/arrow"
+ "github.com/apache/arrow-go/v18/arrow/array"
+ "github.com/apache/arrow-go/v18/arrow/extensions"
+ "github.com/apache/iceberg-go"
+ iceio "github.com/apache/iceberg-go/io"
+)
+
+// orcFormat implements an initial, uncompressed single-stripe ORC writer.
+// Uncompressed ORC output supports primitive and nested columns, timestamps,
+// and Iceberg data, positional delete, and equality delete file content.
+type orcFormat struct{}
+
+type orcWriteSummary struct {
+ rows int64
+ nulls map[int]int64
+ values map[int]int64
+}
+
+func (orcFormat) Open(context.Context, iceio.IO, string) (FileReader, error) {
+ return nil, fmt.Errorf("%w: ORC reading requires an ORC reader",
iceberg.ErrNotImplemented)
+}
+
+func (orcFormat) PathToIDMapping(schema *iceberg.Schema) (map[string]int,
error) {
+ if schema == nil {
+ return nil, fmt.Errorf("%w: missing ORC schema",
iceberg.ErrInvalidArgument)
+ }
+ result := make(map[string]int, schema.NumFields())
+ var addField func(string, iceberg.NestedField)
+ addField = func(prefix string, field iceberg.NestedField) {
+ path := prefix + field.Name
+ result[path] = field.ID
+ if nested, ok := field.Type.(iceberg.NestedType); ok {
+ for _, child := range nested.Fields() {
+ addField(path+".", child)
+ }
+ }
+ }
+ for _, field := range schema.Fields() {
+ addField("", field)
+ }
+
+ return result, nil
+}
+
+func (orcFormat) DataFileStatsFromMeta(meta Metadata, _
map[int]StatisticsCollector, _ map[string]int, _ map[int]struct{}, _
*arrow.Schema) *DataFileStatistics {
Review Comment:
Only counts are returned, so data files get no lower/upper bounds and scans
can't prune ORC files. Java's ORC writer records bounds.
##########
table/internal/orc_writer.go:
##########
@@ -0,0 +1,992 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Review Comment:
The licence header is missing its final "See the License for the specific
language governing permissions and limitations under the License." lines; the
same applies to `orc_writer_test.go`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]