apache / beam

Apache Beam is a unified programming model for Batch and Streaming data processing.
https://beam.apache.org/
Apache License 2.0
7.78k stars 4.21k forks source link

Prefer java binary from $JAVA_HOME in JavaJarServer #21006

Open damccorm opened 2 years ago

damccorm commented 2 years ago

JavaJarServer should prefer the java binary from $JAVA_HOME if set.

Original Report:

Using a SQLTransform results in an error.

 

python --version

Python 3.7.11

 

pip list | grep apache-beam

apache-beam        2.31.0

 

The following code works if removing the SQLTransform:

import itertools
import csv
import io

import apache_beam as beam
from apache_beam.dataframe.io import read_csv
from apache_beam.transforms.sql import SqlTransform

def parse_csv(val):
deflower_headers(iterator):
return itertools.chain([next(iterator).lower()], iterator)
return csv.DictReader(lower_headers(io.TextIOWrapper(val.open())))

class BeamTransformBuilder():

defbuild(self, pipeline):
practices = (
pipeline
| beam.io.fileio.MatchFiles("data.csv")
| beam.io.fileio.ReadMatches()
| beam.Reshuffle()
| beam.FlatMap(parse_csv)
| beam.Map(lambda x: beam.Row(id="test-id"))
| SqlTransform("""
SELECT
id
FROM PCOLLECTION""")
)
print("should print stuff")
practices | beam.Map(print)

def main():
builder = BeamTransformBuilder()
with beam.Pipeline('DirectRunner') as p:
builder.build(p)

if __name__ \== '__main__':
main()

 

error message:

    main()    main()  File "./lib/transforms/care_site.py", line 38, in main    builder.build(p)  File "./lib/transforms/care_site.py", line 29, in build    FROM PCOLLECTION""")  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/apache_beam/pvalue.py", line 136, in or    return self.pipeline.apply(ptransform, self)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/apache_beam/pipeline.py", line 694, in apply    pvalueish_result = self.runner.apply(transform, pvalueish, self._options)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/apache_beam/runners/runner.py", line 185, in apply    return m(transform, input, options)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/apache_beam/runners/runner.py", line 215, in apply_PTransform    return transform.expand(input)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/apache_beam/transforms/external.py", line 295, in expand    response = service.Expand(request)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/grpc/_channel.py", line 946, in call    return _end_unary_response_blocking(state, call, False, None)  File "/Users/<user>/.pyenv/versions/3.7.11/lib/python3.7/site-packages/grpc/_channel.py", line 849, in _end_unary_response_blocking    raise _InactiveRpcError(state)grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with: status = StatusCode.UNKNOWN details = "" debug_error_string = "{"created":"@1629934400.533958000","description":"Error received from peer ipv6:[::1]:50780","file":"src/core/lib/surface/call.cc","file_line":1070,"grpc_message":"","grpc_status":2}"

Imported from Jira BEAM-12804. Original Jira may contain additional context. Reported by: steeling.

rathishkumar commented 1 year ago

Hi,

Any workaround to this issue?