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

HPCC4J-581 WsFS Client should add path delim only if needed #686

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
65a2856
Split off 9.2.0
ghalliday Jun 15, 2023
48d067c
HPCC4J-514 Ensure WUQueryTest creates multiple WUs (#618)
rpastrana Jun 21, 2023
d378484
Update publish-snapshots-on-merge.yml (#617)
rpastrana Jun 22, 2023
8ce998f
Merge remote-tracking branch 'origin/candidate-9.2.x'
jakesmith Jun 23, 2023
8532695
HPCC4J-522 GithutAction targets java8 (#620)
rpastrana Jul 11, 2023
815b405
Merge remote-tracking branch 'origin/candidate-9.2.x'
GordonSmith Jul 20, 2023
678afb5
Create Jirabot.yml
rpastrana Jul 24, 2023
3af0028
Merge remote-tracking branch 'origin/candidate-9.2.x'
GordonSmith Jul 27, 2023
9aa9529
Merge remote-tracking branch 'origin/candidate-9.2.x'
jakesmith Aug 11, 2023
6174408
Merge remote-tracking branch 'origin/candidate-9.2.x'
jakesmith Aug 17, 2023
a5611b8
HPCC4J-532 Jirabot should translate hpcc4j prefix (#633)
jpmcmu Aug 18, 2023
a20ff7c
Merge remote-tracking branch 'origin/candidate-9.2.x'
GordonSmith Aug 25, 2023
26c3f39
Merge remote-tracking branch 'origin/candidate-9.2.x'
jakesmith Aug 31, 2023
962a2f7
Merge remote-tracking branch 'origin/candidate-9.2.x'
GordonSmith Sep 7, 2023
50acafd
Split off 9.4.0
GordonSmith Sep 7, 2023
b2e45c9
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Sep 14, 2023
15e4128
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
GordonSmith Sep 21, 2023
2646614
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
ghalliday Sep 28, 2023
acc0ecb
Split off 9.4.2
jakesmith Oct 5, 2023
905b095
HPCC4J-542 DFSClient: Create JUnit for read retry (#648)
jpmcmu Oct 13, 2023
80d27a8
HPCC4J-545 Resume read test causes OOM error (#649)
jpmcmu Oct 13, 2023
28183cf
Split off 9.4.4
ghalliday Oct 13, 2023
b5e89dd
Split off 9.4.6
GordonSmith Oct 26, 2023
2dc8279
HPCC4J-551 HPCCFile Make TLK Use Optional (#653)
jpmcmu Nov 1, 2023
f0ec51e
HPCC4J-551 HPCCFile Make TLK Use Optional
jpmcmu Nov 1, 2023
99601b0
Merge pull request #655 from jpmcmu/HPCC4J-551
jpmcmu Nov 1, 2023
5f8d0b5
Split off 9.4.8
ghalliday Nov 2, 2023
787373a
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
ghalliday Nov 3, 2023
15e295f
HPCC4J-532 Jirabot debugging improvements (#656)
jpmcmu Nov 7, 2023
16e3bf6
Bump org.json:json from 20230227 to 20231013 (#650) (#657)
rpastrana Nov 7, 2023
5ea3beb
HPCC4J-511 Test failures in containerized environment (#654)
jpmcmu Nov 7, 2023
feb19f5
HPCC4J-552 File Utility Read Invididual File Parts (#658)
jpmcmu Nov 8, 2023
30c2e6a
Split off 9.4.10
ghalliday Nov 9, 2023
4a667da
HPCC4J-556: File Reader Early Close Behavior (#659)
jpmcmu Nov 16, 2023
a397198
Split off 9.4.12
jakesmith Nov 17, 2023
b63ae1d
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Nov 17, 2023
29a631c
HPCC4J-557 Bump hadoop dep to 3.3.6
Nov 20, 2023
4270872
Merge pull request #660 from rpastrana/candidate-9.4.x
jpmcmu Nov 22, 2023
52982cd
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
GordonSmith Nov 23, 2023
babf482
Split off 9.4.14
GordonSmith Nov 23, 2023
1246b39
HPCC4J-558 Github Actions: Outdated HPCC Version (#662)
jpmcmu Nov 27, 2023
16583bf
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Nov 30, 2023
c9ecd67
Split off 9.4.16
jakesmith Nov 30, 2023
ee8a8f4
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
GordonSmith Dec 7, 2023
99fad9f
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
GordonSmith Dec 7, 2023
0e9321b
Split off 9.4.18
GordonSmith Dec 7, 2023
deee138
HPCC4J-555 POM Fixes (#664)
jpmcmu Dec 8, 2023
b3b7647
HPCC4J-562 Odd unsigned decimals incorrect scale (#666)
jpmcmu Dec 13, 2023
770f571
Split off 9.4.20
GordonSmith Dec 14, 2023
aeddaf7
HPCC4J-561 copyfile test wait for spray completion (#668)
jpmcmu Dec 18, 2023
5554f9f
Split off 9.4.22
jakesmith Dec 21, 2023
2335fd0
Split off 9.4.24
GordonSmith Jan 4, 2024
eac3298
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Jan 11, 2024
14f2a15
Split off 9.4.26
jakesmith Jan 11, 2024
deca046
HPCC4J-553 Github Actions: Add baremetal test workflow (#669)
jpmcmu Jan 19, 2024
9f73bd1
Split off 9.4.28
ghalliday Jan 19, 2024
87c36bf
Split off 9.4.30
jakesmith Jan 25, 2024
f743445
HCCP4J-571 Github Action: Jirabot Merge fails to find tag (#673)
jpmcmu Jan 29, 2024
7253313
HPCC4J-571 Github Action: Jirabot Merge fails to find correct tag (#677)
jpmcmu Jan 31, 2024
9b112b3
HPCC4J-553 Github Actions: Add baremetal test workflow (#674)
jpmcmu Feb 1, 2024
e705165
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
ghalliday Feb 2, 2024
365369b
Split off 9.4.32
ghalliday Feb 2, 2024
494517c
Split off 9.4.34
GordonSmith Feb 12, 2024
961b1e1
Split off 9.4.36
GordonSmith Feb 15, 2024
cd7229b
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Feb 22, 2024
5634319
Split off 9.4.38
jakesmith Feb 22, 2024
71c82a3
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
jakesmith Feb 29, 2024
4c55669
Split off 9.4.40
jakesmith Feb 29, 2024
be37a87
HPCC4J-581 WsFS Client should add path delim only if needed
rpastrana Mar 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commons-hpcc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.hpccsystems</groupId>
<artifactId>hpcc4j</artifactId>
<version>9.2.65-0-SNAPSHOT</version>
<version>9.4.41-0-SNAPSHOT</version>
</parent>

<build>
Expand Down
2 changes: 1 addition & 1 deletion dfsclient/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>org.hpccsystems</groupId>
<artifactId>hpcc4j</artifactId>
<version>9.2.65-0-SNAPSHOT</version>
<version>9.4.41-0-SNAPSHOT</version>
</parent>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,15 @@ private BigDecimal getUnsignedDecimal(int numDigits, int precision, int dataLen)
BigDecimal ret = new BigDecimal(0);

int idx = 0;
int curDigit = numDigits - 1;
int curDigit = numDigits;

// If the # of digits is odd the top most nibble is unused and we don't want to include it
// in the scale calculations below. Due to how the scale calculation works below this means
// we decrement the starting value of curDigit in the case of even length decimals
if ((numDigits % 2) == 0)
{
curDigit--;
}

while (idx < dataLen)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
package org.hpccsystems.dfs.client;

import java.io.Serializable;
import java.security.InvalidParameterException;
import java.util.List;
import java.util.ArrayList;
import java.util.Arrays;

import org.hpccsystems.commons.ecl.FileFilter;
import org.hpccsystems.commons.errors.HpccFileException;
Expand Down Expand Up @@ -261,11 +265,61 @@ public String[] getCopyLocations()
public String getCopyIP(int copyindex)
{
int copiescount = copyLocations.length;
if (copyindex < 0 || copyindex >= copiescount) return null;
if (copyindex < 0 || copyindex >= copiescount)
{
return null;
}

return copyLocations[copyindex];
}

/**
* Set the copy IP
*
* @param copyIndex
* the copyindex
* @param copyIP The IP of the file part copy
*/
public void setCopyIP(int copyIndex, String copyIP)
{
if (copyIndex < 0 || copyIndex >= copyLocations.length)
{
return;
}

copyLocations[copyIndex] = copyIP;
}

/**
* Add file part copy
*
* @param index The index at which to insert the file part copy
* @param copyIP The IP of the new file part copy
* @param copyPath The path of the new file part copy
* @throws Exception The exception
*/
public void add(int index, String copyIP, String copyPath) throws Exception
{
if (index < 0 || index > copyLocations.length)
{
throw new InvalidParameterException("Insertion index: " + index + " is invalid."
+ "Expected index in range of: [0," + copyLocations.length + "]");
}

if (copyIP == null || copyPath == null)
{
throw new InvalidParameterException("Copy IP or Path are invalid, must be non-null.");
}

List<String> copyLocationsList = new ArrayList<>(Arrays.asList(copyLocations));
copyLocationsList.add(index, copyIP);
copyLocations = copyLocationsList.toArray(new String[0]);

List<String> copyPathList = new ArrayList<>(Arrays.asList(copyPaths));
copyPathList.add(index, copyPath);
copyPaths = copyPathList.toArray(new String[0]);
}

/**
* Count of copies available for this file part.
* @return copy locations size
Expand Down
220 changes: 220 additions & 0 deletions dfsclient/src/main/java/org/hpccsystems/dfs/client/FileUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,24 @@ private static Options getReadOptions()
return options;
}

private static Options getReadTestOptions()
{
Options options = new Options();
options.addRequiredOption("read_test", "Read test", true, "Specifies the file that should be read.");
options.addRequiredOption("url", "Source Cluster URL", true, "Specifies the URL of the ESP to connect to.");
options.addOption("user", true, "Specifies the username used to connect. Defaults to null.");
options.addOption("pass", true, "Specifies the password used to connect. Defaults to null.");
options.addOption("num_threads", true, "Specifies the number of parallel to use to perform operations.");

options.addOption(Option.builder("file_parts")
.argName("_file_parts")
.hasArgs()
.valueSeparator(',')
.desc("Specifies the file parts that should be read. Defaults to all file parts.")
.build());
return options;
}

private static Options getCopyOptions()
{
Options options = new Options();
Expand Down Expand Up @@ -463,6 +481,7 @@ private static Options getTopLevelOptions()
{
Options options = new Options();
options.addOption("read", "Reads the specified file(s) and writes a copy of the files to the local directory.");
options.addOption("read_test", "Reads the specified file and/or particular file parts without writing it locally.");
options.addOption("copy", "Copies the specified remote source file to the specified remote destination cluster / file.");
options.addOption("write", "Writes the specified local source file to the specified remote destination cluster / file.");

Expand Down Expand Up @@ -660,6 +679,44 @@ public void run()
}
}

private static Runnable[] createReadTestTasks(DataPartition[] fileParts, FieldDef recordDef, TaskContext context) throws Exception
{
Runnable[] tasks = new Runnable[fileParts.length];
for (int i = 0; i < tasks.length; i++)
{
final int taskIndex = i;
final DataPartition filePart = fileParts[taskIndex];
final HpccRemoteFileReader<HPCCRecord> filePartReader = new HpccRemoteFileReader<HPCCRecord>(filePart, recordDef, new HPCCRecordBuilder(recordDef));

tasks[taskIndex] = new Runnable()
{
HpccRemoteFileReader<HPCCRecord> fileReader = filePartReader;

public void run()
{
try
{
while (fileReader.hasNext())
{
HPCCRecord record = fileReader.next();
context.recordsRead.incrementAndGet();
}

fileReader.close();
context.bytesRead.addAndGet(fileReader.getStreamPosition());
}
catch (Exception e)
{
context.addError("Error while reading file part index: '" + filePart.getThisPart() + " Error message: " + e.getMessage());
return;
}
}
};
}

return tasks;
}

private static Runnable[] createReadToThorTasks(DataPartition[] fileParts, SplitTable[] splitTables, String[] outFilePaths, FieldDef recordDef, TaskContext context) throws Exception
{
Runnable[] tasks = new Runnable[fileParts.length];
Expand Down Expand Up @@ -1159,6 +1216,165 @@ private static void performRead(String[] args, TaskContext context)
}
}

private static void performReadTest(String[] args, TaskContext context)
{
Options options = getReadTestOptions();
CommandLineParser parser = new DefaultParser();

CommandLine cmd = null;
try
{
cmd = parser.parse(options, args);
}
catch (ParseException e)
{
System.out.println("Error parsing commandline options:\n" + e.getMessage());
return;
}

String connString = cmd.getOptionValue("url");
String user = cmd.getOptionValue("user");
String pass = cmd.getOptionValue("pass");

String outputPath = cmd.getOptionValue("out",".");

int numThreads = NUM_DEFAULT_THREADS;
String numThreadsStr = cmd.getOptionValue("num_threads", "" + numThreads);
try
{
numThreads = Integer.parseInt(numThreadsStr);
}
catch(Exception e)
{
System.out.println("Invalid option value for num_threads: "
+ numThreadsStr + ", must be an integer. Defaulting to: " + NUM_DEFAULT_THREADS + " threads.");
}

String formatStr = cmd.getOptionValue("format");
if (formatStr == null)
{
formatStr = "THOR";
}

FileFormat format = FileFormat.THOR;
switch (formatStr.toUpperCase())
{
case "THOR":
format = FileFormat.THOR;
break;
case "PARQUET":
format = FileFormat.PARQUET;
break;
default:
System.out.println("Error unsupported format specified: " + format);
return;
}

String datasetName = cmd.getOptionValue("read_test");
context.startOperation("Read Test " + datasetName);

HPCCFile file = null;
try
{
file = new HPCCFile(datasetName, connString, user, pass);
}
catch (Exception e)
{
System.out.println("Error while attempting to open file: '" + datasetName + "': " + e.getMessage());
return;
}

DataPartition[] fileParts = null;
FieldDef recordDef = null;
try
{
fileParts = file.getFileParts();
recordDef = file.getRecordDefinition();
}
catch (Exception e)
{
System.out.println("Error while retrieving file parts for: '" + datasetName + "': " + e.getMessage());
return;
}

String[] filePartsStrs = cmd.getOptionValues("file_parts");
if (filePartsStrs != null && filePartsStrs.length > 0)
{
ArrayList<DataPartition> filePartList = new ArrayList<DataPartition>();
for (int i = 0; i < filePartsStrs.length; i++)
{
try
{
int filePartIndex = Integer.parseInt(filePartsStrs[i]) - 1;
if (filePartIndex < 0 || filePartIndex >= fileParts.length)
{
System.out.println("Skipping invalid file part index: " + filePartsStrs[i]
+ " outside of range: [0," + fileParts.length + "]");
continue;
}

filePartList.add(fileParts[filePartIndex]);
}
catch (NumberFormatException e)
{
System.out.println("Skipping invalid file part index: " + filePartsStrs[i]);
}
}
}

Runnable[] tasks = null;
try
{
switch (format)
{
case THOR:
tasks = createReadTestTasks(fileParts, recordDef, context);
break;
case PARQUET:
default:
throw new Exception("Error unsupported format specified: " + format);
};
}
catch (Exception e)
{
context.addError("Error while attempting to create read tasks for file: '" + datasetName + "': " + e.getMessage());
return;
}

try
{
executeTasks(tasks, numThreads);
}
catch (Exception e)
{
context.addError("Error while attempting to execute read tasks for file: '" + datasetName + "': " + e.getMessage());
return;
}

if (context.hasError())
{
return;
}

try
{
String fileName = file.getFileName().replace(":","_");
String filePath = outputPath + File.separator + fileName + ".meta";
FileOutputStream metaFile = new FileOutputStream(filePath);

String metaStr = RecordDefinitionTranslator.toJsonRecord(file.getRecordDefinition()).toString();
metaFile.write(metaStr.getBytes());
metaFile.close();
}
catch (Exception e)
{
context.addError("Error while attempting to write meta-data for file: '" + datasetName + "': " + e.getMessage());
return;
}

context.endOperation();
}

private static void performCopy(String[] args, TaskContext context)
{
Options options = getCopyOptions();
Expand Down Expand Up @@ -1576,6 +1792,10 @@ public static JSONArray run(String[] args)
{
performRead(args, context);
}
else if (cmd.hasOption("read_test"))
{
performReadTest(args, context);
}
else if (cmd.hasOption("copy"))
{
performCopy(args, context);
Expand Down
Loading
Loading