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-4137] Refactor CarbonDataSourceScan without the soruces.Filter of Spark 3 #4097

Closed
wants to merge 1 commit into from

Conversation

QiangCai
Copy link
Contributor

@QiangCai QiangCai commented Feb 22, 2021

Why is this PR needed?

  1. In spark version 3, org.apache.spark.sql.sources.Filter is sealed, carbon can't extend it in carbon code.
  2. The name of CarbonLateDecodeStrategy class is incorrect, the code is complex and hard to read
  3. CarbonDataSourceScan can be the same for 2.3 and 2.4, and should support both batch reading and row reading.

What changes were proposed in this PR?

  1. translate spark Expression to carbon Expression directly, skip the spark Filter step. Remove all spark Filters in carbon code.
    old follow: Spark Expression => Spark Filter => Carbon Expression
    new follow: Spark Expression => Carbon Expression

  2. Remove filter reorder, need to implement expression reorder (added CARBONDATA-4138).

  3. separate CarbonLateDecodeStrategy to CarbonSourceStrategy and DMLStrategy, and simplify the code of CarbonSourceStrategy.

  4. move CarbonDataSourceScan back to the source folder, use one CarbonDataSourceScan for all versions
    CarbonDataSourceScan supports both VectorReader and RowReader, Carbon will not use RowDataSourceScanExec.

Does this PR introduce any user interface change?

  • No

Is any new testcase added?

  • No

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5503/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3738/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5504/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3739/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5506/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3741/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3744/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5509/

@QiangCai QiangCai changed the title [WIP] Refactor CarbonLateDecodeStrategy and CarbonDataSourceScan [WIP] Refactor CarbonLateDecodeStrategy and CarbonDataSourceScan for spark3 Feb 24, 2021
@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5511/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3746/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5514/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3749/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5515/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3750/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5518/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3753/

@QiangCai
Copy link
Contributor Author

retest this please

@QiangCai QiangCai changed the title [WIP] Refactor CarbonLateDecodeStrategy and CarbonDataSourceScan for spark3 [CARBONDATA-4137] Refactor CarbonDataSourceScan without Spark Filter Feb 26, 2021
@QiangCai QiangCai changed the title [CARBONDATA-4137] Refactor CarbonDataSourceScan without Spark Filter [CARBONDATA-4137] Refactor CarbonDataSourceScan without the soruces.Filter of Spark 3 Feb 26, 2021
@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3754/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5519/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5520/

@CarbonDataQA2
Copy link

Build Failed with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3755/

@CarbonDataQA2
Copy link

Build Success with Spark 2.3.4, Please check CI http://121.244.95.60:12444/job/ApacheCarbonPRBuilder2.3/5521/

@CarbonDataQA2
Copy link

Build Success with Spark 2.4.5, Please check CI http://121.244.95.60:12444/job/ApacheCarbon_PR_Builder_2.4.5/3756/

@CarbonDataQA2
Copy link

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

@CarbonDataQA2
Copy link

Build Success with Spark 2.4.5, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/3339/

@CarbonDataQA2
Copy link

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

@CarbonDataQA2
Copy link

Build Success with Spark 2.4.5, Please check CI http://121.244.95.60:12545/job/ApacheCarbon_PR_Builder_2.4.5/3349/

@@ -59,23 +58,3 @@ class InPolygonRangeListUDF extends ((String, String) => Boolean) with Serializa
true // Carbon applies the filter. So, Spark do not have to apply filter.
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this filter is use for Spatial index, if remove how about that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. it will still keep the udf and expression for Spatial index

  2. In the old flow, carbon converts spark expression to spark filter, and then converts spark filter to carbon expression.
    So, after creating carbon expression, this filter will be removed from memory.
    Now in the new flow, it will convert spark expression to carbon expression directly, and not need this filter.

@@ -34,13 +32,3 @@ class TextMatchMaxDocUDF extends ((String, Int) => Boolean) with Serializable {
v1.length > 0
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

the same as the Spatial index, if removed, how to use the fun.

…ilter of Spark 3

Why is this PR needed?
1. In spark version 3, org.apache.spark.sql.sources.Filter is sealed, carbon can't extend it in carbon code.
2. The name of CarbonLateDecodeStrategy class is incorrect, the code is complex and hard to read
3. CarbonDataSourceScan can be the same for 2.3 and 2.4, and should support both batch reading and row reading.

What changes were proposed in this PR?
1. translate spark Expression to carbon Expression directly, skip the spark Filter step. Remove all spark Filters in carbon code.
  old follow: Spark Expression => Spark Filter => Carbon Expression
  new follow: Spark Expression => Carbon Expression
2. Remove filter reorder, need to implement expression reorder (added CARBONDATA-4138).
3. separate CarbonLateDecodeStrategy to CarbonSourceStrategy and DMLStrategy, and simplify the code of CarbonSourceStrategy.
4. move CarbonDataSourceScan back to the source folder, use one CarbonDataSourceScan for all versions
  CarbonDataSourceScan supports both VectorReader and RowReader, Carbon will not use RowDataSourceScanExec.

Does this PR introduce any user interface change?
No

Is any new testcase added?
No
@MarvinLitt
Copy link
Contributor

LGTM

@MarvinLitt
Copy link
Contributor

merged

@QiangCai QiangCai closed this Mar 5, 2021
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.

3 participants