Skip to content

Conversation

@ujc714
Copy link
Contributor

@ujc714 ujc714 commented Jul 15, 2021

What changes were proposed in this pull request?

Use a default directory for MANAGEDLOCATION if it's not assigned in CREATE DATABASE query.

Why are the changes needed?

HMS doesn't create MANAGEDLOCATION directory if it's NULL. If we run a CTAS query immediately after the CREATE DATABASE query and the staging directory is not under the MANAGEDLOCATION directory, the CTAS query will fail in MOVE task.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

mvn test -Dtest=TestMiniLlapLocalCliDriver -Dqfile=create_database.q

# Queries ran by both MiniLlapLocal and MiniTez
minitez.query.files.shared=\
compressed_skip_header_footer_aggr.q,\
create_database.q,\
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use TestMiniLlapLocalCliDriver if the patch has nothing specific to tez container mode

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Good to know :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the Tez tests and squashed the commits.

POSTHOOK: type: DESCDATABASE
POSTHOOK: Input: database:newdb
newdb location/in/test hive_test_user USER
#### A masked pattern was here ####
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to double-check in what way the output changed which triggered a q.out masking

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The managedlocation is like "file:/home/robbie/hive/itests/qtest/target/localfs/warehouse/newdb.db" which matches "file:" in QOutProcessor.maskIfContains.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, I created a followup ticket for this: HIVE-25473 (in order to get useful info back)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the original output is like:
newdb location/in/test file:/home/robbie/hive/itests/qtest/target/localfs/warehouse/newdb.db hive_test_user USER

The managedlocation is not empty. Because of the pattern "file:/", QOutProcessor masks the whole line.

replicatedDbName.toLowerCase() + ".db").toUri().getPath());
} else {
Assert.assertNotEquals(managedCustLocOnSrc, null);
Assert.assertEquals(replDatabase.getManagedLocationUri(), null);
Copy link
Contributor

Choose a reason for hiding this comment

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

@pkumarsinha: could you please confirm if removing this assertion won't hide any problems with replication?
this patch takes care of setting managed location uri if it's not set by create database

Copy link
Contributor

Choose a reason for hiding this comment

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

@ujc714 Rather than removing, I think we should assert that replDatabase.getManagedLocationUri() is in default warehouse location, i.e it should be equal to new Path(replica.warehouseRoot, replicatedDbName.toLowerCase() + ".db")

Copy link
Contributor Author

@ujc714 ujc714 Sep 23, 2021

Choose a reason for hiding this comment

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

@pkumarsinha Made the change as you suggested :)

Table Type: EXTERNAL_TABLE
Table Parameters:
COLUMN_STATS_ACCURATE {\"BASIC_STATS\":\"true\"}
COLUMN_STATS_ACCURATE {\"BASIC_STATS\":\"true\",\"COLUMN_STATS\":{\"id\":\"true\",\"value\":\"true\"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

is this because of the patch? looks unrelated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. The two iceberg qfiles are updated in the master branch. I rebased and recommitted the changes again.

@abstractdog
Copy link
Contributor

change looks good to me, all tests passed +1

@abstractdog abstractdog merged commit e570856 into apache:master Sep 27, 2021
HarshitGupta11 pushed a commit to HarshitGupta11/hive that referenced this pull request Dec 12, 2021
…ctory (apache#2478) (Robbie Zhang reviewed by Laszlo Bodor and Pravin Kumar Sinha)
dengzhhu653 pushed a commit to dengzhhu653/hive that referenced this pull request Dec 15, 2022
…ctory (apache#2478) (Robbie Zhang reviewed by Laszlo Bodor and Pravin Kumar Sinha)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants