Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -20,7 +20,7 @@

import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_CREATION_MODE;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_STORAGE_OPTIONS_PREFIX;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_CREATE_EMPTY;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_DECLARED;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_FORMAT;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_REGISTER;

Expand Down Expand Up @@ -68,8 +68,8 @@ public List<PropertyEntry<?>> tablePropertyEntries() {
false /* hidden */,
false /* reserved */),
PropertyEntry.booleanPropertyEntry(
LANCE_TABLE_CREATE_EMPTY,
"Whether this is a lance create empty table (declare table) operation.",
LANCE_TABLE_DECLARED,
"Whether this is a Lance metadata-only declare table operation.",
false,
true /* immutable */,
false /* defaultValue */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,14 @@ Table createTableInternal(
ident, columns, comment, properties, partitions, distribution, sortOrders, indexes);
}

// Check whether it's a create empty table operation.
boolean createEmpty =
Optional.ofNullable(properties.get(LanceConstants.LANCE_TABLE_CREATE_EMPTY))
// Check whether it's a metadata-only declare table operation.
boolean declaredOnly =
Optional.ofNullable(properties.get(LanceConstants.LANCE_TABLE_DECLARED))
.map(Boolean::parseBoolean)
.orElse(false);
if (createEmpty) {
// For create empty table, we just create the table metadata in Gravitino without creating
// the underlying Lance dataset.
if (declaredOnly) {
// For declare table, we just create the table metadata in Gravitino without creating the
// underlying Lance dataset.
Comment thread
yuqi1129 marked this conversation as resolved.
return super.createTable(
ident, columns, comment, properties, partitions, distribution, sortOrders, indexes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package org.apache.gravitino.catalog.lakehouse.lance.integration.test;

import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_CREATION_MODE;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_CREATE_EMPTY;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_DECLARED;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_FORMAT;
import static org.apache.gravitino.lance.common.utils.LanceConstants.LANCE_TABLE_REGISTER;

Expand Down Expand Up @@ -82,7 +82,7 @@
import org.lance.Dataset;
import org.lance.Fragment;
import org.lance.FragmentMetadata;
import org.lance.Transaction;
import org.lance.SourcedTransaction;
import org.lance.WriteParams;
import org.lance.ipc.LanceScanner;
import org.lance.ipc.ScanOptions;
Expand Down Expand Up @@ -162,7 +162,7 @@ public void testCrateEmptyTable() {
String tableLocation = tempDirectory + "/" + tableName;
properties.put("format", "lance");
properties.put("location", tableLocation);
properties.put(LANCE_TABLE_CREATE_EMPTY, "true");
properties.put(LANCE_TABLE_DECLARED, "true");
properties.put(Table.PROPERTY_EXTERNAL, "true");

Table createdTable =
Expand All @@ -178,19 +178,18 @@ public void testCrateEmptyTable() {
null);
Assertions.assertEquals(createdTable.name(), emptyTableName);

// Now try to alter the property LANCE_TABLE_CREATE_EMPTY
// Now try to alter the property LANCE_TABLE_DECLARED
IllegalArgumentException e =
Assertions.assertThrows(
IllegalArgumentException.class,
() ->
catalog
.asTableCatalog()
.alterTable(
nameIdentifier,
TableChange.setProperty(LANCE_TABLE_CREATE_EMPTY, "false")));
nameIdentifier, TableChange.setProperty(LANCE_TABLE_DECLARED, "false")));

Assertions.assertTrue(
e.getMessage().contains("Property lance.create-empty is immutable or reserved"));
e.getMessage().contains("Property lance.declared is immutable or reserved"));
}

@Test
Expand Down Expand Up @@ -374,7 +373,7 @@ void testLanceTableFormat() {
}

// Now try to write some data to the dataset
Transaction trans =
SourcedTransaction trans =
dataset
.newTransactionBuilder()
.operation(
Expand All @@ -388,10 +387,10 @@ void testLanceTableFormat() {
new LanceDataValue(3, 300L, "third")),
lanceSchema))
.build())
.writeParams(ImmutableMap.of())
.transactionProperties(ImmutableMap.of())
.build();

Dataset newDataset = dataset.commitTransaction(trans);
Dataset newDataset = trans.commit();
try (LanceScanner scanner =
newDataset.newScan(
new ScanOptions.Builder()
Expand Down
1 change: 1 addition & 0 deletions clients/client-python/MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

include requirements.txt
include requirements-dev.txt
include requirements-lance.txt
include README.md
include LICENSE
include NOTICE
Expand Down
24 changes: 24 additions & 0 deletions clients/client-python/requirements-lance.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.

# Lance integration deps. `lance-ray` owns the compatible `lance-namespace`
# dependency, so do not pin `lance-namespace` here separately. Installed via
# the `lance` extra (e.g. `pip install -e .[lance]`) so the heavy ray/pylance
# native wheels don't slow down the default `dev` install used by lint and
# unit-test tasks.
ray==2.55.1
lance-ray==0.4.2
1 change: 1 addition & 0 deletions clients/client-python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
install_requires=open("requirements.txt").read(),
extras_require={
"dev": open("requirements-dev.txt").read(),
"lance": open("requirements-lance.txt").read(),
},
Comment thread
yuqi1129 marked this conversation as resolved.
include_package_data=True,
)
Loading
Loading