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

[CARBONDATA-3562] Fix for SDK filter queries not working when schema is given explicitly while Add Segment #3427

Closed
wants to merge 1 commit into from

Conversation

manishnalla1994
Copy link
Contributor

@manishnalla1994 manishnalla1994 commented Oct 30, 2019

Problem1 : Queries will not return correct result from added segment when the schema is given explicitly in case of SDK.

Solution : Handled it by validating based on both column name and column id if it matches for the SDK column.

Problem2 : While deleting added segment, the physical location is also getting deleted.
Solution: Fixed that by adding validation.

Be sure to do all of the following checklist to help us incorporate
your contribution quickly and easily:

  • Any interfaces changed?

  • Any backward compatibility impacted?

  • Document update required?

  • Testing done
    Please provide details on
    - Whether new unit test cases have been added or why no new tests are required?
    - How it is tested? Please attach test report.
    - Is it a performance related change? Please attach the performance test report.
    - Any additional information to help reviewers in testing this change.

  • For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.

@manishnalla1994
Copy link
Contributor Author

@ravipesala Please review.

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/717/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/718/

@CarbonDataQA
Copy link

Build Failed with Spark 2.2.1, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.2/725/

@CarbonDataQA
Copy link

Build Failed with Spark 2.3.2, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/726/

@@ -722,12 +723,28 @@ class AddSegmentTestCase extends QueryTest with BeforeAndAfterAll {
val externalSegmentPath = storeLocation + "/" + "external_segment"
FileFactory.deleteAllFilesOfDir(new File(externalSegmentPath))

var fields: Array[Field] = new Array[Field](14)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this test case changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is changed just to check for the schema which we give externally instead of referring to schema file of the already existing table.

@ravipesala
Copy link
Contributor

@manishnalla1994 I think this fix might induce new issues in alter table , like drop column and add back the column with the same name might not work as expected.

@manishnalla1994
Copy link
Contributor Author

@ravipesala when we add the same column then the column id will be different, so it wont match in our case.

@manishnalla1994 manishnalla1994 force-pushed the SDKIssueFix branch 2 times, most recently from 318a118 to fbb55fb Compare November 5, 2019 05:01
@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/745/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.2/751/

@@ -167,15 +167,22 @@ public static boolean isColumnMatches(boolean isTransactionalTable,
// column ID but can have same column name
if (tableColumn.getDataType().isComplexType() && !(tableColumn.getDataType().getId()
== DataTypes.ARRAY_TYPE_ID)) {
if (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId())) {
if (tableColumn.getColumnId().equalsIgnoreCase(queryColumn.getColumnId()) || (
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you override equals method of Column or add method inside a column to do this check. It is pretty repetitive and more prone to issues.

if (carbonDimension.getColumnSchema().getColumnUniqueId()
.equalsIgnoreCase(queryColumn.getColumnId())) {
.equalsIgnoreCase(queryColumn.getColumnId()) || (
carbonDimension.getColumnSchema().getColumnUniqueId()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why there is a diff of condition check for dimension and measure? Here we compare with ColumnUniqueId but other places are not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is only for the case of struct matching, as was before, just added one more check.

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/753/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/754/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/762/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.2/760/

@jackylk
Copy link
Contributor

jackylk commented Nov 6, 2019

LGTM

1 similar comment
@ravipesala
Copy link
Contributor

LGTM

@manishnalla1994
Copy link
Contributor Author

retest this please

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/784/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.2/790/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/792/

@CarbonDataQA
Copy link

Build Success with Spark 2.1.0, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.1/789/

@CarbonDataQA
Copy link

Build Success with Spark 2.3.2, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.3/797/

@CarbonDataQA
Copy link

Build Success with Spark 2.2.1, Please check CI http://121.244.95.60:12545/job/ApacheCarbonPRBuilder2.2/795/

@ajantha-bhat
Copy link
Member

LGTM

@asfgit asfgit closed this in 86f12c8 Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants