Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2ce33af
add catalog object classes
aheev Sep 21, 2025
6973875
add catalog object operations
aheev Sep 21, 2025
297617e
add Event class
aheev Sep 21, 2025
64c3350
add events request and response classes
aheev Sep 21, 2025
f284c3c
fix spotless issues
aheev Sep 21, 2025
b3aa3a5
change arr -> List
aheev Sep 21, 2025
9af725a
add catalog object tests
aheev Sep 22, 2025
c06726d
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Sep 27, 2025
a86efc1
move Event, Operations to events package
aheev Sep 27, 2025
8816be1
make Event, Operations Immutable
aheev Sep 27, 2025
ec01ec7
fix assertThat class path
aheev Sep 27, 2025
5839653
fix operationType not passing through ImmutableOperations
aheev Sep 27, 2025
e4526bf
add Event, Operations parsers
aheev Sep 27, 2025
223396b
move OperationParsers to a new package
aheev Sep 28, 2025
e7a6501
fix checkNotNull check
aheev Sep 28, 2025
a038642
add equals and hashcode in OperationType
aheev Sep 28, 2025
7b4715e
add Event, Operation, Parsers tests
aheev Sep 28, 2025
db37555
add new method to create CatalogObject from name
aheev Sep 28, 2025
e92afa6
convert event request and response classes to immutable
aheev Sep 28, 2025
97c8215
add CatalogObjectUuid, Event request/response parsers
aheev Sep 28, 2025
32d0f2b
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Sep 28, 2025
398645e
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Sep 29, 2025
589deee
fix misc
aheev Sep 29, 2025
c14d184
add CatalogObjectUuidParser, Events request/response parser tests
aheev Sep 29, 2025
39f5b72
fix spotless bugs
aheev Sep 29, 2025
82010f2
register Event request/response ser/de
aheev Sep 29, 2025
17ef50a
fix checkstyle bugs
aheev Sep 29, 2025
ecc1cb5
Merge branch 'main' of github.com:aheev/iceberg into irc-events-req-res
aheev Nov 12, 2025
0f6dfc4
fix type in CatalogObjectUuid
aheev Nov 12, 2025
a4c180c
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Dec 8, 2025
870a12f
change event actor type from string to map
aheev Dec 8, 2025
4e40fcc
rename EventsResponse, CatalogObject, page-token, event-count
aheev Dec 8, 2025
850916b
fix TestCreateTableOperationParser.testFromJson
aheev Dec 8, 2025
3b1bc94
add metadata updates to CreateViewOperation
aheev Dec 8, 2025
e0a8ca2
add comment for CustomOperation additional properties
aheev Dec 8, 2025
d8178ca
fix spotless bugs
aheev Dec 8, 2025
fd92ec1
fix checkstyle issues
aheev Dec 8, 2025
fbf9ab6
fix spotless bugs
aheev Dec 8, 2025
8872937
fix TestQueryEventsRequestParser.testFromJson accidental change
aheev Dec 8, 2025
aafe0b3
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Dec 30, 2025
b128f93
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Jan 8, 2026
0fb7224
Merge branch 'main' of https://github.com/apache/iceberg into irc-eve…
aheev Feb 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.catalog;

import java.util.Arrays;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import org.apache.iceberg.relocated.com.google.common.base.Joiner;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;

/**
* Reference to a named object in a {@link Catalog}, such as {@link Namespace}, {@link
* org.apache.iceberg.Table}, or {@link org.apache.iceberg.view.View}.
*/
public class CatalogObjectIdentifier {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this new concept makes sense to me. It is also useful for the universal load endpoint (table, view, MV, index) that we talked about in the community discussion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update Namespace and TableIdentifier to extend from this class to reduce code duplication?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if the CatalogObjectIdentifier can still have two parts namespace and name, where object name can be optional.

In yesterday's catalog sync, there is also a discussion about global scope UDF function. We decided not to allow it for now. But if global scope is going to be allowed in the future, then namespace can be optional. At least one of the two parts must be not null or empty.

private static final CatalogObjectIdentifier EMPTY_CATALOG_OBJECT =
new CatalogObjectIdentifier(new String[] {});
private static final Joiner DOT = Joiner.on(".");
private static final Predicate<String> CONTAINS_NULL_CHARACTER =
Pattern.compile("\u0000", Pattern.UNICODE_CHARACTER_CLASS).asPredicate();

public static CatalogObjectIdentifier empty() {
return EMPTY_CATALOG_OBJECT;
}

public static CatalogObjectIdentifier of(String... levels) {
Preconditions.checkArgument(
null != levels, "Cannot create CatalogObjectIdentifier from null array");
if (levels.length == 0) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should not be allowed. A valid catalog object identifier should have at least one level of non-empty string value.

For comparison with existing code, namespace can be empty, but table identifier name must be non-empty.

return empty();
}

for (String level : levels) {
Preconditions.checkNotNull(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the current Namespace class doesn't enforce non-empty level string. But I am still wondering if it is valid?

level, "Cannot create a CatalogObjectIdentifier with a null level");
Preconditions.checkArgument(
!CONTAINS_NULL_CHARACTER.test(level),
"Cannot create a CatalogObjectIdentifier with the null-byte character");
}

return new CatalogObjectIdentifier(levels);
}

public static CatalogObjectIdentifier of(String name) {
Preconditions.checkNotNull(name, "Cannot create CatalogObjectIdentifier from null name");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not null and not empty


return of(name.split("\\."));
}

private final String[] levels;

private CatalogObjectIdentifier(String[] levels) {
this.levels = levels;
}

public String[] levels() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add javadoc to public API methods

return levels;
}

public String level(int pos) {
return levels[pos];
}

public boolean isEmpty() {
return levels.length == 0;
}

public int length() {
return levels.length;
}

@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}

if (other == null || getClass() != other.getClass()) {
return false;
}

CatalogObjectIdentifier catalogObjectIdentifier = (CatalogObjectIdentifier) other;
return Arrays.equals(levels, catalogObjectIdentifier.levels);
}

@Override
public int hashCode() {
return Arrays.hashCode(levels);
}

@Override
public String toString() {
return DOT.join(levels);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.catalog;

import java.util.Arrays;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;

/**
* Enum representing a CatalogObject i.e., {@link Namespace}, {@link org.apache.iceberg.Table}, or
* {@link org.apache.iceberg.view.View}.
*/
public enum CatalogObjectType {
NAMESPACE("namespace"),
Comment thread
aheev marked this conversation as resolved.
TABLE("table"),
VIEW("view");

private final String type;

CatalogObjectType(String type) {
this.type = type;
}

public String type() {
return type;
}

public static CatalogObjectType fromType(String type) {
Preconditions.checkNotNull(type, "Invalid CatalogObjectType: null");
return Arrays.stream(CatalogObjectType.values())
.filter(catalogObjectType -> catalogObjectType.type.equalsIgnoreCase(type))
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Invalid CatalogObjectType: " + type));
}

@Override
public String toString() {
return type;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* 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. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.catalog;

import java.util.Objects;
import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;

/**
* Identifies a {@link org.apache.iceberg.Table} or {@link org.apache.iceberg.view.View} by UUID.
*/
public class CatalogObjectUuid {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand the need of this class.

private final String uuid;

/** one of ["table", "view"]. Assign using {@link CatalogObjectType#type()} */
private final String type;

public CatalogObjectUuid(String uuid, String type) {
Preconditions.checkNotNull(uuid, "Invalid UUID: null");

if (uuid.isEmpty()) {
throw new IllegalArgumentException("Invalid UUID: empty");
}

if (!type.equals(CatalogObjectType.TABLE.type())
&& !type.equals(CatalogObjectType.VIEW.type())) {
throw new IllegalArgumentException("Invalid type: " + type);
}

this.uuid = uuid;
this.type = type;
}

public String uuid() {
return uuid;
}

public String type() {
return type;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("uuid", uuid).add("type", type).toString();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}

if (o == null || getClass() != o.getClass()) {
return false;
}

CatalogObjectUuid that = (CatalogObjectUuid) o;
return uuid.equals(that.uuid) && type.equals(that.type);
}

@Override
public int hashCode() {
return Objects.hash(uuid, type);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* 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. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.catalog;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import org.junit.jupiter.api.Test;

public class TestCatalogObjectIdentifier {

@Test
public void testWithNullAndEmpty() {
assertThatThrownBy(() -> CatalogObjectIdentifier.of((String[]) null))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Cannot create CatalogObjectIdentifier from null array");

assertThat(CatalogObjectIdentifier.of()).isEqualTo(CatalogObjectIdentifier.empty());
}

@Test
public void testCatalogObjectIdentifier() {
String[] levels = {"a", "b", "c", "d"};
CatalogObjectIdentifier catalogObjectIdentifier = CatalogObjectIdentifier.of(levels);
assertThat(catalogObjectIdentifier).isNotNull();
assertThat(catalogObjectIdentifier.levels()).hasSize(4);
assertThat(catalogObjectIdentifier).hasToString("a.b.c.d");
for (int i = 0; i < levels.length; i++) {
assertThat(catalogObjectIdentifier.level(i)).isEqualTo(levels[i]);
}
}

@Test
public void testWithNullInLevel() {
assertThatThrownBy(() -> CatalogObjectIdentifier.of("a", null, "b"))
.isInstanceOf(NullPointerException.class)
.hasMessage("Cannot create a CatalogObjectIdentifier with a null level");
}

@Test
public void testDisallowsCatalogObjectIdentifierWithNullByte() {
assertThatThrownBy(() -> CatalogObjectIdentifier.of("ac", "\u0000c", "b"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Cannot create a CatalogObjectIdentifier with the null-byte character");

assertThatThrownBy(() -> CatalogObjectIdentifier.of("ac", "c\0", "b"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Cannot create a CatalogObjectIdentifier with the null-byte character");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* 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. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.iceberg.catalog;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

import org.junit.jupiter.api.Test;

public class TestCatalogObjectType {

@Test
void testFromType() {
assertThat(CatalogObjectType.fromType("namespace")).isEqualTo(CatalogObjectType.NAMESPACE);

assertThatThrownBy(() -> CatalogObjectType.fromType(null))
.isInstanceOf(NullPointerException.class)
.hasMessage("Invalid CatalogObjectType: null");

assertThatThrownBy(() -> CatalogObjectType.fromType("invalid_type"))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Invalid CatalogObjectType: invalid_type");
}

@Test
void testToString() {
assertThat(CatalogObjectType.TABLE.toString()).isEqualTo("table");
}
}
Loading