Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HiveConfig from Iceberg module #12506

Merged

Conversation

homar
Copy link
Member

@homar homar commented May 22, 2022

Description

Related issues, pull requests, and links

Documentation

( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

( ) No release notes entries required.
( ) Release notes entries required with the following suggested text:

# Section
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label May 22, 2022
@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch from ba87988 to fbcc078 Compare May 22, 2022 10:55
@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch from fbcc078 to 4e2b9c2 Compare May 22, 2022 12:48
@homar homar changed the title [WIP} Remove HiveConfig from Iceberg module [WIP] Remove HiveConfig from Iceberg module May 23, 2022
@homar homar marked this pull request as ready for review May 23, 2022 11:52
@homar homar changed the title [WIP] Remove HiveConfig from Iceberg module Remove HiveConfig from Iceberg module May 23, 2022
@homar homar requested review from findepi, findinpath, alexjo2144 and ebyhr and removed request for findepi May 23, 2022 11:53
@@ -107,7 +107,7 @@ public HiveMetadataFactory(
hiveConfig.getWritesToNonManagedTablesEnabled(),
hiveConfig.getCreatesOfNonManagedTablesEnabled(),
hiveConfig.isDeleteSchemaLocationsFallback(),
hiveConfig.isTranslateHiveViews(),
metastoreConfig.isTranslateHiveViews(),
Copy link
Member

Choose a reason for hiding this comment

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

It's not metastore-related. isTranslateHiveViews is used in HiveMetadata.

What would happen if you move this back to HiveConfig?

requireNonNull(metastoreConfig, "metastoreConfig is null");
checkArgument(!metastoreConfig.isHideDeltaLakeTables(), "Hiding Delta Lake tables is not supported"); // TODO
this.translateHiveViews = metastoreConfig.isTranslateHiveViews();
Copy link
Member

Choose a reason for hiding this comment

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

I guess this use-place is the reason why you moved the config from HiveConfig to metastoreConfig.

However, we don't need this configurable in iceberg. There is no concept of "hive views" in Iceberg.

  • we may be able to solve this using a technique like @MaxDomainCompactionThreshold
  • add a TestIcebergPlugin test that configuring connector with hive.hive-views.enabled fails

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok my bad, I was pretty sure iceberg needs this. Thanks

@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch from 4e2b9c2 to a004720 Compare May 25, 2022 08:24
@findinpath
Copy link
Contributor

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.9.0:compile (default-compile) on project trino-hive: Compilation failure
[ERROR] /Users/marius/Development/starburst/trino/plugin/trino-hive/src/main/java/io/trino/plugin/hive/HiveMetadataFactory.java:[110,27] cannot find symbol
[ERROR]   symbol:   method isTranslateHiveViews()
[ERROR]   location: variable hiveConfig of type io.trino.plugin.hive.HiveConfig

build is failing locally.

Do note that the branch has conflicts with master and probably this is why the maven checks tasks were not triggered.

@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch 2 times, most recently from df9d6b6 to 5f1dab8 Compare May 25, 2022 12:28
@@ -92,6 +94,7 @@ public void setup(Binder binder)
configBinder(binder).bindConfig(DeltaLakeConfig.class);
configBinder(binder).bindConfig(HiveConfig.class);
binder.bind(MetastoreConfig.class).toInstance(new MetastoreConfig()); // currently not configurable
newOptionalBinder(binder, Key.get(boolean.class, TranslateHiveViews.class));
Copy link
Member

Choose a reason for hiding this comment

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

Looks like extension point, but Delta doesn't need to create extension points. At best, Hive would do this.

what about

binder.bind(Key.get(boolean.class, TranslateHiveViews.class)).toInstance(false);

Copy link
Member Author

Choose a reason for hiding this comment

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

oh ok, I see now. thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

tough I guess it is not needed for delta lake as there is still hive config there

}

@LegacyConfig({"hive.views-execution.enabled", "hive.translate-hive-views"})
@Config("hive.hive-views.enabled")
Copy link
Member

Choose a reason for hiding this comment

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

Why removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

because I didn't understand the idea...

@@ -92,7 +93,8 @@ public HiveMetadataFactory(
Set<SystemTableProvider> systemTableProviders,
HiveMaterializedViewMetadataFactory hiveMaterializedViewMetadataFactory,
AccessControlMetadataFactory accessControlMetadataFactory,
DirectoryLister directoryLister)
DirectoryLister directoryLister,
@TranslateHiveViews Optional<Boolean> translateHiveViews)
Copy link
Member

Choose a reason for hiding this comment

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

Why Optional? it's always either true or false

Suggested change
@TranslateHiveViews Optional<Boolean> translateHiveViews)
@TranslateHiveViews boolean translateHiveViews)

Copy link
Member

Choose a reason for hiding this comment

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

also, this class takes HiveConfig hiveConfig, so if the fields goes back there (as it should), remove the new paramater.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep I 've got it now

MetastoreConfig metastoreConfig,
@TranslateHiveViews Optional<Boolean> translateHiveViews,
Copy link
Member

Choose a reason for hiding this comment

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

Why Optional? it's always either true or false

Suggested change
@TranslateHiveViews Optional<Boolean> translateHiveViews,
@TranslateHiveViews boolean translateHiveViews)

"test",
Map.of(
"iceberg.catalog.type", "HIVE_METASTORE",
"hive.hive-views.enabled", "true",
Copy link
Member

Choose a reason for hiding this comment

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

Define a constant so that the test always uses a correct config property name

@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch 2 times, most recently from d42c963 to 358abb3 Compare May 26, 2022 14:27
@@ -48,8 +49,8 @@
public void configure(Binder binder)
{
binder.bind(IcebergTransactionManager.class).in(Scopes.SINGLETON);
binder.bind(Key.get(boolean.class, TranslateHiveViews.class)).toInstance(false);
Copy link
Member

Choose a reason for hiding this comment

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

If this is Thrift specific, it can go in IcebergHiveMetastoreCatalogModule

Copy link
Member

Choose a reason for hiding this comment

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

i see thjis added to IcebergHiveMetastoreCatalogModule.java but not removed here

@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch from 358abb3 to f58e8b1 Compare May 26, 2022 15:56
new MetastoreConfig(),
false,
Copy link
Member

Choose a reason for hiding this comment

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

use current code default

new HiveConfig().isTranslateHiveViews()

see #12343 (comment)

metastoreConfig,
false,
Copy link
Member

Choose a reason for hiding this comment

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

new HiveConfig().isTranslateHiveViews()

new MetastoreConfig(),
false,
Copy link
Member

Choose a reason for hiding this comment

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

new HiveConfig().isTranslateHiveViews()

@@ -154,7 +153,7 @@ private ThriftHiveMetastore createThriftHiveMetastore()
private static ThriftHiveMetastore createThriftHiveMetastore(ThriftMetastoreClient client)
{
MetastoreLocator metastoreLocator = new MockMetastoreLocator(client);
return new ThriftHiveMetastore(metastoreLocator, new HiveConfig(), new MetastoreConfig(), new ThriftMetastoreConfig(), HDFS_ENVIRONMENT, false);
return new ThriftHiveMetastore(metastoreLocator, new MetastoreConfig(), false, new ThriftMetastoreConfig(), HDFS_ENVIRONMENT, false);
Copy link
Member

Choose a reason for hiding this comment

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

new HiveConfig().isTranslateHiveViews()

new MetastoreConfig(),
false,
Copy link
Member

Choose a reason for hiding this comment

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

new HiveConfig().isTranslateHiveViews()

@@ -48,8 +49,8 @@
public void configure(Binder binder)
{
binder.bind(IcebergTransactionManager.class).in(Scopes.SINGLETON);
binder.bind(Key.get(boolean.class, TranslateHiveViews.class)).toInstance(false);
Copy link
Member

Choose a reason for hiding this comment

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

i see thjis added to IcebergHiveMetastoreCatalogModule.java but not removed here

@@ -29,6 +30,8 @@

public class TestIcebergPlugin
{
private static final String HIVE_VIEWS_ENABLED = "hive.hive-views.enabled";
Copy link
Member

Choose a reason for hiding this comment

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

The constant has value only if used in @Config annotation value of the io.trino.plugin.hive.HiveConfig#setTranslateHiveViews method.

@homar homar force-pushed the homar/remove_hiveconfig_from_iceberg_module branch from f58e8b1 to b11f77f Compare May 27, 2022 13:32
@findepi
Copy link
Member

findepi commented May 27, 2022

CI #11848

@findepi findepi added the no-release-notes This pull request does not require release notes entry label May 28, 2022
@findepi findepi merged commit cf29082 into trinodb:master May 28, 2022
@github-actions github-actions bot added this to the 383 milestone May 28, 2022
}

@LegacyConfig("hive.target-max-file-size")
@Config("iceberg.target-max-file-size")
Copy link
Member

Choose a reason for hiding this comment

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

If we're changing config properties, we should also document this change. @homar can you submit a follow-up PR with docs changes, or would you like me to take the lead on that?

cc @findepi

Copy link
Member Author

Choose a reason for hiding this comment

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

I will submit a pr. Thanks for pointing it out

Copy link
Member Author

Choose a reason for hiding this comment

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

@colebow I made a PR #12619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed no-release-notes This pull request does not require release notes entry
Development

Successfully merging this pull request may close these issues.

5 participants