forked from greenplum-db/pxf-archive
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from arenadata/feature/ADBDEV-5743
ADBDEV-5743: [Java] Extend support for year > 4 digits and BC/AD dating notation
- Loading branch information
Showing
23 changed files
with
602 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...xf-jdbc/src/main/java/org/greenplum/pxf/plugins/jdbc/partitioning/BaseRangePartition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.greenplum.pxf.plugins.jdbc.partitioning; | ||
|
||
import lombok.NonNull; | ||
|
||
/** | ||
* A base class for partition of any type. | ||
* <p> | ||
* All partitions use some column as a partition column. It is processed by this class. | ||
*/ | ||
public abstract class BaseRangePartition extends BasePartition { | ||
public BaseRangePartition(@NonNull String column) { | ||
super(column); | ||
} | ||
|
||
/** | ||
* Generate a range-based SQL constraint | ||
* | ||
* @param quotedColumn column name (used as is, thus it should be quoted if necessary) | ||
* @param start range start to base constraint on | ||
* @param end range end to base constraint on | ||
* @return a pure SQL constraint (without WHERE) | ||
*/ | ||
String generateRangeConstraint(String quotedColumn, String start, String end) { | ||
StringBuilder sb = new StringBuilder(quotedColumn); | ||
|
||
if (start == null) { | ||
sb.append(" < ").append(end); | ||
} else if (end == null) { | ||
sb.append(" >= ").append(start); | ||
} else { | ||
sb.append(" >= ").append(start) | ||
.append(" AND ") | ||
.append(quotedColumn).append(" < ").append(end); | ||
} | ||
|
||
return sb.toString(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...xf-jdbc/src/main/java/org/greenplum/pxf/plugins/jdbc/partitioning/BaseValuePartition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.greenplum.pxf.plugins.jdbc.partitioning; | ||
|
||
import lombok.NonNull; | ||
|
||
/** | ||
* A base class for partition of any type. | ||
* <p> | ||
* All partitions use some column as a partition column. It is processed by this class. | ||
*/ | ||
public abstract class BaseValuePartition extends BasePartition { | ||
public BaseValuePartition(@NonNull String column) { | ||
super(column); | ||
} | ||
|
||
/** | ||
* Generate a range-based SQL constraint | ||
* | ||
* @param quotedColumn column name (used as is, thus it should be quoted if necessary) | ||
* @param value value to base constraint on | ||
* @return a pure SQL constraint (without WHERE) | ||
*/ | ||
String generateConstraint(String quotedColumn, String value) { | ||
return quotedColumn + " = " + value; | ||
} | ||
} |
Oops, something went wrong.