-
Notifications
You must be signed in to change notification settings - Fork 60
PHOENIX-5238 Provide an option to pass hints with PhoenixRDD and Data… #4
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,6 +70,7 @@ public class PhoenixDataSourceReader implements DataSourceReader, SupportsPushDo | |
| private final String zkUrl; | ||
| private final boolean dateAsTimestamp; | ||
| private final Properties overriddenProps; | ||
| private final boolean disableBlockCache; | ||
|
|
||
| private StructType schema; | ||
| private Filter[] pushedFilters = new Filter[]{}; | ||
|
|
@@ -87,6 +88,7 @@ public PhoenixDataSourceReader(DataSourceOptions options) { | |
| this.tableName = options.tableName().get(); | ||
| this.zkUrl = options.get(PhoenixDataSource.ZOOKEEPER_URL).get(); | ||
| this.dateAsTimestamp = options.getBoolean("dateAsTimestamp", false); | ||
| this.disableBlockCache = options.getBoolean("NO_CACHE", false); | ||
| this.overriddenProps = extractPhoenixHBaseConfFromOptions(options); | ||
| setSchema(); | ||
| } | ||
|
|
@@ -148,6 +150,9 @@ public List<InputPartition<InternalRow>> planInputPartitions() { | |
| // Optimize the query plan so that we potentially use secondary indexes | ||
| final QueryPlan queryPlan = pstmt.optimizeQuery(selectStatement); | ||
| final Scan scan = queryPlan.getContext().getScan(); | ||
| if (this.disableBlockCache) { | ||
| scan.setCacheBlocks(false); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Also, in case this hint is provided, you should make sure any other scan objects used on the driver also has this property set for example, the scan that we use on the driver-side to get the region locations. |
||
| } | ||
|
|
||
| // setting the snapshot configuration | ||
| Optional<String> snapshotName = options.get(PhoenixConfigurationUtil.SNAPSHOT_NAME_KEY); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,11 +38,14 @@ public class PhoenixDataSourceTest { | |
| private static final String V1 = "v1"; | ||
| private static final String V2 = "v2"; | ||
| private static final String V3 = "v3"; | ||
| private static final String NO_CACHE = "NO_CACHE"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above about using already defined enum value |
||
| private static final String NO_CACHE_VALUE = "true"; | ||
| private static final String EQ = "="; | ||
| private static final String COMMA = ","; | ||
| private static final String SINGLE_PHOENIX_PROP = P1 + EQ + V1; | ||
| private static final String VALID_PHOENIX_PROPS_LIST = | ||
| SINGLE_PHOENIX_PROP + COMMA + P2 + EQ + V2 + COMMA + P3 + EQ + V3; | ||
| SINGLE_PHOENIX_PROP + COMMA + P2 + EQ + V2 + COMMA + P3 + EQ + V3 + COMMA + | ||
| NO_CACHE + EQ + NO_CACHE_VALUE; | ||
| private static final String INVALID_PHOENIX_PROPS_LIST = | ||
| SINGLE_PHOENIX_PROP + COMMA + P2 + V2 + COMMA + P3 + EQ + V3; | ||
|
|
||
|
|
@@ -64,6 +67,8 @@ public void testPhoenixConfigsExtractedProperly() { | |
| assertEquals(V1, p.getProperty(P1)); | ||
| assertEquals(V2, p.getProperty(P2)); | ||
| assertEquals(V3, p.getProperty(P3)); | ||
| assertEquals(V3, p.getProperty(P3)); | ||
| assertEquals(true, Boolean.valueOf(p.getProperty(NO_CACHE))); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test isn't testing your change at all..Here you are using the extraOptions to set the property and just checking that the property is set. Ideally, we want to use extraOptions to set HBase/Phoenix properties if they are valid configs we set, in say hbase-site.xml. In this case, |
||
| } | ||
|
|
||
| @Test | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use
Hint.NO_CACHEinstead of the String for consistency?