Skip to content

Commit

Permalink
[apache#1838] feat(client): Add Java client support for fileset
Browse files Browse the repository at this point in the history
  • Loading branch information
coolderli committed Feb 4, 2024
1 parent 801df01 commit 0369b0e
Showing 1 changed file with 105 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
* Copyright 2023 Datastrato Pvt Ltd.
* This software is licensed under the Apache License version 2.
*/
package com.datastrato.gravitino.client;

import com.datastrato.gravitino.NameIdentifier;
import com.datastrato.gravitino.Namespace;
import com.datastrato.gravitino.dto.AuditDTO;
import com.datastrato.gravitino.dto.CatalogDTO;
import com.datastrato.gravitino.exceptions.FilesetAlreadyExistsException;
import com.datastrato.gravitino.exceptions.NoSuchCatalogException;
import com.datastrato.gravitino.exceptions.NoSuchFilesetException;
import com.datastrato.gravitino.exceptions.NoSuchSchemaException;
import com.datastrato.gravitino.exceptions.NonEmptySchemaException;
import com.datastrato.gravitino.exceptions.SchemaAlreadyExistsException;
import com.datastrato.gravitino.file.Fileset;
import com.datastrato.gravitino.file.FilesetCatalog;
import com.datastrato.gravitino.file.FilesetChange;
import com.datastrato.gravitino.rel.Schema;
import com.datastrato.gravitino.rel.SchemaChange;
import com.datastrato.gravitino.rel.SupportsSchemas;

import java.util.Map;

/**
* Fileset catalog is a catalog implementation that supports fileset like metadata
* operations, for example, schemas and filesets list, creation, update and deletion. A Fileset
* catalog is under the metalake.
*/
public class GravitinoFilesetCatalog extends CatalogDTO implements FilesetCatalog, SupportsSchemas {

private final RESTClient restClient;

public GravitinoFilesetCatalog(String name,
Type type,
String provider,
String comment,
Map<String, String> properties,
AuditDTO auditDTO,
RESTClient restClient) {
super(name, type, provider, comment, properties, auditDTO);
this.restClient = restClient;
}

@Override
public SupportsSchemas asSchemas() throws UnsupportedOperationException {
return this;
}

@Override
public FilesetCatalog asFilesetCatalog() throws UnsupportedOperationException {
return this;
}

@Override
public NameIdentifier[] listFilesets(Namespace namespace) throws NoSuchSchemaException {
return new NameIdentifier[0];
}

@Override
public Fileset loadFileset(NameIdentifier ident) throws NoSuchFilesetException {
return null;
}

@Override
public Fileset createFileset(NameIdentifier ident, String comment, Fileset.Type type, String storageLocation, Map<String, String> properties) throws NoSuchSchemaException, FilesetAlreadyExistsException {
return null;
}

@Override
public Fileset alterFileset(NameIdentifier ident, FilesetChange... changes) throws NoSuchFilesetException, IllegalArgumentException {
return null;
}

@Override
public boolean dropFileset(NameIdentifier ident) {
return false;
}

@Override
public NameIdentifier[] listSchemas(Namespace namespace) throws NoSuchCatalogException {
return new NameIdentifier[0];
}

@Override
public Schema createSchema(NameIdentifier ident, String comment, Map<String, String> properties) throws NoSuchCatalogException, SchemaAlreadyExistsException {
return null;
}

@Override
public Schema loadSchema(NameIdentifier ident) throws NoSuchSchemaException {
return null;
}

@Override
public Schema alterSchema(NameIdentifier ident, SchemaChange... changes) throws NoSuchSchemaException {
return null;
}

@Override
public boolean dropSchema(NameIdentifier ident, boolean cascade) throws NonEmptySchemaException {
return false;
}
}

0 comments on commit 0369b0e

Please sign in to comment.